Function: proced-sort-interactive
proced-sort-interactive is an interactive and byte-compiled function
defined in proced.el.gz.
Signature
(proced-sort-interactive SCHEME &optional ARG)
Documentation
Sort Proced buffer using SCHEME.
When called interactively, an empty string means nil, i.e., no sorting.
Prefix ARG controls sort order:
- If prefix ARG is positive (negative), sort in ascending (descending) order.
- If ARG is nil or no-arg and SCHEME is equal to the previous sorting scheme,
reverse the sorting order.
- If ARG is nil or no-arg and SCHEME differs from the previous sorting scheme,
adopt the sorting order defined for SCHEME in proced-grammar-alist.
Set variable proced-sort(var)/proced-sort(fun) to SCHEME. The current sort scheme is displayed
in the mode line, using "+" or "-" for ascending or descending order.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/proced.el.gz
(defun proced-sort-interactive (scheme &optional arg)
"Sort Proced buffer using SCHEME.
When called interactively, an empty string means nil, i.e., no sorting.
Prefix ARG controls sort order:
- If prefix ARG is positive (negative), sort in ascending (descending) order.
- If ARG is nil or `no-arg' and SCHEME is equal to the previous sorting scheme,
reverse the sorting order.
- If ARG is nil or `no-arg' and SCHEME differs from the previous sorting scheme,
adopt the sorting order defined for SCHEME in `proced-grammar-alist'.
Set variable `proced-sort' to SCHEME. The current sort scheme is displayed
in the mode line, using \"+\" or \"-\" for ascending or descending order."
(interactive
(let* (choices
(scheme (completing-read "Sort attribute: "
(dolist (grammar proced-grammar-alist choices)
(if (nth 4 grammar)
(push (list (car grammar)) choices)))
nil t)))
(list (if (string= "" scheme) nil (intern scheme))
;; like 'toggle in `define-derived-mode'
(or current-prefix-arg 'no-arg)))
proced-mode)
(setq proced-descend
;; If `proced-sort-interactive' is called repeatedly for the same
;; sort key, the sort order is reversed.
(cond ((and (eq arg 'no-arg) (equal proced-sort scheme))
(not proced-descend))
((eq arg 'no-arg)
(nth 5 (assq (if (consp scheme) (car scheme) scheme)
proced-grammar-alist)))
(arg (< (prefix-numeric-value arg) 0))
((equal proced-sort scheme)
(not proced-descend))
(t (nth 5 (assq (if (consp scheme) (car scheme) scheme)
proced-grammar-alist))))
proced-sort scheme)
(proced-update))