From 9c58ea37afc044a49fdd59fb4d1b8b6dd2d49ca9 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Thu, 1 Dec 2022 20:15:52 +0200 Subject: [PATCH] ; Fix last change in proced.el * lisp/proced.el (proced-low-memory-usage-threshold) (proced-medium-memory-usage-threshold, proced-run-status-code) (proced-interruptible-sleep-status-code) (proced-uninterruptible-sleep-status-code, proced-executable): Fix doc strings. (proced-format-time): Simplify the format, to avoid bogus warnings from the byte-compiler. * etc/NEWS: Move Proced entries to one place and fix their wording. --- etc/NEWS | 32 +++++++++--------- lisp/proced.el | 91 ++++++++++++++++++++++++++++++-------------------- 2 files changed, 71 insertions(+), 52 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index bfd9b5f26e7..547b488a57b 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -504,14 +504,6 @@ option) and can be set to nil to disable Just-in-time Lock mode. * Changes in Emacs 29.1 ---- -** New user option `proced-enable-color-flag` to enable coloring of proced buffers -This option prompts some format functions to furnish their respective -process attributes with colors in a manner similar to htop. - -This option is disabled by default and needs setting to a non-nil -value to take effect. - +++ ** New user option 'major-mode-remap-alist' to specify favorite major modes. This user option lets you remap the default modes (e.g. 'perl-mode' or @@ -2818,6 +2810,22 @@ Set it to nil to exclude line numbering from kills and copies. argument which allows tree-widget display to be activated and computed only when the user expands the node. +** Proced + +--- +*** proced.el shows system processes of remote hosts. +When 'default-directory' is remote, and 'proced' is invoked with a +negative argument like 'C-u - proced', the system processes of that +remote host are shown. Alternatively, the user option +'proced-show-remote-processes' can be set to non-nil. +'proced-signal-function' has been marked obsolete. + +--- +*** Proced can now optionally show process details in color. +New user option 'proced-enable-color-flag' enables coloring of Proced +buffers. This option is disabled by default; customize it to a +non-nil value to enable colors. + ** Miscellaneous --- @@ -2903,14 +2911,6 @@ also been renamed: 'mark-bib' to 'bib-mark' 'unread-bib' to 'bib-unread' ---- -*** proced.el shows system processes of remote hosts. -When 'default-directory' is remote, and 'proced' is invoked with a -negative argument like 'C-u - proced', the system processes of that -remote host are shown. Alternatively, the user option -'proced-show-remote-processes' can be set to non-nil. -'proced-signal-function' has been marked obsolete. - --- *** 'outlineify-sticky' command is renamed to 'allout-outlinify-sticky'. The old name is still available as an obsolete function alias. diff --git a/lisp/proced.el b/lisp/proced.el index f91d3d2f223..c7419288edf 100644 --- a/lisp/proced.el +++ b/lisp/proced.el @@ -114,38 +114,55 @@ the external command (usually \"kill\")." (defcustom proced-grammar-alist '( ;; attributes defined in `process-attributes' (euid "EUID" "%d" right proced-< nil (euid pid) (nil t nil)) - (user "User" proced-format-user left proced-string-lessp nil (user pid) (nil t nil)) + (user "User" proced-format-user left proced-string-lessp nil + (user pid) (nil t nil)) (egid "EGID" "%d" right proced-< nil (egid euid pid) (nil t nil)) - (group "Group" nil left proced-string-lessp nil (group user pid) (nil t nil)) + (group "Group" nil left proced-string-lessp nil (group user pid) + (nil t nil)) (comm "Command" nil left proced-string-lessp nil (comm pid) (nil t nil)) - (state "Stat" proced-format-state left proced-string-lessp nil (state pid) (nil t nil)) + (state "Stat" proced-format-state left proced-string-lessp nil + (state pid) (nil t nil)) (ppid "PPID" proced-format-ppid right proced-< nil (ppid pid) - ((lambda (ppid) (proced-filter-parents proced-process-alist ppid)) - "refine to process parents")) - (pgrp "PGrp" proced-format-pgrp right proced-< nil (pgrp euid pid) (nil t nil)) - (sess "Sess" proced-format-sess right proced-< nil (sess pid) (nil t nil)) - (ttname "TTY" proced-format-ttname left proced-string-lessp nil (ttname pid) (nil t nil)) + ((lambda (ppid) + (proced-filter-parents proced-process-alist ppid)) + "refine to process parents")) + (pgrp "PGrp" proced-format-pgrp right proced-< nil (pgrp euid pid) + (nil t nil)) + (sess "Sess" proced-format-sess right proced-< nil (sess pid) + (nil t nil)) + (ttname "TTY" proced-format-ttname left proced-string-lessp nil + (ttname pid) (nil t nil)) (tpgid "TPGID" "%d" right proced-< nil (tpgid pid) (nil t nil)) (minflt "MinFlt" "%d" right proced-< nil (minflt pid) (nil t t)) (majflt "MajFlt" "%d" right proced-< nil (majflt pid) (nil t t)) (cminflt "CMinFlt" "%d" right proced-< nil (cminflt pid) (nil t t)) (cmajflt "CMajFlt" "%d" right proced-< nil (cmajflt pid) (nil t t)) - (utime "UTime" proced-format-time right proced-time-lessp t (utime pid) (nil t t)) - (stime "STime" proced-format-time right proced-time-lessp t (stime pid) (nil t t)) - (time "Time" proced-format-time right proced-time-lessp t (time pid) (nil t t)) - (cutime "CUTime" proced-format-time right proced-time-lessp t (cutime pid) (nil t t)) - (cstime "CSTime" proced-format-time right proced-time-lessp t (cstime pid) (nil t t)) - (ctime "CTime" proced-format-time right proced-time-lessp t (ctime pid) (nil t t)) + (utime "UTime" proced-format-time right proced-time-lessp t (utime pid) + (nil t t)) + (stime "STime" proced-format-time right proced-time-lessp t (stime pid) + (nil t t)) + (time "Time" proced-format-time right proced-time-lessp t (time pid) + (nil t t)) + (cutime "CUTime" proced-format-time right proced-time-lessp t (cutime pid) + (nil t t)) + (cstime "CSTime" proced-format-time right proced-time-lessp t (cstime pid) + (nil t t)) + (ctime "CTime" proced-format-time right proced-time-lessp t (ctime pid) + (nil t t)) (pri "Pr" "%d" right proced-< t (pri pid) (nil t t)) (nice "Ni" "%3d" 3 proced-< t (nice pid) (t t nil)) (thcount "THCount" "%d" right proced-< t (thcount pid) (nil t t)) - (start "Start" proced-format-start 6 proced-time-lessp nil (start pid) (t t nil)) - (vsize "VSize" proced-format-memory right proced-< t (vsize pid) (nil t t)) + (start "Start" proced-format-start 6 proced-time-lessp nil (start pid) + (t t nil)) + (vsize "VSize" proced-format-memory right proced-< t (vsize pid) + (nil t t)) (rss "RSS" proced-format-rss right proced-< t (rss pid) (nil t t)) - (etime "ETime" proced-format-time right proced-time-lessp t (etime pid) (nil t t)) + (etime "ETime" proced-format-time right proced-time-lessp t (etime pid) + (nil t t)) (pcpu "%CPU" proced-format-cpu right proced-< t (pcpu pid) (nil t t)) (pmem "%Mem" proced-format-mem right proced-< t (pmem pid) (nil t t)) - (args "Args" proced-format-args left proced-string-lessp nil (args pid) (nil t nil)) + (args "Args" proced-format-args left proced-string-lessp nil + (args pid) (nil t nil)) ;; ;; attributes defined by proced (see `proced-process-attributes') (pid "PID" proced-format-pid right proced-< nil (pid) @@ -373,23 +390,23 @@ May be used to revert the process listing." :version "29.1") (defcustom proced-low-memory-usage-threshold 0.1 - "The upper bound for low memory usage, relative to total memory. + "The upper bound for low relative memory usage display in Proced. -When `proced-enable-color-flag' is non-nil, RSS values denoting a proportion -of memory lower than this value will be displayed using the -`proced-memory-low-usage' face." +When `proced-enable-color-flag' is non-nil, RSS values denoting a +proportion of memory, relative to total memory, that is lower +than this value will be displayed using the `proced-memory-low-usage' face." :type 'float :version "29.1") (defcustom proced-medium-memory-usage-threshold 0.5 - "The upper bound for medium memory usage, relative to total memory. - -When `proced-enable-color-flag' is non-nil, RSS values denoting a proportion -of memory less than this value, but greater than -`proced-low-memory-usage-threshold', will be displayed using the -`proced-memory-medium-usage' face. RSS values denoting a greater proportion -than this value will be displayed using the `proced-memory-high-usage' -face." + "The upper bound for medium relative memory usage display in Proced. + +When `proced-enable-color-flag' is non-nil, RSS values denoting a +proportion of memory, relative to total memory, that is less than +this value, but greater than `proced-low-memory-usage-threshold', +will be displayed using the `proced-memory-medium-usage' face. +RSS values denoting a greater proportion than this value will be +displayed using the `proced-memory-high-usage' face." :type 'float :version "29.1") @@ -431,19 +448,19 @@ It is a list of lists (KEY PREDICATE REVERSE).") (defface proced-run-status-code '((t (:foreground "green"))) - "Face used in Proced buffers for the running or runnable status code character \"R\"." + "Face used in Proced buffers for running or runnable status code character \"R\"." :version "29.1") (defface proced-interruptible-sleep-status-code '((((class color) (min-colors 88)) (:foreground "DimGrey")) (t (:italic t))) - "Face used in Proced buffers for the interruptible sleep status code character \"S\"." + "Face used in Proced buffers for interruptible sleep status code character \"S\"." :version "29.1") (defface proced-uninterruptible-sleep-status-code '((((class color)) (:foreground "red")) (t (:bold t))) - "Face used in Proced buffers for the uninterruptible sleep status code character \"D\"." + "Face used in Proced buffers for uninterruptible sleep status code character \"D\"." :version "29.1") (defface proced-executable @@ -451,7 +468,9 @@ It is a list of lists (KEY PREDICATE REVERSE).") (((class color) (background dark)) (:foreground "cyan")) (((class color) (background light)) (:foreground "blue")) (t (:bold t))) - "Face used in Proced buffers for executables (first word in the args process attribute)." + "Face used in Proced buffers for executable names. +The first word in the process arguments attribute is assumed to +be the executable that runs in the process." :version "29.1") (defface proced-memory-high-usage @@ -1529,9 +1548,9 @@ Prefix ARG controls sort order, see `proced-sort-interactive'." (propertize ":" 'font-lock-face 'proced-time-colon) ":"))) (cond ((< 0 days) - (format "%d-%02d%3$s%02d%3$s%02d" days hours colon minutes seconds)) + (format "%d-%02d%s%02d%s%02d" days hours colon minutes colon seconds)) ((< 0 hours) - (format "%02d%2$s%02d%2$s%02d" hours colon minutes seconds)) + (format "%02d%s%02d%s%02d" hours colon minutes colon seconds)) (t (format "%02d%s%02d" minutes colon seconds))))) -- 2.39.2