Function: proced-sort
proced-sort is a byte-compiled function defined in proced.el.gz.
Signature
(proced-sort PROCESS-ALIST SORTER DESCEND)
Documentation
Sort PROCESS-ALIST using scheme SORTER.
SORTER is a scheme like proced-sort(var)/proced-sort(fun).
DESCEND is non-nil if the first element of SORTER is sorted
in descending order.
Return the sorted process list.
Source Code
;; Defined in /usr/src/emacs/lisp/proced.el.gz
(defun proced-sort (process-alist sorter descend)
"Sort PROCESS-ALIST using scheme SORTER.
SORTER is a scheme like `proced-sort'.
DESCEND is non-nil if the first element of SORTER is sorted
in descending order.
Return the sorted process list."
;; translate SORTER into a list of lists (KEY PREDICATE REVERSE)
(setq proced-sort-internal
(mapcar (lambda (arg)
(let ((grammar (assq arg proced-grammar-alist)))
(unless (nth 4 grammar)
(error "Attribute %s not sortable" (car grammar)))
(list arg (nth 4 grammar) (nth 5 grammar))))
(cond ((listp sorter) sorter)
((and (symbolp sorter)
(nth 6 (assq sorter proced-grammar-alist))))
((symbolp sorter) (list sorter))
(t (error "Sorter undefined %s" sorter)))))
(if proced-sort-internal
(progn
;; splice DESCEND into the list
(setcar proced-sort-internal
(list (caar proced-sort-internal)
(nth 1 (car proced-sort-internal)) descend))
(sort process-alist 'proced-sort-p))
process-alist))