2020-10-11 22:21:48 +00:00
|
|
|
;;; proced.el --- operate on system processes like dired -*- lexical-binding:t -*-
|
2008-03-26 02:15:28 +00:00
|
|
|
|
2023-01-01 10:31:12 +00:00
|
|
|
;; Copyright (C) 2008-2023 Free Software Foundation, Inc.
|
2008-03-26 02:29:43 +00:00
|
|
|
|
2010-09-02 11:47:15 +00:00
|
|
|
;; Author: Roland Winkler <winkler@gnu.org>
|
2008-03-26 02:15:28 +00:00
|
|
|
;; Keywords: Processes, Unix
|
|
|
|
|
2008-03-26 02:29:43 +00:00
|
|
|
;; This file is part of GNU Emacs.
|
|
|
|
|
2008-05-06 08:06:51 +00:00
|
|
|
;; GNU Emacs is free software: you can redistribute it and/or modify
|
2008-03-26 02:29:43 +00:00
|
|
|
;; it under the terms of the GNU General Public License as published by
|
2008-05-06 08:06:51 +00:00
|
|
|
;; the Free Software Foundation, either version 3 of the License, or
|
|
|
|
;; (at your option) any later version.
|
2008-03-26 02:15:28 +00:00
|
|
|
|
2008-03-26 02:29:43 +00:00
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
;; GNU General Public License for more details.
|
2008-03-26 02:15:28 +00:00
|
|
|
|
|
|
|
;; You should have received a copy of the GNU General Public License
|
2017-09-13 22:52:52 +00:00
|
|
|
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
|
2008-03-26 02:15:28 +00:00
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
;; Proced makes an Emacs buffer containing a listing of the current
|
|
|
|
;; system processes. You can use the normal Emacs commands to move around
|
|
|
|
;; in this buffer, and special Proced commands to operate on the processes
|
2008-09-12 16:59:57 +00:00
|
|
|
;; listed. See `proced-mode' for getting started.
|
2008-03-26 02:15:28 +00:00
|
|
|
;;
|
2008-04-14 01:35:56 +00:00
|
|
|
;; To do:
|
2012-09-23 12:34:23 +00:00
|
|
|
;; - Interactive temporary customizability of flags in `proced-grammar-alist'
|
2008-09-12 16:59:57 +00:00
|
|
|
;;
|
2008-12-14 17:31:34 +00:00
|
|
|
;; Thoughts and Ideas
|
2009-02-23 05:06:36 +00:00
|
|
|
;; - Currently, `process-attributes' returns the list of
|
2008-12-14 17:31:34 +00:00
|
|
|
;; command-line arguments of a process as one concatenated string.
|
|
|
|
;; This format is compatible with `shell-command'. Also, under
|
|
|
|
;; MS-Windows, the command-line arguments are actually stored as a
|
|
|
|
;; single string, so that it is impossible to reverse-engineer it back
|
2009-02-23 05:06:36 +00:00
|
|
|
;; into separate arguments. Alternatively, `process-attributes'
|
2008-12-14 17:31:34 +00:00
|
|
|
;; could (try to) return a list of strings that correspond to individual
|
|
|
|
;; command-line arguments. Then one could feed such a list of
|
|
|
|
;; command-line arguments into `call-process' or `start-process'.
|
|
|
|
;; Are there real-world applications when such a feature would be useful?
|
|
|
|
;; What about something like `proced-restart-pid'?
|
2008-03-26 02:15:28 +00:00
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
|
|
|
|
(defgroup proced nil
|
|
|
|
"Proced mode."
|
|
|
|
:group 'processes
|
|
|
|
:group 'unix
|
|
|
|
:prefix "proced-")
|
|
|
|
|
2022-04-05 15:08:03 +00:00
|
|
|
(defcustom proced-show-remote-processes nil
|
|
|
|
"Whether processes of the remote host shall be shown.
|
|
|
|
This happens only when `default-directory' is remote."
|
|
|
|
:version "29.1"
|
|
|
|
:type 'boolean)
|
|
|
|
|
2020-10-11 22:21:48 +00:00
|
|
|
(defcustom proced-signal-function #'signal-process
|
2008-04-14 01:35:56 +00:00
|
|
|
"Name of signal function.
|
|
|
|
It can be an elisp function (usually `signal-process') or a string specifying
|
|
|
|
the external command (usually \"kill\")."
|
|
|
|
:type '(choice (function :tag "function")
|
|
|
|
(string :tag "command")))
|
2022-03-30 11:16:54 +00:00
|
|
|
(make-obsolete-variable 'proced-signal-function "no longer used." "29.1")
|
|
|
|
|
2012-09-23 12:34:23 +00:00
|
|
|
(defcustom proced-renice-command "renice"
|
|
|
|
"Name of renice command."
|
2012-10-06 20:30:26 +00:00
|
|
|
:version "24.3"
|
2012-09-23 12:34:23 +00:00
|
|
|
:type '(string :tag "command"))
|
|
|
|
|
2008-03-26 02:15:28 +00:00
|
|
|
(defcustom proced-signal-list
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
'( ;; signals supported on all POSIX compliant systems
|
2009-08-30 03:46:18 +00:00
|
|
|
("HUP" . " (1. Hangup)")
|
|
|
|
("INT" . " (2. Terminal interrupt)")
|
|
|
|
("QUIT" . " (3. Terminal quit)")
|
|
|
|
("ABRT" . " (6. Process abort)")
|
|
|
|
("KILL" . " (9. Kill - cannot be caught or ignored)")
|
|
|
|
("ALRM" . " (14. Alarm Clock)")
|
|
|
|
("TERM" . " (15. Termination)")
|
2019-12-22 22:51:49 +00:00
|
|
|
;; signals supported on systems conforming to POSIX 1003.1-2001
|
|
|
|
;; according to (info "(coreutils) Signal specifications")
|
|
|
|
("BUS" . " (Access to an undefined portion of a memory object)")
|
|
|
|
("CHLD" . " (Child process terminated, stopped, or continued)")
|
|
|
|
("CONT" . " (Continue executing, if stopped)")
|
|
|
|
("FPE" . " (Erroneous arithmetic operation)")
|
|
|
|
("ILL" . " (Illegal Instruction)")
|
|
|
|
("PIPE" . " (Write on a pipe with no one to read it)")
|
|
|
|
("SEGV" . " (Invalid memory reference)")
|
2009-08-30 03:46:18 +00:00
|
|
|
("STOP" . " (Stop executing / pause - cannot be caught or ignored)")
|
2019-12-22 22:51:49 +00:00
|
|
|
("TSTP" . " (Terminal stop / pause)")
|
|
|
|
("TTIN" . " (Background process attempting read)")
|
|
|
|
("TTOU" . " (Background process attempting write)")
|
|
|
|
("URG" . " (High bandwidth data is available at a socket)")
|
|
|
|
("USR1" . " (User-defined signal 1)")
|
|
|
|
("USR2" . " (User-defined signal 2)"))
|
2008-03-26 02:15:28 +00:00
|
|
|
"List of signals, used for minibuffer completion."
|
2009-08-30 03:46:18 +00:00
|
|
|
:type '(repeat (cons (string :tag "signal name")
|
|
|
|
(string :tag "description"))))
|
2008-03-26 02:15:28 +00:00
|
|
|
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
;; For which attributes can we use a fixed width of the output field?
|
|
|
|
;; A fixed width speeds up formatting, yet it can make
|
|
|
|
;; `proced-grammar-alist' system-dependent.
|
|
|
|
;; (If proced runs like top(1) we want it to be fast.)
|
|
|
|
;;
|
|
|
|
;; If it is impossible / unlikely that an attribute has the same value
|
|
|
|
;; for two processes, then sorting can be based on one ordinary (fast)
|
|
|
|
;; predicate like `<'. Otherwise, a list of proced predicates can be used
|
|
|
|
;; to refine the sort.
|
|
|
|
;;
|
|
|
|
;; It would be neat if one could temporarily override the following
|
|
|
|
;; predefined rules.
|
2008-09-20 03:03:07 +00:00
|
|
|
(defcustom proced-grammar-alist
|
2009-02-23 05:06:36 +00:00
|
|
|
'( ;; attributes defined in `process-attributes'
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
(euid "EUID" "%d" right proced-< nil (euid pid) (nil t nil))
|
2022-12-01 18:15:52 +00:00
|
|
|
(user "User" proced-format-user left proced-string-lessp nil
|
|
|
|
(user pid) (nil t nil))
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
(egid "EGID" "%d" right proced-< nil (egid euid pid) (nil t nil))
|
2022-12-01 18:15:52 +00:00
|
|
|
(group "Group" nil left proced-string-lessp nil (group user pid)
|
|
|
|
(nil t nil))
|
2009-08-30 03:46:18 +00:00
|
|
|
(comm "Command" nil left proced-string-lessp nil (comm pid) (nil t nil))
|
2022-12-01 18:15:52 +00:00
|
|
|
(state "Stat" proced-format-state left proced-string-lessp nil
|
|
|
|
(state pid) (nil t nil))
|
Add colors to Proced (bug#59407)
Add a new custom variable proced-enable-color-flag which when set to a
non-nil value (defaults to nil), will prompt some format functions to
furnish their respective process attributes with colors and effects in
order to make them easier to distinguish and highlight possible issues
(e.g. high memory usage), in a manner similar to htop.
In particular, the current Emacs process id is highlighted purple in
both the process id and parent process id columns, session leaders
have their process ids underlined, larger memory sizes for rss
are highlighted in darker shades of orange, and the first word in the
args property (the executable) is highlighted in blue.
* lisp/proced.el (proced-grammar-alist): Update to use the new format
functions.
(proced-low-memory-usage-threshold): New custom variable to determine
whether a value represents 'low' memory usage, used only in
proced-format-memory for coloring.
(proced-medium-memory-usage-threshold): New custom variable to
determine whether a value represents 'medium' memory usage, used only
in proced-format-memory for coloring.
(proced-enable-color-flag): New custom variable to toggle coloring.
(proced-run-status-code, proced-interruptible-sleep-status-code)
(proced-uninterruptible-sleep-status-code, proced-executable)
(proced-executable, proced-memory-gb, proced-memory-mb)
(proced-memory-default, proced-pid, proced-ppid, proced-pgrp)
(proced-sess, proced-cpu, proced-mem, proced-user, proced-time-colon):
New faces.
(proced-format-time): Edit function to color colons using
proced-time-colon.
(proced-format-args): Edit function to color executables using
proced-executable.
(proced-format-state): New function to color states.
(proced-format-pid): New function to color process ids.
(proced-format-ppid): New function to color parent process ids.
(proced-format-pgrp): New function to color process group ids.
(proced-format-sess): New function to color process session leader
ids.
(proced-format-cpu): New function to color cpu utilization.
(proced-format-mem): New function to color memory utilization.
(proced-format-user): New function to color the user a process
belongs to.
2022-11-16 14:32:44 +00:00
|
|
|
(ppid "PPID" proced-format-ppid right proced-< nil (ppid pid)
|
2022-12-01 18:15:52 +00:00
|
|
|
((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))
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
(tpgid "TPGID" "%d" right proced-< nil (tpgid pid) (nil t nil))
|
2009-08-30 03:46:18 +00:00
|
|
|
(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))
|
2022-12-01 18:15:52 +00:00
|
|
|
(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))
|
2009-08-30 03:46:18 +00:00
|
|
|
(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))
|
2022-12-01 18:15:52 +00:00
|
|
|
(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))
|
Add colors to Proced (bug#59407)
Add a new custom variable proced-enable-color-flag which when set to a
non-nil value (defaults to nil), will prompt some format functions to
furnish their respective process attributes with colors and effects in
order to make them easier to distinguish and highlight possible issues
(e.g. high memory usage), in a manner similar to htop.
In particular, the current Emacs process id is highlighted purple in
both the process id and parent process id columns, session leaders
have their process ids underlined, larger memory sizes for rss
are highlighted in darker shades of orange, and the first word in the
args property (the executable) is highlighted in blue.
* lisp/proced.el (proced-grammar-alist): Update to use the new format
functions.
(proced-low-memory-usage-threshold): New custom variable to determine
whether a value represents 'low' memory usage, used only in
proced-format-memory for coloring.
(proced-medium-memory-usage-threshold): New custom variable to
determine whether a value represents 'medium' memory usage, used only
in proced-format-memory for coloring.
(proced-enable-color-flag): New custom variable to toggle coloring.
(proced-run-status-code, proced-interruptible-sleep-status-code)
(proced-uninterruptible-sleep-status-code, proced-executable)
(proced-executable, proced-memory-gb, proced-memory-mb)
(proced-memory-default, proced-pid, proced-ppid, proced-pgrp)
(proced-sess, proced-cpu, proced-mem, proced-user, proced-time-colon):
New faces.
(proced-format-time): Edit function to color colons using
proced-time-colon.
(proced-format-args): Edit function to color executables using
proced-executable.
(proced-format-state): New function to color states.
(proced-format-pid): New function to color process ids.
(proced-format-ppid): New function to color parent process ids.
(proced-format-pgrp): New function to color process group ids.
(proced-format-sess): New function to color process session leader
ids.
(proced-format-cpu): New function to color cpu utilization.
(proced-format-mem): New function to color memory utilization.
(proced-format-user): New function to color the user a process
belongs to.
2022-11-16 14:32:44 +00:00
|
|
|
(rss "RSS" proced-format-rss right proced-< t (rss pid) (nil t t))
|
2022-12-01 18:15:52 +00:00
|
|
|
(etime "ETime" proced-format-time right proced-time-lessp t (etime pid)
|
|
|
|
(nil t t))
|
Add colors to Proced (bug#59407)
Add a new custom variable proced-enable-color-flag which when set to a
non-nil value (defaults to nil), will prompt some format functions to
furnish their respective process attributes with colors and effects in
order to make them easier to distinguish and highlight possible issues
(e.g. high memory usage), in a manner similar to htop.
In particular, the current Emacs process id is highlighted purple in
both the process id and parent process id columns, session leaders
have their process ids underlined, larger memory sizes for rss
are highlighted in darker shades of orange, and the first word in the
args property (the executable) is highlighted in blue.
* lisp/proced.el (proced-grammar-alist): Update to use the new format
functions.
(proced-low-memory-usage-threshold): New custom variable to determine
whether a value represents 'low' memory usage, used only in
proced-format-memory for coloring.
(proced-medium-memory-usage-threshold): New custom variable to
determine whether a value represents 'medium' memory usage, used only
in proced-format-memory for coloring.
(proced-enable-color-flag): New custom variable to toggle coloring.
(proced-run-status-code, proced-interruptible-sleep-status-code)
(proced-uninterruptible-sleep-status-code, proced-executable)
(proced-executable, proced-memory-gb, proced-memory-mb)
(proced-memory-default, proced-pid, proced-ppid, proced-pgrp)
(proced-sess, proced-cpu, proced-mem, proced-user, proced-time-colon):
New faces.
(proced-format-time): Edit function to color colons using
proced-time-colon.
(proced-format-args): Edit function to color executables using
proced-executable.
(proced-format-state): New function to color states.
(proced-format-pid): New function to color process ids.
(proced-format-ppid): New function to color parent process ids.
(proced-format-pgrp): New function to color process group ids.
(proced-format-sess): New function to color process session leader
ids.
(proced-format-cpu): New function to color cpu utilization.
(proced-format-mem): New function to color memory utilization.
(proced-format-user): New function to color the user a process
belongs to.
2022-11-16 14:32:44 +00:00
|
|
|
(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))
|
2022-12-01 18:15:52 +00:00
|
|
|
(args "Args" proced-format-args left proced-string-lessp nil
|
|
|
|
(args pid) (nil t nil))
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
;;
|
|
|
|
;; attributes defined by proced (see `proced-process-attributes')
|
Add colors to Proced (bug#59407)
Add a new custom variable proced-enable-color-flag which when set to a
non-nil value (defaults to nil), will prompt some format functions to
furnish their respective process attributes with colors and effects in
order to make them easier to distinguish and highlight possible issues
(e.g. high memory usage), in a manner similar to htop.
In particular, the current Emacs process id is highlighted purple in
both the process id and parent process id columns, session leaders
have their process ids underlined, larger memory sizes for rss
are highlighted in darker shades of orange, and the first word in the
args property (the executable) is highlighted in blue.
* lisp/proced.el (proced-grammar-alist): Update to use the new format
functions.
(proced-low-memory-usage-threshold): New custom variable to determine
whether a value represents 'low' memory usage, used only in
proced-format-memory for coloring.
(proced-medium-memory-usage-threshold): New custom variable to
determine whether a value represents 'medium' memory usage, used only
in proced-format-memory for coloring.
(proced-enable-color-flag): New custom variable to toggle coloring.
(proced-run-status-code, proced-interruptible-sleep-status-code)
(proced-uninterruptible-sleep-status-code, proced-executable)
(proced-executable, proced-memory-gb, proced-memory-mb)
(proced-memory-default, proced-pid, proced-ppid, proced-pgrp)
(proced-sess, proced-cpu, proced-mem, proced-user, proced-time-colon):
New faces.
(proced-format-time): Edit function to color colons using
proced-time-colon.
(proced-format-args): Edit function to color executables using
proced-executable.
(proced-format-state): New function to color states.
(proced-format-pid): New function to color process ids.
(proced-format-ppid): New function to color parent process ids.
(proced-format-pgrp): New function to color process group ids.
(proced-format-sess): New function to color process session leader
ids.
(proced-format-cpu): New function to color cpu utilization.
(proced-format-mem): New function to color memory utilization.
(proced-format-user): New function to color the user a process
belongs to.
2022-11-16 14:32:44 +00:00
|
|
|
(pid "PID" proced-format-pid right proced-< nil (pid)
|
2009-01-03 12:19:56 +00:00
|
|
|
((lambda (ppid) (proced-filter-children proced-process-alist ppid))
|
2008-12-14 17:41:29 +00:00
|
|
|
"refine to process children"))
|
2008-12-28 13:58:10 +00:00
|
|
|
;; process tree
|
2009-08-30 03:46:18 +00:00
|
|
|
(tree "Tree" proced-format-tree left nil nil nil nil))
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
"Alist of rules for handling Proced attributes.
|
|
|
|
|
|
|
|
Each element has the form
|
|
|
|
|
2008-12-14 17:41:29 +00:00
|
|
|
(KEY NAME FORMAT JUSTIFY PREDICATE REVERSE SORT-SCHEME REFINER).
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
|
2008-09-20 03:03:07 +00:00
|
|
|
Symbol KEY is the car of a process attribute.
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
|
2008-09-20 03:03:07 +00:00
|
|
|
String NAME appears in the header line.
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
|
2008-12-19 21:53:25 +00:00
|
|
|
FORMAT specifies the format for displaying the attribute values. It can
|
|
|
|
be a string passed to `format'. It can be a function called with one
|
|
|
|
argument, the value of the attribute. The value nil means take as is.
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
|
|
|
|
If JUSTIFY is an integer, its modulus gives the width of the attribute
|
2008-09-12 16:59:57 +00:00
|
|
|
values formatted with FORMAT. If JUSTIFY is positive, NAME appears
|
2015-11-17 23:28:50 +00:00
|
|
|
right-justified, otherwise it appears left-justified. If JUSTIFY is `left'
|
|
|
|
or `right', the field width is calculated from all field values in the listing.
|
|
|
|
If JUSTIFY is `left', the field values are formatted left-justified and
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
right-justified otherwise.
|
|
|
|
|
|
|
|
PREDICATE is the predicate for sorting and filtering the process listing
|
|
|
|
based on attribute KEY. PREDICATE takes two arguments P1 and P2,
|
|
|
|
the corresponding attribute values of two processes. PREDICATE should
|
2015-11-17 23:28:50 +00:00
|
|
|
return `equal' if P1 has same rank like P2. Any other non-nil value says
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
that P1 is \"less than\" P2, or nil if not.
|
2008-12-28 13:58:10 +00:00
|
|
|
If PREDICATE is nil the attribute cannot be sorted.
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
|
2008-12-14 17:41:29 +00:00
|
|
|
PREDICATE defines an ascending sort order. REVERSE is non-nil if the sort
|
|
|
|
order is descending.
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
|
2008-09-12 16:59:57 +00:00
|
|
|
SORT-SCHEME is a list (KEY1 KEY2 ...) defining a hierarchy of rules
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
for sorting the process listing. KEY1, KEY2, ... are KEYs appearing as cars
|
|
|
|
of `proced-grammar-alist'. First the PREDICATE of KEY1 is evaluated.
|
2008-09-12 16:59:57 +00:00
|
|
|
If it yields non-equal, it defines the sort order for the corresponding
|
2015-11-17 23:28:50 +00:00
|
|
|
processes. If it evaluates to `equal' the PREDICATE of KEY2 is evaluated, etc.
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
|
2008-12-14 17:41:29 +00:00
|
|
|
REFINER can be a list of flags (LESS-B EQUAL-B LARGER-B) used by the command
|
2008-09-12 16:59:57 +00:00
|
|
|
`proced-refine' (see there) to refine the listing based on attribute KEY.
|
|
|
|
This command compares the value of attribute KEY of every process with
|
|
|
|
the value of attribute KEY of the process at the position of point
|
|
|
|
using PREDICATE.
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
If PREDICATE yields non-nil, the process is accepted if LESS-B is non-nil.
|
2015-11-17 23:28:50 +00:00
|
|
|
If PREDICATE yields `equal', the process is accepted if EQUAL-B is non-nil.
|
2008-12-14 17:41:29 +00:00
|
|
|
If PREDICATE yields nil, the process is accepted if LARGER-B is non-nil.
|
|
|
|
|
2009-01-03 12:19:56 +00:00
|
|
|
REFINER can also be a list (FUNCTION HELP-ECHO).
|
2008-12-14 17:41:29 +00:00
|
|
|
FUNCTION is called with one argument, the PID of the process at the position
|
|
|
|
of point. The function must return a list of PIDs that is used for the refined
|
|
|
|
listing. HELP-ECHO is a string that is shown when mouse is over this field.
|
|
|
|
|
|
|
|
If REFINER is nil no refinement is done."
|
2008-09-20 03:03:07 +00:00
|
|
|
:type '(repeat (list :tag "Attribute"
|
|
|
|
(symbol :tag "Key")
|
|
|
|
(string :tag "Header")
|
|
|
|
(choice :tag "Format"
|
|
|
|
(const :tag "None" nil)
|
|
|
|
(string :tag "Format String")
|
|
|
|
(function :tag "Formatting Function"))
|
|
|
|
(choice :tag "Justification"
|
|
|
|
(const :tag "left" left)
|
|
|
|
(const :tag "right" right)
|
|
|
|
(integer :tag "width"))
|
2008-12-28 13:58:10 +00:00
|
|
|
(choice :tag "Predicate"
|
|
|
|
(const :tag "None" nil)
|
|
|
|
(function :tag "Function"))
|
2008-12-14 17:41:29 +00:00
|
|
|
(boolean :tag "Descending Sort Order")
|
2008-09-20 03:03:07 +00:00
|
|
|
(repeat :tag "Sort Scheme" (symbol :tag "Key"))
|
2008-12-14 17:41:29 +00:00
|
|
|
(choice :tag "Refiner"
|
2008-12-28 13:58:10 +00:00
|
|
|
(const :tag "None" nil)
|
2009-01-03 12:19:56 +00:00
|
|
|
(list (function :tag "Refinement Function")
|
|
|
|
(string :tag "Help echo"))
|
2008-12-14 17:41:29 +00:00
|
|
|
(list :tag "Refine Flags"
|
|
|
|
(boolean :tag "Less")
|
|
|
|
(boolean :tag "Equal")
|
2009-01-03 12:19:56 +00:00
|
|
|
(boolean :tag "Larger"))))))
|
2008-09-20 03:03:07 +00:00
|
|
|
|
|
|
|
(defcustom proced-custom-attributes nil
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
"List of functions defining custom attributes.
|
|
|
|
This variable extends the functionality of `proced-process-attributes'.
|
|
|
|
Each function is called with one argument, the list of attributes
|
|
|
|
of a system process. It returns a cons cell of the form (KEY . VALUE)
|
2009-02-23 05:06:36 +00:00
|
|
|
like `process-attributes'. This cons cell is appended to the list
|
2008-09-20 03:03:07 +00:00
|
|
|
returned by `proced-process-attributes'.
|
|
|
|
If the function returns nil, the value is ignored."
|
|
|
|
:type '(repeat (function :tag "Attribute")))
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
|
|
|
|
;; Formatting and sorting rules are defined "per attribute". If formatting
|
|
|
|
;; and / or sorting should use more than one attribute, it appears more
|
|
|
|
;; transparent to define a new derived attribute, so that formatting and
|
|
|
|
;; sorting can use them consistently. (Are there exceptions to this rule?
|
|
|
|
;; Would it be advantageous to have yet more general methods available?)
|
|
|
|
;; Sorting can also be based on attributes that are invisible in the listing.
|
|
|
|
|
2008-09-20 03:03:07 +00:00
|
|
|
(defcustom proced-format-alist
|
2008-12-28 13:58:10 +00:00
|
|
|
'((short user pid tree pcpu pmem start time (args comm))
|
|
|
|
(medium user pid tree pcpu pmem vsize rss ttname state start time (args comm))
|
|
|
|
(long user euid group pid tree pri nice pcpu pmem vsize rss ttname state
|
2008-12-14 17:41:29 +00:00
|
|
|
start time (args comm))
|
2008-12-28 13:58:10 +00:00
|
|
|
(verbose user euid group egid pid ppid tree pgrp sess pri nice pcpu pmem
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
state thcount vsize rss ttname tpgid minflt majflt cminflt cmajflt
|
2008-12-14 17:41:29 +00:00
|
|
|
start time utime stime ctime cutime cstime etime (args comm)))
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
"Alist of formats of listing.
|
|
|
|
The car of each element is a symbol, the name of the format.
|
2008-12-14 17:41:29 +00:00
|
|
|
The cdr is a list of attribute keys appearing in `proced-grammar-alist'.
|
|
|
|
An element of this list may also be a list of attribute keys that specifies
|
|
|
|
alternatives. If the first attribute is absent for a process, use the second
|
|
|
|
one, etc."
|
2008-09-20 03:03:07 +00:00
|
|
|
:type '(alist :key-type (symbol :tag "Format Name")
|
2008-12-14 17:41:29 +00:00
|
|
|
:value-type (repeat :tag "Keys"
|
|
|
|
(choice (symbol :tag "")
|
|
|
|
(repeat :tag "Alternative Keys"
|
|
|
|
(symbol :tag ""))))))
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
|
2008-09-20 03:03:07 +00:00
|
|
|
(defcustom proced-format 'short
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
"Current format of Proced listing.
|
|
|
|
It can be the car of an element of `proced-format-alist'.
|
2008-09-20 03:03:07 +00:00
|
|
|
It can also be a list of keys appearing in `proced-grammar-alist'."
|
|
|
|
:type '(choice (symbol :tag "Format Name")
|
|
|
|
(repeat :tag "Keys" (symbol :tag ""))))
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
(make-variable-buffer-local 'proced-format)
|
|
|
|
|
|
|
|
;; FIXME: is there a better name for filter `user' that does not coincide
|
|
|
|
;; with an attribute key?
|
2008-09-20 03:03:07 +00:00
|
|
|
(defcustom proced-filter-alist
|
2022-04-05 15:08:03 +00:00
|
|
|
`((user (user . proced-user-name))
|
|
|
|
(user-running (user . proced-user-name)
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
(state . "\\`[Rr]\\'"))
|
|
|
|
(all)
|
|
|
|
(all-running (state . "\\`[Rr]\\'"))
|
|
|
|
(emacs (fun-all . (lambda (list)
|
|
|
|
(proced-filter-children list ,(emacs-pid))))))
|
|
|
|
"Alist of process filters.
|
|
|
|
The car of each element is a symbol, the name of the filter.
|
|
|
|
The cdr is a list of elementary filters that are applied to every process.
|
|
|
|
A process is displayed if it passes all elementary filters of a selected
|
|
|
|
filter.
|
|
|
|
|
|
|
|
An elementary filter can be one of the following:
|
|
|
|
\(KEY . REGEXP) If value of attribute KEY matches REGEXP,
|
|
|
|
accept this process.
|
|
|
|
\(KEY . FUN) Apply function FUN to attribute KEY. Accept this process,
|
|
|
|
if FUN returns non-nil.
|
|
|
|
\(function . FUN) For each process, apply function FUN to list of attributes
|
|
|
|
of each. Accept the process if FUN returns non-nil.
|
|
|
|
\(fun-all . FUN) Apply function FUN to entire process list.
|
2008-09-20 03:03:07 +00:00
|
|
|
FUN must return the filtered list."
|
|
|
|
:type '(repeat (cons :tag "Filter"
|
|
|
|
(symbol :tag "Filter Name")
|
|
|
|
(repeat :tag "Filters"
|
|
|
|
(choice (cons :tag "Key . Regexp" (symbol :tag "Key") regexp)
|
|
|
|
(cons :tag "Key . Function" (symbol :tag "Key") function)
|
|
|
|
(cons :tag "Function" (const :tag "Key: function" function) function)
|
|
|
|
(cons :tag "Fun-all" (const :tag "Key: fun-all" fun-all) function))))))
|
|
|
|
|
|
|
|
(defcustom proced-filter 'user
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
"Current filter of proced listing.
|
|
|
|
It can be the car of an element of `proced-filter-alist'.
|
|
|
|
It can also be a list of elementary filters as in the cdrs of the elements
|
2008-09-20 03:03:07 +00:00
|
|
|
of `proced-filter-alist'."
|
|
|
|
:type '(choice (symbol :tag "Filter Name")
|
|
|
|
(repeat :tag "Filters"
|
|
|
|
(choice (cons :tag "Key . Regexp" (symbol :tag "Key") regexp)
|
|
|
|
(cons :tag "Key . Function" (symbol :tag "Key") function)
|
|
|
|
(cons :tag "Function" (const :tag "Key: function" function) function)
|
|
|
|
(cons :tag "Fun-all" (const :tag "Key: fun-all" fun-all) function)))))
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
(make-variable-buffer-local 'proced-filter)
|
|
|
|
|
2008-09-20 03:03:07 +00:00
|
|
|
(defcustom proced-sort 'pcpu
|
2008-09-12 16:59:57 +00:00
|
|
|
"Current sort scheme for proced listing.
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
It must be the KEY of an element of `proced-grammar-alist'.
|
|
|
|
It can also be a list of KEYs as in the SORT-SCHEMEs of the elements
|
2008-09-20 03:03:07 +00:00
|
|
|
of `proced-grammar-alist'."
|
|
|
|
:type '(choice (symbol :tag "Sort Scheme")
|
|
|
|
(repeat :tag "Key List" (symbol :tag "Key"))))
|
2009-04-20 20:42:45 +00:00
|
|
|
(make-variable-buffer-local 'proced-sort)
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
|
2008-12-14 17:41:29 +00:00
|
|
|
(defcustom proced-descend t
|
|
|
|
"Non-nil if proced listing is sorted in descending order."
|
|
|
|
:type '(boolean :tag "Descending Sort Order"))
|
|
|
|
(make-variable-buffer-local 'proced-descend)
|
|
|
|
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
(defcustom proced-goal-attribute 'args
|
|
|
|
"If non-nil, key of the attribute that defines the `goal-column'."
|
|
|
|
:type '(choice (const :tag "none" nil)
|
|
|
|
(symbol :tag "key")))
|
|
|
|
|
2008-12-14 17:31:34 +00:00
|
|
|
(defcustom proced-auto-update-interval 5
|
2008-09-20 03:03:07 +00:00
|
|
|
"Time interval in seconds for auto updating Proced buffers."
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
:type 'integer)
|
|
|
|
|
2008-12-14 17:31:34 +00:00
|
|
|
(defcustom proced-auto-update-flag nil
|
2008-09-12 16:59:57 +00:00
|
|
|
"Non-nil for auto update of a Proced buffer.
|
2008-12-14 17:31:34 +00:00
|
|
|
Can be changed interactively via `proced-toggle-auto-update'."
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
:type 'boolean)
|
2008-12-14 17:31:34 +00:00
|
|
|
(make-variable-buffer-local 'proced-auto-update-flag)
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
|
2008-12-28 13:58:10 +00:00
|
|
|
(defcustom proced-tree-flag nil
|
2008-12-30 01:52:14 +00:00
|
|
|
"Non-nil for display of Proced buffer as process tree."
|
2008-12-28 13:58:10 +00:00
|
|
|
:type 'boolean)
|
|
|
|
(make-variable-buffer-local 'proced-tree-flag)
|
|
|
|
|
2009-01-03 12:19:56 +00:00
|
|
|
(defcustom proced-post-display-hook nil
|
|
|
|
"Normal hook run after displaying or updating a Proced buffer.
|
|
|
|
May be used to adapt the window size via `fit-window-to-buffer'."
|
|
|
|
:type 'hook
|
2020-10-11 22:21:48 +00:00
|
|
|
:options '(fit-window-to-buffer))
|
2009-01-03 12:19:56 +00:00
|
|
|
|
2009-02-07 17:07:56 +00:00
|
|
|
(defcustom proced-after-send-signal-hook nil
|
|
|
|
"Normal hook run after sending a signal to processes by `proced-send-signal'.
|
|
|
|
May be used to revert the process listing."
|
|
|
|
:type 'hook
|
2020-10-11 22:21:48 +00:00
|
|
|
:options '(proced-revert))
|
2009-02-07 17:07:56 +00:00
|
|
|
|
Add colors to Proced (bug#59407)
Add a new custom variable proced-enable-color-flag which when set to a
non-nil value (defaults to nil), will prompt some format functions to
furnish their respective process attributes with colors and effects in
order to make them easier to distinguish and highlight possible issues
(e.g. high memory usage), in a manner similar to htop.
In particular, the current Emacs process id is highlighted purple in
both the process id and parent process id columns, session leaders
have their process ids underlined, larger memory sizes for rss
are highlighted in darker shades of orange, and the first word in the
args property (the executable) is highlighted in blue.
* lisp/proced.el (proced-grammar-alist): Update to use the new format
functions.
(proced-low-memory-usage-threshold): New custom variable to determine
whether a value represents 'low' memory usage, used only in
proced-format-memory for coloring.
(proced-medium-memory-usage-threshold): New custom variable to
determine whether a value represents 'medium' memory usage, used only
in proced-format-memory for coloring.
(proced-enable-color-flag): New custom variable to toggle coloring.
(proced-run-status-code, proced-interruptible-sleep-status-code)
(proced-uninterruptible-sleep-status-code, proced-executable)
(proced-executable, proced-memory-gb, proced-memory-mb)
(proced-memory-default, proced-pid, proced-ppid, proced-pgrp)
(proced-sess, proced-cpu, proced-mem, proced-user, proced-time-colon):
New faces.
(proced-format-time): Edit function to color colons using
proced-time-colon.
(proced-format-args): Edit function to color executables using
proced-executable.
(proced-format-state): New function to color states.
(proced-format-pid): New function to color process ids.
(proced-format-ppid): New function to color parent process ids.
(proced-format-pgrp): New function to color process group ids.
(proced-format-sess): New function to color process session leader
ids.
(proced-format-cpu): New function to color cpu utilization.
(proced-format-mem): New function to color memory utilization.
(proced-format-user): New function to color the user a process
belongs to.
2022-11-16 14:32:44 +00:00
|
|
|
(defcustom proced-enable-color-flag nil
|
|
|
|
"Non-nil means Proced should display some process attributes with color."
|
|
|
|
:type 'boolean
|
|
|
|
:version "29.1")
|
|
|
|
|
|
|
|
(defcustom proced-low-memory-usage-threshold 0.1
|
2022-12-01 18:15:52 +00:00
|
|
|
"The upper bound for low relative memory usage display in Proced.
|
Add colors to Proced (bug#59407)
Add a new custom variable proced-enable-color-flag which when set to a
non-nil value (defaults to nil), will prompt some format functions to
furnish their respective process attributes with colors and effects in
order to make them easier to distinguish and highlight possible issues
(e.g. high memory usage), in a manner similar to htop.
In particular, the current Emacs process id is highlighted purple in
both the process id and parent process id columns, session leaders
have their process ids underlined, larger memory sizes for rss
are highlighted in darker shades of orange, and the first word in the
args property (the executable) is highlighted in blue.
* lisp/proced.el (proced-grammar-alist): Update to use the new format
functions.
(proced-low-memory-usage-threshold): New custom variable to determine
whether a value represents 'low' memory usage, used only in
proced-format-memory for coloring.
(proced-medium-memory-usage-threshold): New custom variable to
determine whether a value represents 'medium' memory usage, used only
in proced-format-memory for coloring.
(proced-enable-color-flag): New custom variable to toggle coloring.
(proced-run-status-code, proced-interruptible-sleep-status-code)
(proced-uninterruptible-sleep-status-code, proced-executable)
(proced-executable, proced-memory-gb, proced-memory-mb)
(proced-memory-default, proced-pid, proced-ppid, proced-pgrp)
(proced-sess, proced-cpu, proced-mem, proced-user, proced-time-colon):
New faces.
(proced-format-time): Edit function to color colons using
proced-time-colon.
(proced-format-args): Edit function to color executables using
proced-executable.
(proced-format-state): New function to color states.
(proced-format-pid): New function to color process ids.
(proced-format-ppid): New function to color parent process ids.
(proced-format-pgrp): New function to color process group ids.
(proced-format-sess): New function to color process session leader
ids.
(proced-format-cpu): New function to color cpu utilization.
(proced-format-mem): New function to color memory utilization.
(proced-format-user): New function to color the user a process
belongs to.
2022-11-16 14:32:44 +00:00
|
|
|
|
2022-12-01 18:15:52 +00:00
|
|
|
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."
|
Add colors to Proced (bug#59407)
Add a new custom variable proced-enable-color-flag which when set to a
non-nil value (defaults to nil), will prompt some format functions to
furnish their respective process attributes with colors and effects in
order to make them easier to distinguish and highlight possible issues
(e.g. high memory usage), in a manner similar to htop.
In particular, the current Emacs process id is highlighted purple in
both the process id and parent process id columns, session leaders
have their process ids underlined, larger memory sizes for rss
are highlighted in darker shades of orange, and the first word in the
args property (the executable) is highlighted in blue.
* lisp/proced.el (proced-grammar-alist): Update to use the new format
functions.
(proced-low-memory-usage-threshold): New custom variable to determine
whether a value represents 'low' memory usage, used only in
proced-format-memory for coloring.
(proced-medium-memory-usage-threshold): New custom variable to
determine whether a value represents 'medium' memory usage, used only
in proced-format-memory for coloring.
(proced-enable-color-flag): New custom variable to toggle coloring.
(proced-run-status-code, proced-interruptible-sleep-status-code)
(proced-uninterruptible-sleep-status-code, proced-executable)
(proced-executable, proced-memory-gb, proced-memory-mb)
(proced-memory-default, proced-pid, proced-ppid, proced-pgrp)
(proced-sess, proced-cpu, proced-mem, proced-user, proced-time-colon):
New faces.
(proced-format-time): Edit function to color colons using
proced-time-colon.
(proced-format-args): Edit function to color executables using
proced-executable.
(proced-format-state): New function to color states.
(proced-format-pid): New function to color process ids.
(proced-format-ppid): New function to color parent process ids.
(proced-format-pgrp): New function to color process group ids.
(proced-format-sess): New function to color process session leader
ids.
(proced-format-cpu): New function to color cpu utilization.
(proced-format-mem): New function to color memory utilization.
(proced-format-user): New function to color the user a process
belongs to.
2022-11-16 14:32:44 +00:00
|
|
|
:type 'float
|
|
|
|
:version "29.1")
|
|
|
|
|
|
|
|
(defcustom proced-medium-memory-usage-threshold 0.5
|
2022-12-01 18:15:52 +00:00
|
|
|
"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."
|
Add colors to Proced (bug#59407)
Add a new custom variable proced-enable-color-flag which when set to a
non-nil value (defaults to nil), will prompt some format functions to
furnish their respective process attributes with colors and effects in
order to make them easier to distinguish and highlight possible issues
(e.g. high memory usage), in a manner similar to htop.
In particular, the current Emacs process id is highlighted purple in
both the process id and parent process id columns, session leaders
have their process ids underlined, larger memory sizes for rss
are highlighted in darker shades of orange, and the first word in the
args property (the executable) is highlighted in blue.
* lisp/proced.el (proced-grammar-alist): Update to use the new format
functions.
(proced-low-memory-usage-threshold): New custom variable to determine
whether a value represents 'low' memory usage, used only in
proced-format-memory for coloring.
(proced-medium-memory-usage-threshold): New custom variable to
determine whether a value represents 'medium' memory usage, used only
in proced-format-memory for coloring.
(proced-enable-color-flag): New custom variable to toggle coloring.
(proced-run-status-code, proced-interruptible-sleep-status-code)
(proced-uninterruptible-sleep-status-code, proced-executable)
(proced-executable, proced-memory-gb, proced-memory-mb)
(proced-memory-default, proced-pid, proced-ppid, proced-pgrp)
(proced-sess, proced-cpu, proced-mem, proced-user, proced-time-colon):
New faces.
(proced-format-time): Edit function to color colons using
proced-time-colon.
(proced-format-args): Edit function to color executables using
proced-executable.
(proced-format-state): New function to color states.
(proced-format-pid): New function to color process ids.
(proced-format-ppid): New function to color parent process ids.
(proced-format-pgrp): New function to color process group ids.
(proced-format-sess): New function to color process session leader
ids.
(proced-format-cpu): New function to color cpu utilization.
(proced-format-mem): New function to color memory utilization.
(proced-format-user): New function to color the user a process
belongs to.
2022-11-16 14:32:44 +00:00
|
|
|
:type 'float
|
|
|
|
:version "29.1")
|
|
|
|
|
2008-05-20 10:17:15 +00:00
|
|
|
;; Internal variables
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
|
2022-04-05 15:08:03 +00:00
|
|
|
(defvar proced-available t;(not (null (list-system-processes)))
|
2008-12-14 23:16:09 +00:00
|
|
|
"Non-nil means Proced is known to work on this system.")
|
|
|
|
|
2020-10-11 22:21:48 +00:00
|
|
|
(defvar-local proced-process-alist nil
|
2008-09-12 16:59:57 +00:00
|
|
|
"Alist of processes displayed by Proced.
|
|
|
|
The car of each element is the PID, and the cdr is a list of
|
|
|
|
cons pairs, see `proced-process-attributes'.")
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
|
|
|
|
(defvar proced-sort-internal nil
|
2008-12-14 17:41:29 +00:00
|
|
|
"Sort scheme for listing (internal format).
|
|
|
|
It is a list of lists (KEY PREDICATE REVERSE).")
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
|
2008-03-26 02:15:28 +00:00
|
|
|
(defvar proced-marker-char ?* ; the answer is 42
|
2008-12-19 21:53:25 +00:00
|
|
|
"In Proced, the current mark character.")
|
2008-03-26 02:15:28 +00:00
|
|
|
|
2008-09-14 16:44:44 +00:00
|
|
|
;; Faces and font-lock code taken from dired,
|
|
|
|
;; but face variables are deprecated for new code.
|
2008-03-26 02:15:28 +00:00
|
|
|
(defgroup proced-faces nil
|
|
|
|
"Faces used by Proced."
|
|
|
|
:group 'proced
|
|
|
|
:group 'faces)
|
|
|
|
|
|
|
|
(defface proced-mark
|
|
|
|
'((t (:inherit font-lock-constant-face)))
|
2020-10-11 22:21:48 +00:00
|
|
|
"Face used for Proced marks.")
|
2008-03-26 02:15:28 +00:00
|
|
|
|
|
|
|
(defface proced-marked
|
2011-08-24 18:09:18 +00:00
|
|
|
'((t (:inherit error)))
|
2020-10-11 22:21:48 +00:00
|
|
|
"Face used for marked processes.")
|
2008-03-26 02:15:28 +00:00
|
|
|
|
2008-09-12 16:59:57 +00:00
|
|
|
(defface proced-sort-header
|
|
|
|
'((t (:inherit font-lock-keyword-face)))
|
2020-10-11 22:21:48 +00:00
|
|
|
"Face used for header of attribute used for sorting.")
|
2008-09-12 16:59:57 +00:00
|
|
|
|
Add colors to Proced (bug#59407)
Add a new custom variable proced-enable-color-flag which when set to a
non-nil value (defaults to nil), will prompt some format functions to
furnish their respective process attributes with colors and effects in
order to make them easier to distinguish and highlight possible issues
(e.g. high memory usage), in a manner similar to htop.
In particular, the current Emacs process id is highlighted purple in
both the process id and parent process id columns, session leaders
have their process ids underlined, larger memory sizes for rss
are highlighted in darker shades of orange, and the first word in the
args property (the executable) is highlighted in blue.
* lisp/proced.el (proced-grammar-alist): Update to use the new format
functions.
(proced-low-memory-usage-threshold): New custom variable to determine
whether a value represents 'low' memory usage, used only in
proced-format-memory for coloring.
(proced-medium-memory-usage-threshold): New custom variable to
determine whether a value represents 'medium' memory usage, used only
in proced-format-memory for coloring.
(proced-enable-color-flag): New custom variable to toggle coloring.
(proced-run-status-code, proced-interruptible-sleep-status-code)
(proced-uninterruptible-sleep-status-code, proced-executable)
(proced-executable, proced-memory-gb, proced-memory-mb)
(proced-memory-default, proced-pid, proced-ppid, proced-pgrp)
(proced-sess, proced-cpu, proced-mem, proced-user, proced-time-colon):
New faces.
(proced-format-time): Edit function to color colons using
proced-time-colon.
(proced-format-args): Edit function to color executables using
proced-executable.
(proced-format-state): New function to color states.
(proced-format-pid): New function to color process ids.
(proced-format-ppid): New function to color parent process ids.
(proced-format-pgrp): New function to color process group ids.
(proced-format-sess): New function to color process session leader
ids.
(proced-format-cpu): New function to color cpu utilization.
(proced-format-mem): New function to color memory utilization.
(proced-format-user): New function to color the user a process
belongs to.
2022-11-16 14:32:44 +00:00
|
|
|
(defface proced-run-status-code
|
|
|
|
'((t (:foreground "green")))
|
2022-12-01 18:15:52 +00:00
|
|
|
"Face used in Proced buffers for running or runnable status code character \"R\"."
|
Add colors to Proced (bug#59407)
Add a new custom variable proced-enable-color-flag which when set to a
non-nil value (defaults to nil), will prompt some format functions to
furnish their respective process attributes with colors and effects in
order to make them easier to distinguish and highlight possible issues
(e.g. high memory usage), in a manner similar to htop.
In particular, the current Emacs process id is highlighted purple in
both the process id and parent process id columns, session leaders
have their process ids underlined, larger memory sizes for rss
are highlighted in darker shades of orange, and the first word in the
args property (the executable) is highlighted in blue.
* lisp/proced.el (proced-grammar-alist): Update to use the new format
functions.
(proced-low-memory-usage-threshold): New custom variable to determine
whether a value represents 'low' memory usage, used only in
proced-format-memory for coloring.
(proced-medium-memory-usage-threshold): New custom variable to
determine whether a value represents 'medium' memory usage, used only
in proced-format-memory for coloring.
(proced-enable-color-flag): New custom variable to toggle coloring.
(proced-run-status-code, proced-interruptible-sleep-status-code)
(proced-uninterruptible-sleep-status-code, proced-executable)
(proced-executable, proced-memory-gb, proced-memory-mb)
(proced-memory-default, proced-pid, proced-ppid, proced-pgrp)
(proced-sess, proced-cpu, proced-mem, proced-user, proced-time-colon):
New faces.
(proced-format-time): Edit function to color colons using
proced-time-colon.
(proced-format-args): Edit function to color executables using
proced-executable.
(proced-format-state): New function to color states.
(proced-format-pid): New function to color process ids.
(proced-format-ppid): New function to color parent process ids.
(proced-format-pgrp): New function to color process group ids.
(proced-format-sess): New function to color process session leader
ids.
(proced-format-cpu): New function to color cpu utilization.
(proced-format-mem): New function to color memory utilization.
(proced-format-user): New function to color the user a process
belongs to.
2022-11-16 14:32:44 +00:00
|
|
|
:version "29.1")
|
|
|
|
|
|
|
|
(defface proced-interruptible-sleep-status-code
|
|
|
|
'((((class color) (min-colors 88)) (:foreground "DimGrey"))
|
|
|
|
(t (:italic t)))
|
2022-12-01 18:15:52 +00:00
|
|
|
"Face used in Proced buffers for interruptible sleep status code character \"S\"."
|
Add colors to Proced (bug#59407)
Add a new custom variable proced-enable-color-flag which when set to a
non-nil value (defaults to nil), will prompt some format functions to
furnish their respective process attributes with colors and effects in
order to make them easier to distinguish and highlight possible issues
(e.g. high memory usage), in a manner similar to htop.
In particular, the current Emacs process id is highlighted purple in
both the process id and parent process id columns, session leaders
have their process ids underlined, larger memory sizes for rss
are highlighted in darker shades of orange, and the first word in the
args property (the executable) is highlighted in blue.
* lisp/proced.el (proced-grammar-alist): Update to use the new format
functions.
(proced-low-memory-usage-threshold): New custom variable to determine
whether a value represents 'low' memory usage, used only in
proced-format-memory for coloring.
(proced-medium-memory-usage-threshold): New custom variable to
determine whether a value represents 'medium' memory usage, used only
in proced-format-memory for coloring.
(proced-enable-color-flag): New custom variable to toggle coloring.
(proced-run-status-code, proced-interruptible-sleep-status-code)
(proced-uninterruptible-sleep-status-code, proced-executable)
(proced-executable, proced-memory-gb, proced-memory-mb)
(proced-memory-default, proced-pid, proced-ppid, proced-pgrp)
(proced-sess, proced-cpu, proced-mem, proced-user, proced-time-colon):
New faces.
(proced-format-time): Edit function to color colons using
proced-time-colon.
(proced-format-args): Edit function to color executables using
proced-executable.
(proced-format-state): New function to color states.
(proced-format-pid): New function to color process ids.
(proced-format-ppid): New function to color parent process ids.
(proced-format-pgrp): New function to color process group ids.
(proced-format-sess): New function to color process session leader
ids.
(proced-format-cpu): New function to color cpu utilization.
(proced-format-mem): New function to color memory utilization.
(proced-format-user): New function to color the user a process
belongs to.
2022-11-16 14:32:44 +00:00
|
|
|
:version "29.1")
|
|
|
|
|
|
|
|
(defface proced-uninterruptible-sleep-status-code
|
|
|
|
'((((class color)) (:foreground "red"))
|
|
|
|
(t (:bold t)))
|
2022-12-01 18:15:52 +00:00
|
|
|
"Face used in Proced buffers for uninterruptible sleep status code character \"D\"."
|
Add colors to Proced (bug#59407)
Add a new custom variable proced-enable-color-flag which when set to a
non-nil value (defaults to nil), will prompt some format functions to
furnish their respective process attributes with colors and effects in
order to make them easier to distinguish and highlight possible issues
(e.g. high memory usage), in a manner similar to htop.
In particular, the current Emacs process id is highlighted purple in
both the process id and parent process id columns, session leaders
have their process ids underlined, larger memory sizes for rss
are highlighted in darker shades of orange, and the first word in the
args property (the executable) is highlighted in blue.
* lisp/proced.el (proced-grammar-alist): Update to use the new format
functions.
(proced-low-memory-usage-threshold): New custom variable to determine
whether a value represents 'low' memory usage, used only in
proced-format-memory for coloring.
(proced-medium-memory-usage-threshold): New custom variable to
determine whether a value represents 'medium' memory usage, used only
in proced-format-memory for coloring.
(proced-enable-color-flag): New custom variable to toggle coloring.
(proced-run-status-code, proced-interruptible-sleep-status-code)
(proced-uninterruptible-sleep-status-code, proced-executable)
(proced-executable, proced-memory-gb, proced-memory-mb)
(proced-memory-default, proced-pid, proced-ppid, proced-pgrp)
(proced-sess, proced-cpu, proced-mem, proced-user, proced-time-colon):
New faces.
(proced-format-time): Edit function to color colons using
proced-time-colon.
(proced-format-args): Edit function to color executables using
proced-executable.
(proced-format-state): New function to color states.
(proced-format-pid): New function to color process ids.
(proced-format-ppid): New function to color parent process ids.
(proced-format-pgrp): New function to color process group ids.
(proced-format-sess): New function to color process session leader
ids.
(proced-format-cpu): New function to color cpu utilization.
(proced-format-mem): New function to color memory utilization.
(proced-format-user): New function to color the user a process
belongs to.
2022-11-16 14:32:44 +00:00
|
|
|
:version "29.1")
|
|
|
|
|
|
|
|
(defface proced-executable
|
|
|
|
'((((class color) (min-colors 88) (background dark)) (:foreground "DeepSkyBlue"))
|
|
|
|
(((class color) (background dark)) (:foreground "cyan"))
|
|
|
|
(((class color) (background light)) (:foreground "blue"))
|
|
|
|
(t (:bold t)))
|
2022-12-01 18:15:52 +00:00
|
|
|
"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."
|
Add colors to Proced (bug#59407)
Add a new custom variable proced-enable-color-flag which when set to a
non-nil value (defaults to nil), will prompt some format functions to
furnish their respective process attributes with colors and effects in
order to make them easier to distinguish and highlight possible issues
(e.g. high memory usage), in a manner similar to htop.
In particular, the current Emacs process id is highlighted purple in
both the process id and parent process id columns, session leaders
have their process ids underlined, larger memory sizes for rss
are highlighted in darker shades of orange, and the first word in the
args property (the executable) is highlighted in blue.
* lisp/proced.el (proced-grammar-alist): Update to use the new format
functions.
(proced-low-memory-usage-threshold): New custom variable to determine
whether a value represents 'low' memory usage, used only in
proced-format-memory for coloring.
(proced-medium-memory-usage-threshold): New custom variable to
determine whether a value represents 'medium' memory usage, used only
in proced-format-memory for coloring.
(proced-enable-color-flag): New custom variable to toggle coloring.
(proced-run-status-code, proced-interruptible-sleep-status-code)
(proced-uninterruptible-sleep-status-code, proced-executable)
(proced-executable, proced-memory-gb, proced-memory-mb)
(proced-memory-default, proced-pid, proced-ppid, proced-pgrp)
(proced-sess, proced-cpu, proced-mem, proced-user, proced-time-colon):
New faces.
(proced-format-time): Edit function to color colons using
proced-time-colon.
(proced-format-args): Edit function to color executables using
proced-executable.
(proced-format-state): New function to color states.
(proced-format-pid): New function to color process ids.
(proced-format-ppid): New function to color parent process ids.
(proced-format-pgrp): New function to color process group ids.
(proced-format-sess): New function to color process session leader
ids.
(proced-format-cpu): New function to color cpu utilization.
(proced-format-mem): New function to color memory utilization.
(proced-format-user): New function to color the user a process
belongs to.
2022-11-16 14:32:44 +00:00
|
|
|
:version "29.1")
|
|
|
|
|
|
|
|
(defface proced-memory-high-usage
|
|
|
|
'((((class color) (min-colors 88) (background dark)) (:foreground "orange"))
|
|
|
|
(((class color) (min-colors 88) (background light)) (:foreground "OrangeRed"))
|
|
|
|
(((class color)) (:foreground "red"))
|
|
|
|
(t (:underline t)))
|
|
|
|
"Face used in Proced buffers for high memory usage."
|
|
|
|
:version "29.1")
|
|
|
|
|
|
|
|
(defface proced-memory-medium-usage
|
|
|
|
'((((class color) (min-colors 88) (background dark)) (:foreground "yellow3"))
|
|
|
|
(((class color) (min-colors 88) (background light)) (:foreground "orange"))
|
|
|
|
(((class color)) (:foreground "yellow")))
|
|
|
|
"Face used in Proced buffers for medium memory usage."
|
|
|
|
:version "29.1")
|
|
|
|
|
|
|
|
(defface proced-memory-low-usage
|
|
|
|
'((((class color) (min-colors 88) (background dark)) (:foreground "#8bcd50"))
|
|
|
|
(((class color)) (:foreground "green")))
|
|
|
|
"Face used in Proced buffers for low memory usage."
|
|
|
|
:version "29.1")
|
|
|
|
|
|
|
|
(defface proced-emacs-pid
|
|
|
|
'((((class color) (min-colors 88)) (:foreground "purple"))
|
|
|
|
(((class color)) (:foreground "magenta")))
|
|
|
|
"Face used in Proced buffers for the process ID of the current Emacs process."
|
|
|
|
:version "29.1")
|
|
|
|
|
|
|
|
(defface proced-pid
|
|
|
|
'((((class color) (min-colors 88)) (:foreground "#5085ef"))
|
|
|
|
(((class color)) (:foreground "blue")))
|
|
|
|
"Face used in Proced buffers for process IDs."
|
|
|
|
:version "29.1")
|
|
|
|
|
|
|
|
(defface proced-session-leader-pid
|
|
|
|
'((((class color) (min-colors 88)) (:foreground "#5085ef" :underline t))
|
|
|
|
(((class color)) (:foreground "blue" :underline t))
|
|
|
|
(t (:underline t)))
|
|
|
|
"Face used in Proced buffers for process IDs which are session leaders."
|
|
|
|
:version "29.1")
|
|
|
|
|
|
|
|
(defface proced-ppid
|
|
|
|
'((((class color) (min-colors 88)) (:foreground "#5085bf"))
|
|
|
|
(((class color)) (:foreground "blue")))
|
|
|
|
"Face used in Proced buffers for parent process IDs."
|
|
|
|
:version "29.1")
|
|
|
|
|
|
|
|
(defface proced-pgrp
|
|
|
|
'((((class color) (min-colors 88)) (:foreground "#4785bf"))
|
|
|
|
(((class color)) (:foreground "blue")))
|
|
|
|
"Face used in Proced buffers for process group IDs."
|
|
|
|
:version "29.1")
|
|
|
|
|
|
|
|
(defface proced-sess
|
|
|
|
'((((class color) (min-colors 88)) (:foreground "#41729f"))
|
|
|
|
(((class color)) (:foreground "MidnightBlue")))
|
|
|
|
"Face used in Proced buffers for process session IDs."
|
|
|
|
:version "29.1")
|
|
|
|
|
|
|
|
(defface proced-cpu
|
|
|
|
'((((class color) (min-colors 88)) (:foreground "#6d5cc3" :bold t))
|
|
|
|
(t (:bold t)))
|
|
|
|
"Face used in Proced buffers for process CPU utilization."
|
|
|
|
:version "29.1")
|
|
|
|
|
|
|
|
(defface proced-mem
|
|
|
|
'((((class color) (min-colors 88))
|
|
|
|
(:foreground "#6d5cc3")))
|
|
|
|
"Face used in Proced buffers for process memory utilization."
|
|
|
|
:version "29.1")
|
|
|
|
|
|
|
|
(defface proced-user
|
|
|
|
'((t (:bold t)))
|
|
|
|
"Face used in Proced buffers for the user owning the process."
|
|
|
|
:version "29.1")
|
|
|
|
|
|
|
|
(defface proced-time-colon
|
|
|
|
'((((class color) (min-colors 88)) (:foreground "DarkMagenta"))
|
|
|
|
(t (:bold t)))
|
|
|
|
"Face used in Proced buffers for the colon in time strings."
|
|
|
|
:version "29.1")
|
|
|
|
|
2008-03-26 02:15:28 +00:00
|
|
|
(defvar proced-re-mark "^[^ \n]"
|
|
|
|
"Regexp matching a marked line.
|
|
|
|
Important: the match ends just after the marker.")
|
|
|
|
|
2020-10-11 22:21:48 +00:00
|
|
|
(defvar-local proced-header-line nil
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
"Headers in Proced buffer as a string.")
|
|
|
|
|
2008-12-29 06:13:36 +00:00
|
|
|
(defvar proced-temp-alist nil
|
|
|
|
"Temporary alist (internal variable).")
|
2008-12-28 13:58:10 +00:00
|
|
|
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
(defvar proced-process-tree nil
|
2008-12-28 13:58:10 +00:00
|
|
|
"Proced process tree (internal variable).")
|
|
|
|
|
2009-01-03 12:19:56 +00:00
|
|
|
(defvar proced-tree-depth nil
|
|
|
|
"Internal variable for depth of Proced process tree.")
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
|
2008-12-14 17:31:34 +00:00
|
|
|
(defvar proced-auto-update-timer nil
|
|
|
|
"Stores if Proced auto update timer is already installed.")
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
|
2008-09-20 03:03:07 +00:00
|
|
|
(defvar proced-log-buffer "*Proced log*"
|
|
|
|
"Name of Proced Log buffer.")
|
|
|
|
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
(defconst proced-help-string
|
2022-09-15 07:17:30 +00:00
|
|
|
(concat "\\<proced-mode-map> "
|
|
|
|
"\\[next-line] next, "
|
|
|
|
"\\[previous-line] previous, "
|
|
|
|
"\\[proced-mark] mark, "
|
|
|
|
"\\[proced-unmark] unmark, "
|
|
|
|
"\\[proced-send-signal] kill, "
|
|
|
|
"\\[quit-window] quit "
|
|
|
|
"(type \\[proced-help] for more help)")
|
2008-12-19 21:53:25 +00:00
|
|
|
"Help string for Proced.")
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
|
|
|
|
(defconst proced-header-help-echo
|
2008-09-12 16:59:57 +00:00
|
|
|
"mouse-1, mouse-2: sort by attribute %s%s (%s)"
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
"Help string shown when mouse is over a sortable header.")
|
|
|
|
|
|
|
|
(defconst proced-field-help-echo
|
2008-09-12 16:59:57 +00:00
|
|
|
"mouse-2, RET: refine by attribute %s %s"
|
|
|
|
"Help string shown when mouse is over a refinable field.")
|
2008-03-26 02:15:28 +00:00
|
|
|
|
|
|
|
(defvar proced-font-lock-keywords
|
2008-09-14 16:44:44 +00:00
|
|
|
`(;; (Any) proced marks.
|
|
|
|
(,proced-re-mark . 'proced-mark)
|
|
|
|
;; Processes marked with `proced-marker-char'
|
|
|
|
;; Should we make sure that only certain attributes are font-locked?
|
|
|
|
(,(concat "^[" (char-to-string proced-marker-char) "]")
|
|
|
|
".+" (proced-move-to-goal-column) nil (0 'proced-marked))))
|
2008-03-26 02:15:28 +00:00
|
|
|
|
2022-09-09 01:38:42 +00:00
|
|
|
(defvar-keymap proced-mode-map
|
|
|
|
:doc "Keymap for Proced commands."
|
|
|
|
;; moving
|
|
|
|
"SPC" #'next-line
|
|
|
|
"n" #'next-line
|
|
|
|
"p" #'previous-line
|
|
|
|
"C-n" #'next-line
|
|
|
|
"C-p" #'previous-line
|
|
|
|
"S-SPC" #'previous-line
|
|
|
|
"<down>" #'next-line
|
|
|
|
"<up>" #'previous-line
|
|
|
|
;; marking
|
|
|
|
"d" #'proced-mark ; Dired compatibility ("delete")
|
|
|
|
"m" #'proced-mark
|
|
|
|
"u" #'proced-unmark
|
|
|
|
"DEL" #'proced-unmark-backward
|
|
|
|
"M" #'proced-mark-all
|
|
|
|
"U" #'proced-unmark-all
|
|
|
|
"t" #'proced-toggle-marks
|
|
|
|
"C" #'proced-mark-children
|
|
|
|
"P" #'proced-mark-parents
|
|
|
|
;; filtering
|
|
|
|
"f" #'proced-filter-interactive
|
|
|
|
"<mouse-2>" #'proced-refine
|
|
|
|
"RET" #'proced-refine
|
|
|
|
;; sorting
|
|
|
|
"s c" #'proced-sort-pcpu
|
|
|
|
"s m" #'proced-sort-pmem
|
|
|
|
"s p" #'proced-sort-pid
|
|
|
|
"s s" #'proced-sort-start
|
|
|
|
"s S" #'proced-sort-interactive
|
|
|
|
"s t" #'proced-sort-time
|
|
|
|
"s u" #'proced-sort-user
|
|
|
|
;; similar to `Buffer-menu-sort-by-column'
|
|
|
|
"<header-line> <mouse-1>" #'proced-sort-header
|
|
|
|
"<header-line> <mouse-2>" #'proced-sort-header
|
|
|
|
"T" #'proced-toggle-tree
|
|
|
|
;; formatting
|
|
|
|
"F" #'proced-format-interactive
|
|
|
|
;; operate
|
|
|
|
"o" #'proced-omit-processes
|
|
|
|
"x" #'proced-send-signal ; Dired compatibility
|
|
|
|
"k" #'proced-send-signal ; kill processes
|
|
|
|
"r" #'proced-renice ; renice processes
|
|
|
|
;; misc
|
|
|
|
"h" #'describe-mode
|
|
|
|
"?" #'proced-help
|
|
|
|
"<remap> <undo>" #'proced-undo
|
|
|
|
"<remap> <advertised-undo>" #'proced-undo
|
|
|
|
;; Additional keybindings are inherited from `special-mode-map'
|
|
|
|
)
|
|
|
|
(put 'proced-mark :advertised-binding "m")
|
2008-03-26 02:15:28 +00:00
|
|
|
|
2021-09-14 06:43:18 +00:00
|
|
|
(easy-menu-define proced-menu proced-mode-map
|
|
|
|
"Proced Menu."
|
2008-08-18 00:47:12 +00:00
|
|
|
`("Proced"
|
|
|
|
["Mark" proced-mark
|
|
|
|
:help "Mark Current Process"]
|
|
|
|
["Unmark" proced-unmark
|
|
|
|
:help "Unmark Current Process"]
|
|
|
|
["Mark All" proced-mark-all
|
|
|
|
:help "Mark All Processes"]
|
|
|
|
["Unmark All" proced-unmark-all
|
|
|
|
:help "Unmark All Process"]
|
|
|
|
["Toggle Marks" proced-toggle-marks
|
|
|
|
:help "Marked Processes Become Unmarked, and Vice Versa"]
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
["Mark Children" proced-mark-children
|
|
|
|
:help "Mark Current Process and its Children"]
|
|
|
|
["Mark Parents" proced-mark-parents
|
|
|
|
:help "Mark Current Process and its Parents"]
|
2008-04-14 01:35:56 +00:00
|
|
|
"--"
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
("Filters"
|
|
|
|
:help "Select Filter for Process Listing"
|
|
|
|
,@(mapcar (lambda (el)
|
|
|
|
(let ((filter (car el)))
|
|
|
|
`[,(symbol-name filter)
|
|
|
|
(proced-filter-interactive ',filter)
|
|
|
|
:style radio
|
|
|
|
:selected (eq proced-filter ',filter)]))
|
|
|
|
proced-filter-alist))
|
|
|
|
("Sorting"
|
2008-09-12 16:59:57 +00:00
|
|
|
:help "Select Sort Scheme"
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
["Sort..." proced-sort-interactive
|
|
|
|
:help "Sort Process List"]
|
|
|
|
"--"
|
|
|
|
["Sort by %CPU" proced-sort-pcpu]
|
|
|
|
["Sort by %MEM" proced-sort-pmem]
|
|
|
|
["Sort by PID" proced-sort-pid]
|
|
|
|
["Sort by START" proced-sort-start]
|
|
|
|
["Sort by TIME" proced-sort-time]
|
|
|
|
["Sort by USER" proced-sort-user])
|
|
|
|
("Formats"
|
|
|
|
:help "Select Format for Process Listing"
|
|
|
|
,@(mapcar (lambda (el)
|
|
|
|
(let ((format (car el)))
|
|
|
|
`[,(symbol-name format)
|
|
|
|
(proced-format-interactive ',format)
|
|
|
|
:style radio
|
|
|
|
:selected (eq proced-format ',format)]))
|
|
|
|
proced-format-alist))
|
2008-12-28 13:58:10 +00:00
|
|
|
["Tree Display" proced-toggle-tree
|
|
|
|
:style toggle
|
|
|
|
:selected (eval proced-tree-flag)
|
|
|
|
:help "Display Proced Buffer as Process Tree"]
|
2008-05-05 02:38:20 +00:00
|
|
|
"--"
|
2008-08-18 00:47:12 +00:00
|
|
|
["Omit Marked Processes" proced-omit-processes
|
|
|
|
:help "Omit Marked Processes in Process Listing."]
|
2008-03-26 02:15:28 +00:00
|
|
|
"--"
|
2008-08-18 00:47:12 +00:00
|
|
|
["Revert" revert-buffer
|
|
|
|
:help "Revert Process Listing"]
|
2008-12-14 17:31:34 +00:00
|
|
|
["Auto Update" proced-toggle-auto-update
|
2008-12-14 17:41:29 +00:00
|
|
|
:style toggle
|
2008-12-14 17:31:34 +00:00
|
|
|
:selected (eval proced-auto-update-flag)
|
2008-09-12 16:59:57 +00:00
|
|
|
:help "Auto Update of Proced Buffer"]
|
2012-09-23 12:34:23 +00:00
|
|
|
"--"
|
2008-08-18 00:47:12 +00:00
|
|
|
["Send signal" proced-send-signal
|
2012-09-23 12:34:23 +00:00
|
|
|
:help "Send Signal to Marked Processes"]
|
|
|
|
["Renice" proced-renice
|
|
|
|
:help "Renice Marked Processes"]))
|
2008-08-18 00:47:12 +00:00
|
|
|
|
2008-05-20 10:17:15 +00:00
|
|
|
;; helper functions
|
2022-04-05 15:08:03 +00:00
|
|
|
(defun proced-user-name (user)
|
|
|
|
"Check the `user' attribute with user name `proced' is running for."
|
|
|
|
(string-equal user (if (file-remote-p default-directory)
|
|
|
|
(file-remote-p default-directory 'user)
|
|
|
|
(user-real-login-name))))
|
|
|
|
|
2008-04-14 01:35:56 +00:00
|
|
|
(defun proced-marker-regexp ()
|
2008-05-05 02:38:20 +00:00
|
|
|
"Return regexp matching `proced-marker-char'."
|
2008-05-20 10:17:15 +00:00
|
|
|
;; `proced-marker-char' must appear in column zero
|
2008-04-14 01:35:56 +00:00
|
|
|
(concat "^" (regexp-quote (char-to-string proced-marker-char))))
|
|
|
|
|
|
|
|
(defun proced-success-message (action count)
|
2008-05-05 02:38:20 +00:00
|
|
|
"Display success message for ACTION performed for COUNT processes."
|
2008-04-14 01:35:56 +00:00
|
|
|
(message "%s %s process%s" action count (if (= 1 count) "" "es")))
|
|
|
|
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
;; Unlike dired, we do not define our own commands for vertical motion.
|
|
|
|
;; If `goal-column' is set, `next-line' and `previous-line' are fancy
|
|
|
|
;; commands to satisfy our modest needs. If `proced-goal-attribute'
|
|
|
|
;; and/or `goal-column' are not set, `next-line' and `previous-line'
|
|
|
|
;; are really what we need to preserve the column of point.
|
|
|
|
;; We use `proced-move-to-goal-column' for "non-interactive" cases only
|
|
|
|
;; to get a well-defined position of point.
|
|
|
|
|
2008-05-20 10:17:15 +00:00
|
|
|
(defun proced-move-to-goal-column ()
|
2008-09-12 16:59:57 +00:00
|
|
|
"Move to `goal-column' if non-nil. Return position of point."
|
2008-04-14 01:35:56 +00:00
|
|
|
(beginning-of-line)
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
(unless (eobp)
|
|
|
|
(if goal-column
|
|
|
|
(forward-char goal-column)
|
2008-09-12 16:59:57 +00:00
|
|
|
(forward-char 2)))
|
|
|
|
(point))
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
|
|
|
|
(defun proced-header-line ()
|
|
|
|
"Return header line for Proced buffer."
|
2020-10-11 22:21:48 +00:00
|
|
|
(let ((base (line-number-display-width 'columns))
|
|
|
|
(hl (if (<= (window-hscroll) (length proced-header-line))
|
|
|
|
(substring proced-header-line (window-hscroll)))))
|
|
|
|
(when hl
|
|
|
|
;; From buff-menu.el: Turn whitespace chars in the header into
|
|
|
|
;; stretch specs so they work regardless of the header-line face.
|
|
|
|
(let ((pos 0))
|
|
|
|
(while (string-match "[ \t\n]+" hl pos)
|
|
|
|
(setq pos (match-end 0))
|
|
|
|
(put-text-property (match-beginning 0) pos 'display
|
|
|
|
`(space :align-to ,(+ pos base))
|
|
|
|
hl)))
|
|
|
|
(setq hl (replace-regexp-in-string ;; preserve text properties
|
|
|
|
"\\(%\\)" "\\1\\1"
|
|
|
|
hl)))
|
|
|
|
(list (propertize " " 'display `(space :align-to ,base))
|
|
|
|
hl)))
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
|
|
|
|
(defun proced-pid-at-point ()
|
|
|
|
"Return pid of system process at point.
|
|
|
|
Return nil if point is not on a process line."
|
|
|
|
(save-excursion
|
|
|
|
(beginning-of-line)
|
|
|
|
(if (looking-at "^. .")
|
|
|
|
(get-text-property (match-end 0) 'proced-pid))))
|
|
|
|
|
|
|
|
;; proced mode
|
2008-04-14 01:35:56 +00:00
|
|
|
|
2009-01-03 12:19:56 +00:00
|
|
|
(define-derived-mode proced-mode special-mode "Proced"
|
2009-09-06 20:09:01 +00:00
|
|
|
"Mode for displaying system processes and sending signals to them.
|
2008-09-20 03:03:07 +00:00
|
|
|
Type \\[proced] to start a Proced session. In a Proced buffer
|
|
|
|
type \\<proced-mode-map>\\[proced-mark] to mark a process for later commands.
|
2008-04-16 03:07:49 +00:00
|
|
|
Type \\[proced-send-signal] to send signals to marked processes.
|
2022-03-30 11:16:54 +00:00
|
|
|
Type \\[proced-renice] to renice marked processes.
|
2008-04-16 03:07:49 +00:00
|
|
|
|
2022-10-04 00:15:51 +00:00
|
|
|
The initial content of a listing is defined by the variable
|
|
|
|
`proced-filter' and the variable `proced-format'.
|
|
|
|
|
|
|
|
The variable `proced-filter' specifies which system processes are
|
|
|
|
displayed.
|
|
|
|
|
|
|
|
The variable `proced-format' specifies which attributes are
|
|
|
|
displayed for each process.
|
|
|
|
|
|
|
|
Type \\[proced-filter-interactive] and \\[proced-format-interactive] to \
|
|
|
|
change the values of `proced-filter' and
|
|
|
|
`proced-format'. The current value of the variable
|
|
|
|
`proced-filter' is indicated in the mode line.
|
2008-09-12 16:59:57 +00:00
|
|
|
|
|
|
|
The sort order of Proced listings is defined by the variable `proced-sort'.
|
2022-10-04 00:15:51 +00:00
|
|
|
Type \\[proced-sort-interactive] or click on a header in the header \
|
|
|
|
line to change the sort scheme.
|
|
|
|
The current sort scheme is indicated in the mode line, using
|
|
|
|
\"+\" or \"-\" for ascending or descending sort order.
|
2008-09-12 16:59:57 +00:00
|
|
|
|
2022-10-04 00:15:51 +00:00
|
|
|
Type \\[proced-toggle-tree] to toggle whether the listing is displayed as process tree.
|
2008-12-28 13:58:10 +00:00
|
|
|
|
2016-02-24 05:06:07 +00:00
|
|
|
Type \\[proced-toggle-auto-update] to automatically update the
|
|
|
|
process list. The time interval for updates can be configured
|
|
|
|
via `proced-auto-update-interval'.
|
|
|
|
|
2008-12-14 23:16:09 +00:00
|
|
|
An existing Proced listing can be refined by typing \\[proced-refine].
|
2008-09-12 16:59:57 +00:00
|
|
|
Refining an existing listing does not update the variable `proced-filter'.
|
|
|
|
|
2022-10-04 00:15:51 +00:00
|
|
|
The attribute-specific rules for formatting, filtering, sorting,
|
|
|
|
and refining are defined in `proced-grammar-alist'.
|
2008-09-12 16:59:57 +00:00
|
|
|
|
2022-10-04 00:15:51 +00:00
|
|
|
After displaying or updating a Proced buffer, Proced runs the
|
|
|
|
normal hook `proced-post-display-hook'.
|
2009-01-03 12:19:56 +00:00
|
|
|
|
2008-04-16 03:07:49 +00:00
|
|
|
\\{proced-mode-map}"
|
2021-10-05 16:16:48 +00:00
|
|
|
:interactive nil
|
2008-04-16 03:07:49 +00:00
|
|
|
(abbrev-mode 0)
|
|
|
|
(auto-fill-mode 0)
|
|
|
|
(setq buffer-read-only t
|
2008-05-21 08:00:05 +00:00
|
|
|
truncate-lines t
|
|
|
|
header-line-format '(:eval (proced-header-line)))
|
2020-10-11 22:21:48 +00:00
|
|
|
(add-hook 'post-command-hook #'force-mode-line-update nil t) ;; FIXME: Why?
|
2020-12-09 08:44:38 +00:00
|
|
|
(setq-local revert-buffer-function #'proced-revert)
|
|
|
|
(setq-local font-lock-defaults
|
|
|
|
'(proced-font-lock-keywords t nil nil beginning-of-line))
|
2008-12-14 17:31:34 +00:00
|
|
|
(if (and (not proced-auto-update-timer) proced-auto-update-interval)
|
|
|
|
(setq proced-auto-update-timer
|
|
|
|
(run-at-time t proced-auto-update-interval
|
|
|
|
'proced-auto-update-timer))))
|
2008-11-20 02:43:29 +00:00
|
|
|
|
2008-04-16 03:07:49 +00:00
|
|
|
;;;###autoload
|
|
|
|
(defun proced (&optional arg)
|
2008-09-12 16:59:57 +00:00
|
|
|
"Generate a listing of UNIX system processes.
|
2012-08-05 14:22:05 +00:00
|
|
|
\\<proced-mode-map>
|
2022-04-05 15:08:03 +00:00
|
|
|
If invoked with optional non-negative ARG, do not select the
|
|
|
|
window displaying the process information.
|
|
|
|
|
|
|
|
If `proced-show-remote-processes' is non-nil or the command is
|
|
|
|
invoked with a negative ARG `\\[universal-argument] \\[negative-argument]', \
|
|
|
|
and `default-directory'
|
|
|
|
points to a remote host, the system processes of that host are shown.
|
2008-03-26 02:15:28 +00:00
|
|
|
|
2012-08-05 14:22:05 +00:00
|
|
|
This function runs the normal hook `proced-post-display-hook'.
|
|
|
|
|
|
|
|
See `proced-mode' for a description of features available in
|
|
|
|
Proced buffers."
|
2008-03-26 02:15:28 +00:00
|
|
|
(interactive "P")
|
2008-12-14 17:31:34 +00:00
|
|
|
(unless proced-available
|
|
|
|
(error "Proced is not available on this system"))
|
2008-05-20 10:17:15 +00:00
|
|
|
(let ((buffer (get-buffer-create "*Proced*")) new)
|
2008-05-05 02:38:20 +00:00
|
|
|
(set-buffer buffer)
|
2022-04-05 15:08:03 +00:00
|
|
|
(when (and (file-remote-p default-directory)
|
|
|
|
(not
|
|
|
|
(or proced-show-remote-processes
|
|
|
|
(eq arg '-))))
|
|
|
|
(setq default-directory temporary-file-directory))
|
2008-03-26 02:15:28 +00:00
|
|
|
(setq new (zerop (buffer-size)))
|
2009-01-03 12:19:56 +00:00
|
|
|
(when new
|
|
|
|
(proced-mode)
|
|
|
|
;; `proced-update' runs `proced-post-display-hook' only if the
|
|
|
|
;; Proced buffer has been selected. Yet the following call of
|
|
|
|
;; `proced-update' is for an empty Proced buffer that has not
|
|
|
|
;; yet been selected. Therefore we need to call
|
|
|
|
;; `proced-post-display-hook' below.
|
|
|
|
(proced-update t))
|
2008-03-26 02:15:28 +00:00
|
|
|
(if arg
|
2009-01-03 12:19:56 +00:00
|
|
|
(progn
|
|
|
|
(display-buffer buffer)
|
|
|
|
(with-current-buffer buffer
|
2009-12-04 21:47:08 +00:00
|
|
|
(proced-update t)))
|
2008-05-05 02:38:20 +00:00
|
|
|
(pop-to-buffer buffer)
|
2009-12-04 21:47:08 +00:00
|
|
|
(proced-update t)
|
2008-07-19 23:57:12 +00:00
|
|
|
(message
|
|
|
|
(substitute-command-keys
|
|
|
|
"Type \\<proced-mode-map>\\[quit-window] to quit, \\[proced-help] for help")))))
|
2008-03-26 02:15:28 +00:00
|
|
|
|
2008-12-14 17:31:34 +00:00
|
|
|
(defun proced-auto-update-timer ()
|
2022-11-15 18:48:40 +00:00
|
|
|
"Auto-update Proced buffers using `run-at-time'.
|
|
|
|
|
|
|
|
If there are no proced buffers, cancel the timer."
|
|
|
|
(unless (seq-filter (lambda (buf)
|
|
|
|
(with-current-buffer buf
|
|
|
|
(when (eq major-mode 'proced-mode)
|
2022-11-20 11:51:22 +00:00
|
|
|
(if proced-auto-update-flag
|
|
|
|
(proced-update t t))
|
2022-11-15 18:48:40 +00:00
|
|
|
t)))
|
|
|
|
(buffer-list))
|
|
|
|
(cancel-timer proced-auto-update-timer)
|
|
|
|
(setq proced-auto-update-timer nil)))
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
|
2008-12-14 17:31:34 +00:00
|
|
|
(defun proced-toggle-auto-update (arg)
|
2008-09-12 16:59:57 +00:00
|
|
|
"Change whether this Proced buffer is updated automatically.
|
|
|
|
With prefix ARG, update this buffer automatically if ARG is positive,
|
2008-12-14 17:31:34 +00:00
|
|
|
otherwise do not update. Sets the variable `proced-auto-update-flag'.
|
|
|
|
The time interval for updates is specified via `proced-auto-update-interval'."
|
2021-10-05 16:16:48 +00:00
|
|
|
(interactive (list (or current-prefix-arg 'toggle)) proced-mode)
|
2008-12-14 17:31:34 +00:00
|
|
|
(setq proced-auto-update-flag
|
|
|
|
(cond ((eq arg 'toggle) (not proced-auto-update-flag))
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
(arg (> (prefix-numeric-value arg) 0))
|
2008-12-14 17:31:34 +00:00
|
|
|
(t (not proced-auto-update-flag))))
|
|
|
|
(message "Proced auto update %s"
|
|
|
|
(if proced-auto-update-flag "enabled" "disabled")))
|
2008-05-20 10:17:15 +00:00
|
|
|
|
2009-01-03 12:19:56 +00:00
|
|
|
;;; Mark
|
|
|
|
|
2008-03-26 02:15:28 +00:00
|
|
|
(defun proced-mark (&optional count)
|
|
|
|
"Mark the current (or next COUNT) processes."
|
2021-10-05 16:16:48 +00:00
|
|
|
(interactive "p" proced-mode)
|
2008-03-26 02:15:28 +00:00
|
|
|
(proced-do-mark t count))
|
|
|
|
|
|
|
|
(defun proced-unmark (&optional count)
|
|
|
|
"Unmark the current (or next COUNT) processes."
|
2021-10-05 16:16:48 +00:00
|
|
|
(interactive "p" proced-mode)
|
2008-03-26 02:15:28 +00:00
|
|
|
(proced-do-mark nil count))
|
|
|
|
|
2008-04-14 01:35:56 +00:00
|
|
|
(defun proced-unmark-backward (&optional count)
|
|
|
|
"Unmark the previous (or COUNT previous) processes."
|
2008-05-05 02:38:20 +00:00
|
|
|
;; Analogous to `dired-unmark-backward',
|
|
|
|
;; but `ibuffer-unmark-backward' behaves different.
|
2021-10-05 16:16:48 +00:00
|
|
|
(interactive "p" proced-mode)
|
2008-04-14 01:35:56 +00:00
|
|
|
(proced-do-mark nil (- (or count 1))))
|
|
|
|
|
2008-03-26 02:15:28 +00:00
|
|
|
(defun proced-do-mark (mark &optional count)
|
2008-08-18 00:47:12 +00:00
|
|
|
"Mark the current (or next COUNT) processes using MARK."
|
2008-03-26 02:15:28 +00:00
|
|
|
(or count (setq count 1))
|
2008-04-14 01:35:56 +00:00
|
|
|
(let ((backward (< count 0))
|
2008-03-26 02:15:28 +00:00
|
|
|
buffer-read-only)
|
2008-05-20 10:17:15 +00:00
|
|
|
(setq count (1+ (if (<= 0 count) count
|
|
|
|
(min (1- (line-number-at-pos)) (abs count)))))
|
|
|
|
(beginning-of-line)
|
|
|
|
(while (not (or (zerop (setq count (1- count))) (eobp)))
|
|
|
|
(proced-insert-mark mark backward))
|
|
|
|
(proced-move-to-goal-column)))
|
2008-03-26 02:15:28 +00:00
|
|
|
|
2009-01-03 12:19:56 +00:00
|
|
|
(defun proced-toggle-marks ()
|
|
|
|
"Toggle marks: marked processes become unmarked, and vice versa."
|
2021-10-05 16:16:48 +00:00
|
|
|
(interactive nil proced-mode)
|
2009-01-03 12:19:56 +00:00
|
|
|
(let ((mark-re (proced-marker-regexp))
|
|
|
|
buffer-read-only)
|
|
|
|
(save-excursion
|
|
|
|
(goto-char (point-min))
|
|
|
|
(while (not (eobp))
|
|
|
|
(cond ((looking-at mark-re)
|
|
|
|
(proced-insert-mark nil))
|
2017-07-07 03:53:19 +00:00
|
|
|
((= (following-char) ?\s)
|
2009-01-03 12:19:56 +00:00
|
|
|
(proced-insert-mark t))
|
|
|
|
(t
|
|
|
|
(forward-line 1)))))))
|
|
|
|
|
|
|
|
(defun proced-insert-mark (mark &optional backward)
|
|
|
|
"If MARK is non-nil, insert `proced-marker-char'.
|
|
|
|
If BACKWARD is non-nil, move one line backwards before inserting the mark.
|
|
|
|
Otherwise move one line forward after inserting the mark."
|
|
|
|
(if backward (forward-line -1))
|
|
|
|
(insert (if mark proced-marker-char ?\s))
|
|
|
|
(delete-char 1)
|
|
|
|
(unless backward (forward-line)))
|
|
|
|
|
2008-03-26 02:15:28 +00:00
|
|
|
(defun proced-mark-all ()
|
2008-08-18 00:47:12 +00:00
|
|
|
"Mark all processes.
|
|
|
|
If `transient-mark-mode' is turned on and the region is active,
|
|
|
|
mark the region."
|
2021-10-05 16:16:48 +00:00
|
|
|
(interactive nil proced-mode)
|
2008-03-26 02:15:28 +00:00
|
|
|
(proced-do-mark-all t))
|
|
|
|
|
|
|
|
(defun proced-unmark-all ()
|
2008-08-18 00:47:12 +00:00
|
|
|
"Unmark all processes.
|
|
|
|
If `transient-mark-mode' is turned on and the region is active,
|
|
|
|
unmark the region."
|
2021-10-05 16:16:48 +00:00
|
|
|
(interactive nil proced-mode)
|
2008-03-26 02:15:28 +00:00
|
|
|
(proced-do-mark-all nil))
|
|
|
|
|
|
|
|
(defun proced-do-mark-all (mark)
|
2008-08-18 00:47:12 +00:00
|
|
|
"Mark all processes using MARK.
|
|
|
|
If `transient-mark-mode' is turned on and the region is active,
|
|
|
|
mark the region."
|
2009-01-03 12:19:56 +00:00
|
|
|
(let* ((count 0)
|
|
|
|
(proced-marker-char (if mark proced-marker-char ?\s))
|
|
|
|
(marker-re (proced-marker-regexp))
|
|
|
|
end buffer-read-only)
|
2008-04-14 01:35:56 +00:00
|
|
|
(save-excursion
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
(if (use-region-p)
|
2008-08-18 00:47:12 +00:00
|
|
|
;; Operate even on those lines that are only partially a part
|
|
|
|
;; of region. This appears most consistent with
|
|
|
|
;; `proced-move-to-goal-column'.
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
(progn (setq end (save-excursion
|
|
|
|
(goto-char (region-end))
|
|
|
|
(unless (looking-at "^") (forward-line))
|
|
|
|
(point)))
|
|
|
|
(goto-char (region-beginning))
|
|
|
|
(unless (looking-at "^") (beginning-of-line)))
|
2008-08-18 00:47:12 +00:00
|
|
|
(goto-char (point-min))
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
(setq end (point-max)))
|
|
|
|
(while (< (point) end)
|
2009-01-03 12:19:56 +00:00
|
|
|
(unless (looking-at marker-re)
|
|
|
|
(setq count (1+ count))
|
|
|
|
(insert proced-marker-char)
|
|
|
|
(delete-char 1))
|
|
|
|
(forward-line))
|
|
|
|
(proced-success-message (if mark "Marked" "Unmarked") count))))
|
2008-04-14 01:35:56 +00:00
|
|
|
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
(defun proced-mark-children (ppid &optional omit-ppid)
|
|
|
|
"Mark child processes of process PPID.
|
|
|
|
Also mark process PPID unless prefix OMIT-PPID is non-nil."
|
2021-10-05 16:16:48 +00:00
|
|
|
(interactive (list (proced-pid-at-point) current-prefix-arg) proced-mode)
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
(proced-mark-process-alist
|
|
|
|
(proced-filter-children proced-process-alist ppid omit-ppid)))
|
|
|
|
|
|
|
|
(defun proced-mark-parents (cpid &optional omit-cpid)
|
|
|
|
"Mark parent processes of process CPID.
|
|
|
|
Also mark CPID unless prefix OMIT-CPID is non-nil."
|
2021-10-05 16:16:48 +00:00
|
|
|
(interactive (list (proced-pid-at-point) current-prefix-arg) proced-mode)
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
(proced-mark-process-alist
|
|
|
|
(proced-filter-parents proced-process-alist cpid omit-cpid)))
|
|
|
|
|
|
|
|
(defun proced-mark-process-alist (process-alist &optional quiet)
|
2008-12-28 13:58:10 +00:00
|
|
|
"Mark processes in PROCESS-ALIST.
|
|
|
|
If QUIET is non-nil suppress status message."
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
(let ((count 0))
|
|
|
|
(if process-alist
|
|
|
|
(let (buffer-read-only)
|
|
|
|
(save-excursion
|
|
|
|
(goto-char (point-min))
|
|
|
|
(while (not (eobp))
|
|
|
|
(when (assq (proced-pid-at-point) process-alist)
|
|
|
|
(insert proced-marker-char)
|
|
|
|
(delete-char 1)
|
|
|
|
(setq count (1+ count)))
|
|
|
|
(forward-line)))))
|
|
|
|
(unless quiet
|
|
|
|
(proced-success-message "Marked" count))))
|
|
|
|
|
2008-04-14 01:35:56 +00:00
|
|
|
;; Mostly analog of `dired-do-kill-lines'.
|
|
|
|
;; However, for negative args the target lines of `dired-do-kill-lines'
|
|
|
|
;; include the current line, whereas `dired-mark' for negative args operates
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
;; on the preceding lines. Here we are consistent with `dired-mark'.
|
2008-08-18 00:47:12 +00:00
|
|
|
(defun proced-omit-processes (&optional arg quiet)
|
|
|
|
"Omit marked processes.
|
|
|
|
With prefix ARG, omit that many lines starting with the current line.
|
|
|
|
\(A negative argument omits backward.)
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
If `transient-mark-mode' is turned on and the region is active,
|
|
|
|
omit the processes in region.
|
2008-04-14 01:35:56 +00:00
|
|
|
If QUIET is non-nil suppress status message.
|
2008-08-18 00:47:12 +00:00
|
|
|
Returns count of omitted lines."
|
2021-10-05 16:16:48 +00:00
|
|
|
(interactive "P" proced-mode)
|
2008-04-14 01:35:56 +00:00
|
|
|
(let ((mark-re (proced-marker-regexp))
|
|
|
|
(count 0)
|
|
|
|
buffer-read-only)
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
(cond ((use-region-p) ;; Omit active region
|
|
|
|
(let ((lines (count-lines (region-beginning) (region-end))))
|
|
|
|
(save-excursion
|
|
|
|
(goto-char (region-beginning))
|
|
|
|
(while (< count lines)
|
|
|
|
(proced-omit-process)
|
|
|
|
(setq count (1+ count))))))
|
|
|
|
((not arg) ;; Omit marked lines
|
|
|
|
(save-excursion
|
|
|
|
(goto-char (point-min))
|
|
|
|
(while (and (not (eobp))
|
|
|
|
(re-search-forward mark-re nil t))
|
|
|
|
(proced-omit-process)
|
|
|
|
(setq count (1+ count)))))
|
|
|
|
((< 0 arg) ;; Omit forward
|
|
|
|
(while (and (not (eobp)) (< count arg))
|
|
|
|
(proced-omit-process)
|
|
|
|
(setq count (1+ count))))
|
|
|
|
((< arg 0) ;; Omit backward
|
|
|
|
(while (and (not (bobp)) (< count (- arg)))
|
|
|
|
(forward-line -1)
|
|
|
|
(proced-omit-process)
|
|
|
|
(setq count (1+ count)))))
|
2008-05-20 10:17:15 +00:00
|
|
|
(unless (zerop count) (proced-move-to-goal-column))
|
2008-08-18 00:47:12 +00:00
|
|
|
(unless quiet (proced-success-message "Omitted" count))
|
2008-04-14 01:35:56 +00:00
|
|
|
count))
|
2008-03-26 02:15:28 +00:00
|
|
|
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
(defun proced-omit-process ()
|
|
|
|
"Omit process from listing point is on.
|
|
|
|
Update `proced-process-alist' accordingly."
|
|
|
|
(setq proced-process-alist
|
|
|
|
(assq-delete-all (proced-pid-at-point) proced-process-alist))
|
|
|
|
(delete-region (line-beginning-position)
|
|
|
|
(save-excursion (forward-line) (point))))
|
|
|
|
|
|
|
|
;;; Filtering
|
|
|
|
|
|
|
|
(defun proced-filter (process-alist filter-list)
|
2008-09-12 16:59:57 +00:00
|
|
|
"Apply FILTER-LIST to PROCESS-ALIST.
|
|
|
|
Return the filtered process list."
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
(if (symbolp filter-list)
|
|
|
|
(setq filter-list (cdr (assq filter-list proced-filter-alist))))
|
|
|
|
(dolist (filter filter-list)
|
|
|
|
(let (new-alist)
|
|
|
|
(cond ( ;; apply function to entire process list
|
|
|
|
(eq (car filter) 'fun-all)
|
|
|
|
(setq new-alist (funcall (cdr filter) process-alist)))
|
|
|
|
( ;; apply predicate to each list of attributes
|
|
|
|
(eq (car filter) 'function)
|
|
|
|
(dolist (process process-alist)
|
|
|
|
(if (funcall (car filter) (cdr process))
|
|
|
|
(push process new-alist))))
|
|
|
|
(t ;; apply predicate to specified attribute
|
2020-10-11 22:21:48 +00:00
|
|
|
(let* ((cdrfilter (cdr filter))
|
|
|
|
(fun (if (stringp cdrfilter)
|
|
|
|
(lambda (val)
|
|
|
|
(string-match cdrfilter val))
|
|
|
|
cdrfilter))
|
|
|
|
value)
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
(dolist (process process-alist)
|
|
|
|
(setq value (cdr (assq (car filter) (cdr process))))
|
|
|
|
(if (and value (funcall fun value))
|
|
|
|
(push process new-alist))))))
|
|
|
|
(setq process-alist new-alist)))
|
|
|
|
process-alist)
|
|
|
|
|
2008-09-12 16:59:57 +00:00
|
|
|
(defun proced-filter-interactive (scheme)
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
"Filter Proced buffer using SCHEME.
|
|
|
|
When called interactively, an empty string means nil, i.e., no filtering.
|
2008-09-12 16:59:57 +00:00
|
|
|
Set variable `proced-filter' to SCHEME. Revert listing."
|
2008-03-26 02:15:28 +00:00
|
|
|
(interactive
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
(let ((scheme (completing-read "Filter: "
|
|
|
|
proced-filter-alist nil t)))
|
2021-10-05 16:16:48 +00:00
|
|
|
(list (if (string= "" scheme) nil (intern scheme))))
|
|
|
|
proced-mode)
|
2008-09-14 16:44:44 +00:00
|
|
|
;; only update if necessary
|
|
|
|
(unless (eq proced-filter scheme)
|
|
|
|
(setq proced-filter scheme)
|
|
|
|
(proced-update t)))
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
|
2008-12-29 06:13:36 +00:00
|
|
|
(defun proced-filter-parents (process-alist pid &optional omit-pid)
|
|
|
|
"For PROCESS-ALIST return list of parent processes of PID.
|
|
|
|
This list includes PID unless OMIT-PID is non-nil."
|
|
|
|
(let ((parent-list (unless omit-pid (list (assq pid process-alist))))
|
|
|
|
(process (assq pid process-alist))
|
|
|
|
ppid)
|
|
|
|
(while (and (setq ppid (cdr (assq 'ppid (cdr process))))
|
|
|
|
;; Ignore a PPID that equals PID.
|
|
|
|
(/= ppid pid)
|
|
|
|
;; Accept only PPIDs that correspond to members in PROCESS-ALIST.
|
|
|
|
(setq process (assq ppid process-alist)))
|
|
|
|
(setq pid ppid)
|
|
|
|
(push process parent-list))
|
|
|
|
parent-list))
|
|
|
|
|
|
|
|
(defun proced-filter-children (process-alist ppid &optional omit-ppid)
|
|
|
|
"For PROCESS-ALIST return list of child processes of PPID.
|
|
|
|
This list includes PPID unless OMIT-PPID is non-nil."
|
|
|
|
(let ((proced-temp-alist (proced-children-alist process-alist))
|
|
|
|
new-alist)
|
|
|
|
(dolist (pid (proced-children-pids ppid))
|
|
|
|
(push (assq pid process-alist) new-alist))
|
|
|
|
(if omit-ppid
|
|
|
|
(assq-delete-all ppid new-alist)
|
|
|
|
new-alist)))
|
|
|
|
|
|
|
|
;;; Process tree
|
|
|
|
|
2008-12-28 13:58:10 +00:00
|
|
|
(defun proced-children-alist (process-alist)
|
|
|
|
"Return children alist for PROCESS-ALIST.
|
|
|
|
The children alist has elements (PPID PID1 PID2 ...).
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
PPID is a parent PID. PID1, PID2, ... are the child processes of PPID.
|
2008-12-29 06:13:36 +00:00
|
|
|
The children alist inherits the sorting order of PROCESS-ALIST.
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
The list of children does not include grandchildren."
|
2008-12-28 13:58:10 +00:00
|
|
|
;; The PPIDs inherit the sorting order of PROCESS-ALIST.
|
|
|
|
(let ((process-tree (mapcar (lambda (a) (list (car a))) process-alist))
|
|
|
|
ppid)
|
|
|
|
(dolist (process process-alist)
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
(setq ppid (cdr (assq 'ppid (cdr process))))
|
2008-12-28 13:58:10 +00:00
|
|
|
(if (and ppid
|
|
|
|
;; Ignore a PPID that equals PID.
|
|
|
|
(/= ppid (car process))
|
|
|
|
;; Accept only PPIDs that correspond to members in PROCESS-ALIST.
|
|
|
|
(assq ppid process-alist))
|
|
|
|
(let ((temp-alist process-tree) elt)
|
|
|
|
(while (setq elt (pop temp-alist))
|
|
|
|
(when (eq ppid (car elt))
|
|
|
|
(setq temp-alist nil)
|
|
|
|
(setcdr elt (cons (car process) (cdr elt))))))))
|
|
|
|
;; The child processes inherit the sorting order of PROCESS-ALIST.
|
|
|
|
(setq process-tree
|
|
|
|
(mapcar (lambda (a) (cons (car a) (nreverse (cdr a))))
|
|
|
|
process-tree))))
|
|
|
|
|
2008-12-29 06:13:36 +00:00
|
|
|
(defun proced-children-pids (ppid)
|
|
|
|
"Return list of children PIDs of PPID (including PPID)."
|
|
|
|
(let ((cpids (cdr (assq ppid proced-temp-alist))))
|
|
|
|
(if cpids
|
2020-10-11 22:21:48 +00:00
|
|
|
(cons ppid (apply #'append (mapcar #'proced-children-pids cpids)))
|
2008-12-29 06:13:36 +00:00
|
|
|
(list ppid))))
|
|
|
|
|
2008-12-28 13:58:10 +00:00
|
|
|
(defun proced-process-tree (process-alist)
|
2008-12-29 06:13:36 +00:00
|
|
|
"Return process tree for PROCESS-ALIST.
|
|
|
|
It is an alist of alists where the car of each alist is a parent process
|
|
|
|
and the cdr is a list of child processes according to the ppid attribute
|
|
|
|
of these processes.
|
|
|
|
The process tree inherits the sorting order of PROCESS-ALIST."
|
|
|
|
(let ((proced-temp-alist (proced-children-alist process-alist))
|
2008-12-28 13:58:10 +00:00
|
|
|
pid-alist proced-process-tree)
|
2008-12-29 06:13:36 +00:00
|
|
|
(while (setq pid-alist (pop proced-temp-alist))
|
2008-12-28 13:58:10 +00:00
|
|
|
(push (proced-process-tree-internal pid-alist) proced-process-tree))
|
|
|
|
(nreverse proced-process-tree)))
|
|
|
|
|
|
|
|
(defun proced-process-tree-internal (pid-alist)
|
|
|
|
"Helper function for `proced-process-tree'."
|
|
|
|
(let ((cpid-list (cdr pid-alist)) cpid-alist cpid)
|
|
|
|
(while (setq cpid (car cpid-list))
|
2008-12-29 06:13:36 +00:00
|
|
|
(if (setq cpid-alist (assq cpid proced-temp-alist))
|
2008-12-28 13:58:10 +00:00
|
|
|
;; Unprocessed part of process tree that needs to be
|
|
|
|
;; analyzed recursively.
|
|
|
|
(progn
|
2008-12-29 06:13:36 +00:00
|
|
|
(setq proced-temp-alist
|
|
|
|
(assq-delete-all cpid proced-temp-alist))
|
2008-12-28 13:58:10 +00:00
|
|
|
(setcar cpid-list (proced-process-tree-internal cpid-alist)))
|
|
|
|
;; We already processed this subtree and take it "as is".
|
|
|
|
(setcar cpid-list (assq cpid proced-process-tree))
|
|
|
|
(setq proced-process-tree
|
|
|
|
(assq-delete-all cpid proced-process-tree)))
|
|
|
|
(pop cpid-list)))
|
|
|
|
pid-alist)
|
|
|
|
|
|
|
|
(defun proced-toggle-tree (arg)
|
2008-12-29 06:13:36 +00:00
|
|
|
"Toggle the display of the process listing as process tree.
|
2008-12-28 13:58:10 +00:00
|
|
|
With prefix ARG, display as process tree if ARG is positive, otherwise
|
2008-12-29 06:13:36 +00:00
|
|
|
do not display as process tree. Sets the variable `proced-tree-flag'.
|
|
|
|
|
|
|
|
The process tree is generated from the selected processes in the
|
|
|
|
Proced buffer (that is, the processes in `proced-process-alist').
|
|
|
|
All processes that do not have a parent process in this list
|
|
|
|
according to their ppid attribute become the root of a process tree.
|
|
|
|
Each parent process is followed by its child processes.
|
|
|
|
The process tree inherits the chosen sorting order of the process listing,
|
|
|
|
that is, child processes of the same parent process are sorted using
|
|
|
|
the selected sorting order."
|
2021-10-05 16:16:48 +00:00
|
|
|
(interactive (list (or current-prefix-arg 'toggle)) proced-mode)
|
2008-12-28 13:58:10 +00:00
|
|
|
(setq proced-tree-flag
|
|
|
|
(cond ((eq arg 'toggle) (not proced-tree-flag))
|
|
|
|
(arg (> (prefix-numeric-value arg) 0))
|
|
|
|
(t (not proced-tree-flag))))
|
|
|
|
(proced-update)
|
|
|
|
(message "Proced process tree display %s"
|
|
|
|
(if proced-tree-flag "enabled" "disabled")))
|
|
|
|
|
|
|
|
(defun proced-tree (process-alist)
|
2008-12-29 06:13:36 +00:00
|
|
|
"Rearrange PROCESS-ALIST as process tree.
|
|
|
|
If `proced-tree-flag' is non-nil, rearrange PROCESS-ALIST such that
|
|
|
|
every processes is followed by its child processes. Each process
|
|
|
|
gets a tree attribute that specifies the depth of the process in the tree.
|
|
|
|
A root process is a process with no parent within PROCESS-ALIST according
|
|
|
|
to its value of the ppid attribute. It has depth 0.
|
|
|
|
|
|
|
|
If `proced-tree-flag' is nil, remove the tree attribute.
|
|
|
|
Return the rearranged process list."
|
2008-12-28 13:58:10 +00:00
|
|
|
(if proced-tree-flag
|
|
|
|
;; add tree attribute
|
|
|
|
(let ((process-tree (proced-process-tree process-alist))
|
2009-01-03 12:19:56 +00:00
|
|
|
(proced-tree-depth 0)
|
2008-12-29 06:13:36 +00:00
|
|
|
(proced-temp-alist process-alist)
|
2008-12-28 13:58:10 +00:00
|
|
|
proced-process-tree pt)
|
|
|
|
(while (setq pt (pop process-tree))
|
|
|
|
(proced-tree-insert pt))
|
|
|
|
(nreverse proced-process-tree))
|
2008-12-29 06:13:36 +00:00
|
|
|
;; remove tree attribute
|
|
|
|
(let ((process-alist process-alist))
|
|
|
|
(while process-alist
|
|
|
|
(setcar process-alist
|
|
|
|
(assq-delete-all 'tree (car process-alist)))
|
|
|
|
(pop process-alist)))
|
|
|
|
process-alist))
|
2008-12-28 13:58:10 +00:00
|
|
|
|
|
|
|
(defun proced-tree-insert (process-tree)
|
|
|
|
"Helper function for `proced-tree'."
|
2008-12-29 06:13:36 +00:00
|
|
|
(let ((pprocess (assq (car process-tree) proced-temp-alist)))
|
2008-12-28 13:58:10 +00:00
|
|
|
(push (append (list (car pprocess))
|
2009-01-03 12:19:56 +00:00
|
|
|
(list (cons 'tree proced-tree-depth))
|
2008-12-28 13:58:10 +00:00
|
|
|
(cdr pprocess))
|
|
|
|
proced-process-tree)
|
|
|
|
(if (cdr process-tree)
|
2009-01-03 12:19:56 +00:00
|
|
|
(let ((proced-tree-depth (1+ proced-tree-depth)))
|
2020-10-11 22:21:48 +00:00
|
|
|
(mapc #'proced-tree-insert (cdr process-tree))))))
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
|
2008-09-12 16:59:57 +00:00
|
|
|
;; Refining
|
|
|
|
|
|
|
|
;; Filters are used to select the processes in a new listing.
|
|
|
|
;; Refiners are used to narrow down further (interactively) the processes
|
|
|
|
;; in an existing listing.
|
|
|
|
|
|
|
|
(defun proced-refine (&optional event)
|
|
|
|
"Refine Proced listing by comparing with the attribute value at point.
|
|
|
|
Optional EVENT is the location of the Proced field.
|
|
|
|
|
2008-12-14 17:41:29 +00:00
|
|
|
Refinement is controlled by the REFINER defined for each attribute ATTR
|
|
|
|
in `proced-grammar-alist'.
|
|
|
|
|
2008-12-14 23:16:09 +00:00
|
|
|
If REFINER is a list of flags and point is on a process's value of ATTR,
|
|
|
|
this command compares the value of ATTR of every process with the value
|
|
|
|
of ATTR of the process at the position of point.
|
2008-09-12 16:59:57 +00:00
|
|
|
|
|
|
|
The predicate for the comparison of two ATTR values is defined
|
|
|
|
in `proced-grammar-alist'. For each return value of the predicate
|
2008-12-14 17:41:29 +00:00
|
|
|
a refine flag is defined in `proced-grammar-alist'. One can select
|
|
|
|
processes for which the value of ATTR is \"less than\", \"equal\",
|
|
|
|
and / or \"larger\" than ATTR of the process point is on. A process
|
|
|
|
is included in the new listing if the refine flag for the corresponding
|
|
|
|
return value of the predicate is non-nil.
|
2008-09-12 16:59:57 +00:00
|
|
|
The help-echo string for `proced-refine' uses \"+\" or \"-\" to indicate
|
2008-12-14 17:41:29 +00:00
|
|
|
the current values of these refine flags.
|
|
|
|
|
|
|
|
If REFINER is a cons pair (FUNCTION . HELP-ECHO), FUNCTION is called
|
|
|
|
with one argument, the PID of the process at the position of point.
|
|
|
|
The function must return a list of PIDs that is used for the refined
|
|
|
|
listing. HELP-ECHO is a string that is shown when mouse is over this field.
|
2008-09-12 16:59:57 +00:00
|
|
|
|
2008-12-14 17:41:29 +00:00
|
|
|
This command refines an already existing process listing generated initially
|
|
|
|
based on the value of the variable `proced-filter'. It does not change
|
|
|
|
this variable. It does not revert the listing. If you frequently need
|
|
|
|
a certain refinement, consider defining a new filter in `proced-filter-alist'."
|
2021-10-05 16:16:48 +00:00
|
|
|
(interactive (list last-input-event) proced-mode)
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
(if event (posn-set-point (event-end event)))
|
|
|
|
(let ((key (get-text-property (point) 'proced-key))
|
|
|
|
(pid (get-text-property (point) 'proced-pid)))
|
|
|
|
(if (and key pid)
|
|
|
|
(let* ((grammar (assq key proced-grammar-alist))
|
2008-12-14 17:41:29 +00:00
|
|
|
(refiner (nth 7 grammar)))
|
|
|
|
(when refiner
|
|
|
|
(cond ((functionp (car refiner))
|
|
|
|
(setq proced-process-alist (funcall (car refiner) pid)))
|
|
|
|
((consp refiner)
|
|
|
|
(let ((predicate (nth 4 grammar))
|
|
|
|
(ref (cdr (assq key (cdr (assq pid proced-process-alist)))))
|
|
|
|
val new-alist)
|
|
|
|
(dolist (process proced-process-alist)
|
|
|
|
(setq val (funcall predicate (cdr (assq key (cdr process))) ref))
|
|
|
|
(if (cond ((not val) (nth 2 refiner))
|
|
|
|
((eq val 'equal) (nth 1 refiner))
|
|
|
|
(val (car refiner)))
|
|
|
|
(push process new-alist)))
|
|
|
|
(setq proced-process-alist new-alist))))
|
2008-09-12 16:59:57 +00:00
|
|
|
;; Do not revert listing.
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
(proced-update)))
|
2008-09-12 16:59:57 +00:00
|
|
|
(message "No refiner defined here."))))
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
|
|
|
|
;; Proced predicates for sorting and filtering are based on a three-valued
|
|
|
|
;; logic:
|
2008-09-12 16:59:57 +00:00
|
|
|
;; Predicates take two arguments P1 and P2, the corresponding attribute
|
|
|
|
;; values of two processes. Predicates should return 'equal if P1 has
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
;; same rank like P2. Any other non-nil value says that P1 is "less than" P2,
|
|
|
|
;; or nil if not.
|
|
|
|
|
|
|
|
(defun proced-< (num1 num2)
|
|
|
|
"Return t if NUM1 less than NUM2.
|
|
|
|
Return `equal' if NUM1 equals NUM2. Return nil if NUM1 greater than NUM2."
|
|
|
|
(if (= num1 num2)
|
|
|
|
'equal
|
|
|
|
(< num1 num2)))
|
|
|
|
|
|
|
|
(defun proced-string-lessp (s1 s2)
|
|
|
|
"Return t if string S1 is less than S2 in lexicographic order.
|
|
|
|
Return `equal' if S1 and S2 have identical contents.
|
|
|
|
Return nil otherwise."
|
|
|
|
(if (string= s1 s2)
|
|
|
|
'equal
|
|
|
|
(string-lessp s1 s2)))
|
|
|
|
|
|
|
|
(defun proced-time-lessp (t1 t2)
|
|
|
|
"Return t if time value T1 is less than time value T2.
|
|
|
|
Return `equal' if T1 equals T2. Return nil otherwise."
|
Improve time stamp handling, and be more consistent about it.
This implements a suggestion made in:
http://lists.gnu.org/archive/html/emacs-devel/2014-10/msg00587.html
Among other things, this means timer.el no longer needs to
autoload the time-date module.
* doc/lispref/os.texi (Time of Day, Time Conversion, Time Parsing)
(Processor Run Time, Time Calculations):
Document the new behavior, plus be clearer about the old behavior.
(Idle Timers): Take advantage of new functionality.
* etc/NEWS: Document the changes.
* lisp/allout-widgets.el (allout-elapsed-time-seconds): Doc fix.
* lisp/arc-mode.el (archive-ar-summarize):
* lisp/calendar/time-date.el (seconds-to-time, days-to-time, time-since):
* lisp/emacs-lisp/timer.el (timer-relative-time, timer-event-handler)
(run-at-time, with-timeout-suspend, with-timeout-unsuspend):
* lisp/net/tramp.el (tramp-time-less-p, tramp-time-subtract):
* lisp/proced.el (proced-time-lessp):
* lisp/timezone.el (timezone-time-from-absolute):
* lisp/type-break.el (type-break-schedule, type-break-time-sum):
Simplify by using new functionality.
* lisp/calendar/cal-dst.el (calendar-next-time-zone-transition):
Do not return time values in obsolete and undocumented (HI . LO)
format; use (HI LO) instead.
* lisp/calendar/time-date.el (with-decoded-time-value):
Treat 'nil' as current time. This is mostly for XEmacs.
(encode-time-value, with-decoded-time-value): Obsolete.
(time-add, time-subtract, time-less-p): Use no-op autoloads, for
XEmacs. Define only if XEmacs, as they're now C builtins in Emacs.
* lisp/ldefs-boot.el: Update to match new time-date.el
* lisp/proced.el: Do not require time-date.
* src/editfns.c (invalid_time): New function.
Use it instead of 'error ("Invalid time specification")'.
(time_add, time_subtract, time_arith, Ftime_add, Ftime_less_p)
(decode_float_time, lisp_to_timespec, lisp_time_struct):
New functions.
(make_time_tail, make_time): Remove. All uses changed to use
new functions or plain list4i.
(disassemble_lisp_time): Return effective length if successful.
Check that LOW is an integer, if it's combined with other components.
(decode_time_components): Decode into struct lisp_time, not
struct timespec, so that we can support a wide set of times
regardless of whether time_t is signed. Decode plain numbers
as seconds since the Epoch, and nil as the current time.
(lisp_time_argument, lisp_seconds_argument, Ffloat_time):
Reimplement in terms of new functions.
(Fencode_time): Just use list2i.
(syms_of_editfns): Add time-add, time-subtract, time-less-p.
* src/keyboard.c (decode_timer): Don't allow the new formats (floating
point or nil) in timers.
* src/systime.h (LO_TIME_BITS): New constant. Use it everywhere in
place of the magic number '16'.
(struct lisp_time): New type.
(decode_time_components): Use it.
(lisp_to_timespec): New decl.
2014-11-17 04:38:15 +00:00
|
|
|
(or (time-less-p t1 t2)
|
|
|
|
(if (not (time-less-p t2 t1)) 'equal)))
|
2008-03-26 02:15:28 +00:00
|
|
|
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
;;; Sorting
|
|
|
|
|
2020-10-11 22:21:48 +00:00
|
|
|
(define-obsolete-function-alias 'proced-xor #'xor "27.1")
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
|
|
|
|
(defun proced-sort-p (p1 p2)
|
|
|
|
"Predicate for sorting processes P1 and P2."
|
|
|
|
(if (not (cdr proced-sort-internal))
|
|
|
|
;; only one predicate: fast scheme
|
|
|
|
(let* ((sorter (car proced-sort-internal))
|
|
|
|
(k1 (cdr (assq (car sorter) (cdr p1))))
|
|
|
|
(k2 (cdr (assq (car sorter) (cdr p2)))))
|
|
|
|
;; if the attributes are undefined, we should really abort sorting
|
|
|
|
(if (and k1 k2)
|
2019-07-31 17:45:06 +00:00
|
|
|
(xor (funcall (nth 1 sorter) k1 k2)
|
|
|
|
(nth 2 sorter))))
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
(let ((sort-list proced-sort-internal) sorter predicate k1 k2)
|
|
|
|
(catch 'done
|
|
|
|
(while (setq sorter (pop sort-list))
|
|
|
|
(setq k1 (cdr (assq (car sorter) (cdr p1)))
|
|
|
|
k2 (cdr (assq (car sorter) (cdr p2)))
|
|
|
|
predicate
|
|
|
|
(if (and k1 k2)
|
|
|
|
(funcall (nth 1 sorter) k1 k2)))
|
|
|
|
(if (not (eq predicate 'equal))
|
2019-07-31 17:45:06 +00:00
|
|
|
(throw 'done (xor predicate (nth 2 sorter)))))
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
(eq t predicate)))))
|
|
|
|
|
2008-12-14 17:41:29 +00:00
|
|
|
(defun proced-sort (process-alist sorter descend)
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
"Sort PROCESS-ALIST using scheme SORTER.
|
2008-12-14 17:41:29 +00:00
|
|
|
SORTER is a scheme like `proced-sort'.
|
|
|
|
DESCEND is non-nil if the first element of SORTER is sorted
|
|
|
|
in descending order.
|
2008-09-12 16:59:57 +00:00
|
|
|
Return the sorted process list."
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
;; translate SORTER into a list of lists (KEY PREDICATE REVERSE)
|
|
|
|
(setq proced-sort-internal
|
|
|
|
(mapcar (lambda (arg)
|
|
|
|
(let ((grammar (assq arg proced-grammar-alist)))
|
2008-12-28 13:58:10 +00:00
|
|
|
(unless (nth 4 grammar)
|
|
|
|
(error "Attribute %s not sortable" (car grammar)))
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
(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
|
2008-12-14 17:41:29 +00:00
|
|
|
(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))
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
process-alist))
|
|
|
|
|
2008-12-14 23:16:09 +00:00
|
|
|
(defun proced-sort-interactive (scheme &optional arg)
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
"Sort Proced buffer using SCHEME.
|
|
|
|
When called interactively, an empty string means nil, i.e., no sorting.
|
2008-09-12 16:59:57 +00:00
|
|
|
|
2008-12-14 23:16:09 +00:00
|
|
|
Prefix ARG controls sort order:
|
|
|
|
- If prefix ARG is positive (negative), sort in ascending (descending) order.
|
2015-11-17 23:28:50 +00:00
|
|
|
- If ARG is nil or `no-arg' and SCHEME is equal to the previous sorting scheme,
|
2008-12-14 23:16:09 +00:00
|
|
|
reverse the sorting order.
|
2015-11-17 23:28:50 +00:00
|
|
|
- If ARG is nil or `no-arg' and SCHEME differs from the previous sorting scheme,
|
2008-12-14 23:16:09 +00:00
|
|
|
adopt the sorting order defined for SCHEME in `proced-grammar-alist'.
|
2008-12-14 17:41:29 +00:00
|
|
|
|
2008-09-12 16:59:57 +00:00
|
|
|
Set variable `proced-sort' to SCHEME. The current sort scheme is displayed
|
|
|
|
in the mode line, using \"+\" or \"-\" for ascending or descending order."
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
(interactive
|
2008-12-28 13:58:10 +00:00
|
|
|
(let* (choices
|
|
|
|
(scheme (completing-read "Sort attribute: "
|
|
|
|
(dolist (grammar proced-grammar-alist choices)
|
|
|
|
(if (nth 4 grammar)
|
|
|
|
(push (list (car grammar)) choices)))
|
|
|
|
nil t)))
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
(list (if (string= "" scheme) nil (intern scheme))
|
2008-12-14 23:16:09 +00:00
|
|
|
;; like 'toggle in `define-derived-mode'
|
2021-10-05 16:16:48 +00:00
|
|
|
(or current-prefix-arg 'no-arg)))
|
|
|
|
proced-mode)
|
2008-12-14 23:16:09 +00:00
|
|
|
|
2008-12-14 17:41:29 +00:00
|
|
|
(setq proced-descend
|
2008-12-14 23:16:09 +00:00
|
|
|
;; 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))))
|
2008-12-14 17:41:29 +00:00
|
|
|
proced-sort scheme)
|
2008-12-14 23:16:09 +00:00
|
|
|
(proced-update))
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
|
2008-12-14 23:16:09 +00:00
|
|
|
(defun proced-sort-pcpu (&optional arg)
|
2008-12-14 17:41:29 +00:00
|
|
|
"Sort Proced buffer by percentage CPU time (%CPU).
|
2008-12-14 23:16:09 +00:00
|
|
|
Prefix ARG controls sort order, see `proced-sort-interactive'."
|
2021-10-05 16:16:48 +00:00
|
|
|
(interactive (list (or current-prefix-arg 'no-arg)) proced-mode)
|
2008-12-14 23:16:09 +00:00
|
|
|
(proced-sort-interactive 'pcpu arg))
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
|
2008-12-14 23:16:09 +00:00
|
|
|
(defun proced-sort-pmem (&optional arg)
|
2008-12-14 17:41:29 +00:00
|
|
|
"Sort Proced buffer by percentage memory usage (%MEM).
|
2008-12-14 23:16:09 +00:00
|
|
|
Prefix ARG controls sort order, see `proced-sort-interactive'."
|
2021-10-05 16:16:48 +00:00
|
|
|
(interactive (list (or current-prefix-arg 'no-arg)) proced-mode)
|
2008-12-14 23:16:09 +00:00
|
|
|
(proced-sort-interactive 'pmem arg))
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
|
2008-12-14 23:16:09 +00:00
|
|
|
(defun proced-sort-pid (&optional arg)
|
2008-12-14 17:41:29 +00:00
|
|
|
"Sort Proced buffer by PID.
|
2008-12-14 23:16:09 +00:00
|
|
|
Prefix ARG controls sort order, see `proced-sort-interactive'."
|
2021-10-05 16:16:48 +00:00
|
|
|
(interactive (list (or current-prefix-arg 'no-arg)) proced-mode)
|
2008-12-14 23:16:09 +00:00
|
|
|
(proced-sort-interactive 'pid arg))
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
|
2008-12-14 23:16:09 +00:00
|
|
|
(defun proced-sort-start (&optional arg)
|
2008-12-14 17:41:29 +00:00
|
|
|
"Sort Proced buffer by time the command started (START).
|
2008-12-14 23:16:09 +00:00
|
|
|
Prefix ARG controls sort order, see `proced-sort-interactive'."
|
2021-10-05 16:16:48 +00:00
|
|
|
(interactive (list (or current-prefix-arg 'no-arg)) proced-mode)
|
2008-12-14 23:16:09 +00:00
|
|
|
(proced-sort-interactive 'start arg))
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
|
2008-12-14 23:16:09 +00:00
|
|
|
(defun proced-sort-time (&optional arg)
|
2008-12-14 17:41:29 +00:00
|
|
|
"Sort Proced buffer by CPU time (TIME).
|
2008-12-14 23:16:09 +00:00
|
|
|
Prefix ARG controls sort order, see `proced-sort-interactive'."
|
2021-10-05 16:16:48 +00:00
|
|
|
(interactive (list (or current-prefix-arg 'no-arg)) proced-mode)
|
2008-12-14 23:16:09 +00:00
|
|
|
(proced-sort-interactive 'time arg))
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
|
2008-12-14 23:16:09 +00:00
|
|
|
(defun proced-sort-user (&optional arg)
|
2008-12-14 17:41:29 +00:00
|
|
|
"Sort Proced buffer by USER.
|
2008-12-14 23:16:09 +00:00
|
|
|
Prefix ARG controls sort order, see `proced-sort-interactive'."
|
2021-10-05 16:16:48 +00:00
|
|
|
(interactive (list (or current-prefix-arg 'no-arg)) proced-mode)
|
2008-12-14 23:16:09 +00:00
|
|
|
(proced-sort-interactive 'user arg))
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
|
2008-12-14 23:16:09 +00:00
|
|
|
(defun proced-sort-header (event &optional arg)
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
"Sort Proced listing based on an attribute.
|
|
|
|
EVENT is a mouse event with starting position in the header line.
|
2008-12-19 21:53:25 +00:00
|
|
|
It is converted to the corresponding attribute key.
|
2008-12-14 17:41:29 +00:00
|
|
|
This command updates the variable `proced-sort'.
|
2008-12-14 23:16:09 +00:00
|
|
|
Prefix ARG controls sort order, see `proced-sort-interactive'."
|
2021-10-05 16:16:48 +00:00
|
|
|
(interactive (list last-input-event (or last-prefix-arg 'no-arg)) proced-mode)
|
2021-11-22 17:39:28 +00:00
|
|
|
(let* ((start (event-start event))
|
|
|
|
(obj (posn-object start))
|
|
|
|
col key)
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
(save-selected-window
|
|
|
|
(select-window (posn-window start))
|
2021-11-22 17:39:28 +00:00
|
|
|
(setq col (+ (if obj (cdr obj) (posn-point start))
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
(window-hscroll)))
|
|
|
|
(when (and (<= 0 col) (< col (length proced-header-line)))
|
|
|
|
(setq key (get-text-property col 'proced-key proced-header-line))
|
|
|
|
(if key
|
2008-12-14 23:16:09 +00:00
|
|
|
(proced-sort-interactive key arg)
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
(message "No sorter defined here."))))))
|
|
|
|
|
2011-12-12 05:32:49 +00:00
|
|
|
;;; Formatting
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
|
|
|
|
(defun proced-format-time (time)
|
2008-11-19 08:09:22 +00:00
|
|
|
"Format time interval TIME."
|
New function time-convert
This replaces the awkward reuse of encode-time to both convert
calendrical timestamps to Lisp timestamps, and to convert Lisp
timestamps to other forms. Now, encode-time does just the
former and the new function does just the latter.
The new function builds on a suggestion by Lars Ingebrigtsen in:
https://lists.gnu.org/r/emacs-devel/2019-07/msg00801.html
and refined by Stefan Monnier in:
https://lists.gnu.org/r/emacs-devel/2019-07/msg00803.html
* doc/lispref/os.texi (Time of Day, Time Conversion):
* doc/misc/emacs-mime.texi (time-date):
* etc/NEWS: Update documentation.
* lisp/calendar/cal-dst.el (calendar-next-time-zone-transition):
* lisp/calendar/time-date.el (seconds-to-time, days-to-time):
* lisp/calendar/timeclock.el (timeclock-seconds-to-time):
* lisp/cedet/ede/detect.el (ede-detect-qtest):
* lisp/completion.el (cmpl-hours-since-origin):
* lisp/ecomplete.el (ecomplete-add-item):
* lisp/emacs-lisp/cl-extra.el (cl--random-time):
* lisp/emacs-lisp/timer.el (timer--time-setter)
(timer-next-integral-multiple-of-time):
* lisp/find-lisp.el (find-lisp-format-time):
* lisp/gnus/gnus-diary.el (gnus-user-format-function-d):
* lisp/gnus/gnus-group.el (gnus-group-set-timestamp):
* lisp/gnus/gnus-icalendar.el (gnus-icalendar-show-org-agenda):
* lisp/gnus/nnrss.el (nnrss-normalize-date):
* lisp/gnus/nnspool.el (nnspool-request-newgroups):
* lisp/net/ntlm.el (ntlm-compute-timestamp):
* lisp/net/pop3.el (pop3-uidl-dele):
* lisp/obsolete/vc-arch.el (vc-arch-add-tagline):
* lisp/org/org-clock.el (org-clock-get-clocked-time)
(org-clock-resolve, org-resolve-clocks, org-clock-in)
(org-clock-out, org-clock-sum):
* lisp/org/org-id.el (org-id-uuid, org-id-time-to-b36):
* lisp/org/ox-publish.el (org-publish-cache-ctime-of-src):
* lisp/proced.el (proced-format-time):
* lisp/progmodes/cc-cmds.el (c-progress-init)
(c-progress-update):
* lisp/progmodes/cperl-mode.el (cperl-time-fontification):
* lisp/progmodes/flymake.el (flymake--schedule-timer-maybe):
* lisp/progmodes/vhdl-mode.el (vhdl-update-progress-info)
(vhdl-fix-case-region-1):
* lisp/tar-mode.el (tar-octal-time):
* lisp/time.el (emacs-uptime):
* lisp/url/url-auth.el (url-digest-auth-make-cnonce):
* lisp/url/url-util.el (url-lazy-message):
* lisp/vc/vc-cvs.el (vc-cvs-parse-entry):
* lisp/vc/vc-hg.el (vc-hg-state-fast):
* lisp/xt-mouse.el (xterm-mouse-event):
* test/lisp/emacs-lisp/timer-tests.el:
(timer-next-integral-multiple-of-time-2):
Use time-convert, not encode-time.
* lisp/calendar/icalendar.el (icalendar--decode-isodatetime):
Don’t use now-removed FORM argument for encode-time.
It wasn’t crucial anyway.
* lisp/emacs-lisp/byte-opt.el (side-effect-free-fns): Add time-convert.
* lisp/emacs-lisp/elint.el (elint-unknown-builtin-args):
Update encode-time signature to match current arg set.
* lisp/emacs-lisp/timer.el (timer-next-integral-multiple-of-time):
Use timer-convert with t rather than doing it by hand.
* src/timefns.c (time_hz_ticks, time_form_stamp, lisp_time_form_stamp):
Remove; no longer needed.
(decode_lisp_time): Rturn the form instead of having a *PFORM arg.
All uses changed.
(time_arith): Just return TICKS if HZ is 1.
(Fencode_time): Remove argument FORM. All callers changed.
Do not attempt to encode time values; just encode
decoded (calendrical) times.
Unless CURRENT_TIME_LIST, just return VALUE since HZ is 1.
(Ftime_convert): New function, which does the time value
conversion that bleeding-edge encode-time formerly did.
Return TIME if it is easy to see that it is already
of the correct form.
(Fcurrent_time): Mention in doc that the form is planned to change.
* test/src/timefns-tests.el (decode-then-encode-time):
Don’t use (encode-time nil).
2019-08-06 00:38:52 +00:00
|
|
|
(let* ((ftime (time-convert time 'integer))
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
(days (truncate ftime 86400))
|
|
|
|
(ftime (mod ftime 86400))
|
|
|
|
(hours (truncate ftime 3600))
|
|
|
|
(ftime (mod ftime 3600))
|
|
|
|
(minutes (truncate ftime 60))
|
Add colors to Proced (bug#59407)
Add a new custom variable proced-enable-color-flag which when set to a
non-nil value (defaults to nil), will prompt some format functions to
furnish their respective process attributes with colors and effects in
order to make them easier to distinguish and highlight possible issues
(e.g. high memory usage), in a manner similar to htop.
In particular, the current Emacs process id is highlighted purple in
both the process id and parent process id columns, session leaders
have their process ids underlined, larger memory sizes for rss
are highlighted in darker shades of orange, and the first word in the
args property (the executable) is highlighted in blue.
* lisp/proced.el (proced-grammar-alist): Update to use the new format
functions.
(proced-low-memory-usage-threshold): New custom variable to determine
whether a value represents 'low' memory usage, used only in
proced-format-memory for coloring.
(proced-medium-memory-usage-threshold): New custom variable to
determine whether a value represents 'medium' memory usage, used only
in proced-format-memory for coloring.
(proced-enable-color-flag): New custom variable to toggle coloring.
(proced-run-status-code, proced-interruptible-sleep-status-code)
(proced-uninterruptible-sleep-status-code, proced-executable)
(proced-executable, proced-memory-gb, proced-memory-mb)
(proced-memory-default, proced-pid, proced-ppid, proced-pgrp)
(proced-sess, proced-cpu, proced-mem, proced-user, proced-time-colon):
New faces.
(proced-format-time): Edit function to color colons using
proced-time-colon.
(proced-format-args): Edit function to color executables using
proced-executable.
(proced-format-state): New function to color states.
(proced-format-pid): New function to color process ids.
(proced-format-ppid): New function to color parent process ids.
(proced-format-pgrp): New function to color process group ids.
(proced-format-sess): New function to color process session leader
ids.
(proced-format-cpu): New function to color cpu utilization.
(proced-format-mem): New function to color memory utilization.
(proced-format-user): New function to color the user a process
belongs to.
2022-11-16 14:32:44 +00:00
|
|
|
(seconds (mod ftime 60))
|
|
|
|
(colon (if proced-enable-color-flag
|
|
|
|
(propertize ":" 'font-lock-face 'proced-time-colon)
|
|
|
|
":")))
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
(cond ((< 0 days)
|
2022-12-01 18:15:52 +00:00
|
|
|
(format "%d-%02d%s%02d%s%02d" days hours colon minutes colon seconds))
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
((< 0 hours)
|
2022-12-01 18:15:52 +00:00
|
|
|
(format "%02d%s%02d%s%02d" hours colon minutes colon seconds))
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
(t
|
Add colors to Proced (bug#59407)
Add a new custom variable proced-enable-color-flag which when set to a
non-nil value (defaults to nil), will prompt some format functions to
furnish their respective process attributes with colors and effects in
order to make them easier to distinguish and highlight possible issues
(e.g. high memory usage), in a manner similar to htop.
In particular, the current Emacs process id is highlighted purple in
both the process id and parent process id columns, session leaders
have their process ids underlined, larger memory sizes for rss
are highlighted in darker shades of orange, and the first word in the
args property (the executable) is highlighted in blue.
* lisp/proced.el (proced-grammar-alist): Update to use the new format
functions.
(proced-low-memory-usage-threshold): New custom variable to determine
whether a value represents 'low' memory usage, used only in
proced-format-memory for coloring.
(proced-medium-memory-usage-threshold): New custom variable to
determine whether a value represents 'medium' memory usage, used only
in proced-format-memory for coloring.
(proced-enable-color-flag): New custom variable to toggle coloring.
(proced-run-status-code, proced-interruptible-sleep-status-code)
(proced-uninterruptible-sleep-status-code, proced-executable)
(proced-executable, proced-memory-gb, proced-memory-mb)
(proced-memory-default, proced-pid, proced-ppid, proced-pgrp)
(proced-sess, proced-cpu, proced-mem, proced-user, proced-time-colon):
New faces.
(proced-format-time): Edit function to color colons using
proced-time-colon.
(proced-format-args): Edit function to color executables using
proced-executable.
(proced-format-state): New function to color states.
(proced-format-pid): New function to color process ids.
(proced-format-ppid): New function to color parent process ids.
(proced-format-pgrp): New function to color process group ids.
(proced-format-sess): New function to color process session leader
ids.
(proced-format-cpu): New function to color cpu utilization.
(proced-format-mem): New function to color memory utilization.
(proced-format-user): New function to color the user a process
belongs to.
2022-11-16 14:32:44 +00:00
|
|
|
(format "%02d%s%02d" minutes colon seconds)))))
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
|
|
|
|
(defun proced-format-start (start)
|
|
|
|
"Format time START.
|
|
|
|
The return string is always 6 characters wide."
|
|
|
|
(let ((d-start (decode-time start))
|
Add colors to Proced (bug#59407)
Add a new custom variable proced-enable-color-flag which when set to a
non-nil value (defaults to nil), will prompt some format functions to
furnish their respective process attributes with colors and effects in
order to make them easier to distinguish and highlight possible issues
(e.g. high memory usage), in a manner similar to htop.
In particular, the current Emacs process id is highlighted purple in
both the process id and parent process id columns, session leaders
have their process ids underlined, larger memory sizes for rss
are highlighted in darker shades of orange, and the first word in the
args property (the executable) is highlighted in blue.
* lisp/proced.el (proced-grammar-alist): Update to use the new format
functions.
(proced-low-memory-usage-threshold): New custom variable to determine
whether a value represents 'low' memory usage, used only in
proced-format-memory for coloring.
(proced-medium-memory-usage-threshold): New custom variable to
determine whether a value represents 'medium' memory usage, used only
in proced-format-memory for coloring.
(proced-enable-color-flag): New custom variable to toggle coloring.
(proced-run-status-code, proced-interruptible-sleep-status-code)
(proced-uninterruptible-sleep-status-code, proced-executable)
(proced-executable, proced-memory-gb, proced-memory-mb)
(proced-memory-default, proced-pid, proced-ppid, proced-pgrp)
(proced-sess, proced-cpu, proced-mem, proced-user, proced-time-colon):
New faces.
(proced-format-time): Edit function to color colons using
proced-time-colon.
(proced-format-args): Edit function to color executables using
proced-executable.
(proced-format-state): New function to color states.
(proced-format-pid): New function to color process ids.
(proced-format-ppid): New function to color parent process ids.
(proced-format-pgrp): New function to color process group ids.
(proced-format-sess): New function to color process session leader
ids.
(proced-format-cpu): New function to color cpu utilization.
(proced-format-mem): New function to color memory utilization.
(proced-format-user): New function to color the user a process
belongs to.
2022-11-16 14:32:44 +00:00
|
|
|
(d-current (decode-time))
|
|
|
|
(colon (if proced-enable-color-flag
|
|
|
|
(propertize ":" 'font-lock-face 'proced-time-colon)
|
|
|
|
":")))
|
2019-07-30 11:02:41 +00:00
|
|
|
(cond (;; process started in previous years
|
|
|
|
(< (decoded-time-year d-start) (decoded-time-year d-current))
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
(format-time-string " %Y" start))
|
|
|
|
;; process started today
|
2019-07-30 11:02:41 +00:00
|
|
|
((and (= (decoded-time-day d-start) (decoded-time-day d-current))
|
|
|
|
(= (decoded-time-month d-start) (decoded-time-month d-current)))
|
Add colors to Proced (bug#59407)
Add a new custom variable proced-enable-color-flag which when set to a
non-nil value (defaults to nil), will prompt some format functions to
furnish their respective process attributes with colors and effects in
order to make them easier to distinguish and highlight possible issues
(e.g. high memory usage), in a manner similar to htop.
In particular, the current Emacs process id is highlighted purple in
both the process id and parent process id columns, session leaders
have their process ids underlined, larger memory sizes for rss
are highlighted in darker shades of orange, and the first word in the
args property (the executable) is highlighted in blue.
* lisp/proced.el (proced-grammar-alist): Update to use the new format
functions.
(proced-low-memory-usage-threshold): New custom variable to determine
whether a value represents 'low' memory usage, used only in
proced-format-memory for coloring.
(proced-medium-memory-usage-threshold): New custom variable to
determine whether a value represents 'medium' memory usage, used only
in proced-format-memory for coloring.
(proced-enable-color-flag): New custom variable to toggle coloring.
(proced-run-status-code, proced-interruptible-sleep-status-code)
(proced-uninterruptible-sleep-status-code, proced-executable)
(proced-executable, proced-memory-gb, proced-memory-mb)
(proced-memory-default, proced-pid, proced-ppid, proced-pgrp)
(proced-sess, proced-cpu, proced-mem, proced-user, proced-time-colon):
New faces.
(proced-format-time): Edit function to color colons using
proced-time-colon.
(proced-format-args): Edit function to color executables using
proced-executable.
(proced-format-state): New function to color states.
(proced-format-pid): New function to color process ids.
(proced-format-ppid): New function to color parent process ids.
(proced-format-pgrp): New function to color process group ids.
(proced-format-sess): New function to color process session leader
ids.
(proced-format-cpu): New function to color cpu utilization.
(proced-format-mem): New function to color memory utilization.
(proced-format-user): New function to color the user a process
belongs to.
2022-11-16 14:32:44 +00:00
|
|
|
(string-replace ":" colon (format-time-string " %H:%M" start)))
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
(t ;; process started this year
|
|
|
|
(format-time-string "%b %e" start)))))
|
|
|
|
|
|
|
|
(defun proced-format-ttname (ttname)
|
2008-09-12 16:59:57 +00:00
|
|
|
"Format attribute TTNAME, omitting path \"/dev/\"."
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
;; Does this work for all systems?
|
2008-09-12 16:59:57 +00:00
|
|
|
(substring ttname (if (string-match "\\`/dev/" ttname)
|
|
|
|
(match-end 0) 0)))
|
|
|
|
|
2008-12-28 13:58:10 +00:00
|
|
|
(defun proced-format-tree (tree)
|
|
|
|
"Format attribute TREE."
|
|
|
|
(concat (make-string tree ?\s) (number-to-string tree)))
|
|
|
|
|
2008-12-14 17:41:29 +00:00
|
|
|
;; Proced assumes that every process occupies only one line in the listing.
|
2008-09-12 16:59:57 +00:00
|
|
|
(defun proced-format-args (args)
|
|
|
|
"Format attribute ARGS.
|
|
|
|
Replace newline characters by \"^J\" (two characters)."
|
Add colors to Proced (bug#59407)
Add a new custom variable proced-enable-color-flag which when set to a
non-nil value (defaults to nil), will prompt some format functions to
furnish their respective process attributes with colors and effects in
order to make them easier to distinguish and highlight possible issues
(e.g. high memory usage), in a manner similar to htop.
In particular, the current Emacs process id is highlighted purple in
both the process id and parent process id columns, session leaders
have their process ids underlined, larger memory sizes for rss
are highlighted in darker shades of orange, and the first word in the
args property (the executable) is highlighted in blue.
* lisp/proced.el (proced-grammar-alist): Update to use the new format
functions.
(proced-low-memory-usage-threshold): New custom variable to determine
whether a value represents 'low' memory usage, used only in
proced-format-memory for coloring.
(proced-medium-memory-usage-threshold): New custom variable to
determine whether a value represents 'medium' memory usage, used only
in proced-format-memory for coloring.
(proced-enable-color-flag): New custom variable to toggle coloring.
(proced-run-status-code, proced-interruptible-sleep-status-code)
(proced-uninterruptible-sleep-status-code, proced-executable)
(proced-executable, proced-memory-gb, proced-memory-mb)
(proced-memory-default, proced-pid, proced-ppid, proced-pgrp)
(proced-sess, proced-cpu, proced-mem, proced-user, proced-time-colon):
New faces.
(proced-format-time): Edit function to color colons using
proced-time-colon.
(proced-format-args): Edit function to color executables using
proced-executable.
(proced-format-state): New function to color states.
(proced-format-pid): New function to color process ids.
(proced-format-ppid): New function to color parent process ids.
(proced-format-pgrp): New function to color process group ids.
(proced-format-sess): New function to color process session leader
ids.
(proced-format-cpu): New function to color cpu utilization.
(proced-format-mem): New function to color memory utilization.
(proced-format-user): New function to color the user a process
belongs to.
2022-11-16 14:32:44 +00:00
|
|
|
(string-replace "\n" "^J"
|
|
|
|
(pcase-let* ((`(,exe . ,rest) (split-string args))
|
|
|
|
(exe-prop (if proced-enable-color-flag
|
|
|
|
(propertize exe 'font-lock-face 'proced-executable)
|
|
|
|
exe)))
|
|
|
|
(mapconcat #'identity (cons exe-prop rest) " "))))
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
|
2022-11-13 19:53:17 +00:00
|
|
|
(defun proced-format-memory (kilobytes)
|
|
|
|
"Format KILOBYTES in a human readable format."
|
|
|
|
(funcall byte-count-to-string-function (* 1024 kilobytes)))
|
|
|
|
|
Add colors to Proced (bug#59407)
Add a new custom variable proced-enable-color-flag which when set to a
non-nil value (defaults to nil), will prompt some format functions to
furnish their respective process attributes with colors and effects in
order to make them easier to distinguish and highlight possible issues
(e.g. high memory usage), in a manner similar to htop.
In particular, the current Emacs process id is highlighted purple in
both the process id and parent process id columns, session leaders
have their process ids underlined, larger memory sizes for rss
are highlighted in darker shades of orange, and the first word in the
args property (the executable) is highlighted in blue.
* lisp/proced.el (proced-grammar-alist): Update to use the new format
functions.
(proced-low-memory-usage-threshold): New custom variable to determine
whether a value represents 'low' memory usage, used only in
proced-format-memory for coloring.
(proced-medium-memory-usage-threshold): New custom variable to
determine whether a value represents 'medium' memory usage, used only
in proced-format-memory for coloring.
(proced-enable-color-flag): New custom variable to toggle coloring.
(proced-run-status-code, proced-interruptible-sleep-status-code)
(proced-uninterruptible-sleep-status-code, proced-executable)
(proced-executable, proced-memory-gb, proced-memory-mb)
(proced-memory-default, proced-pid, proced-ppid, proced-pgrp)
(proced-sess, proced-cpu, proced-mem, proced-user, proced-time-colon):
New faces.
(proced-format-time): Edit function to color colons using
proced-time-colon.
(proced-format-args): Edit function to color executables using
proced-executable.
(proced-format-state): New function to color states.
(proced-format-pid): New function to color process ids.
(proced-format-ppid): New function to color parent process ids.
(proced-format-pgrp): New function to color process group ids.
(proced-format-sess): New function to color process session leader
ids.
(proced-format-cpu): New function to color cpu utilization.
(proced-format-mem): New function to color memory utilization.
(proced-format-user): New function to color the user a process
belongs to.
2022-11-16 14:32:44 +00:00
|
|
|
(defun proced-format-rss (kilobytes)
|
|
|
|
"Format RSS KILOBYTES in a human readable format."
|
|
|
|
(let ((formatted (proced-format-memory kilobytes)))
|
|
|
|
(if-let* ((proced-enable-color-flag)
|
|
|
|
(total (car (memory-info)))
|
|
|
|
(proportion (/ (float kilobytes) total)))
|
|
|
|
(cond ((< proportion proced-low-memory-usage-threshold)
|
|
|
|
(propertize formatted 'font-lock-face 'proced-memory-low-usage))
|
|
|
|
((< proportion proced-medium-memory-usage-threshold)
|
|
|
|
(propertize formatted 'font-lock-face 'proced-memory-medium-usage))
|
|
|
|
(t (propertize formatted 'font-lock-face 'proced-memory-high-usage)))
|
|
|
|
formatted)))
|
|
|
|
|
|
|
|
(defun proced-format-state (state)
|
|
|
|
"Format STATE."
|
|
|
|
(cond ((and proced-enable-color-flag (string= state "R"))
|
|
|
|
(propertize state 'font-lock-face 'proced-run-status-code))
|
|
|
|
((and proced-enable-color-flag (string= state "S"))
|
|
|
|
(propertize state 'font-lock-face 'proced-interruptible-sleep-status-code))
|
|
|
|
((and proced-enable-color-flag (string= state "D"))
|
|
|
|
(propertize state 'font-lock-face 'proced-uninterruptible-sleep-status-code))
|
|
|
|
(t state)))
|
|
|
|
|
|
|
|
(defun proced-format-pid (pid)
|
|
|
|
"Format PID."
|
|
|
|
(let ((proc-info (process-attributes pid))
|
|
|
|
(pid-s (number-to-string pid)))
|
|
|
|
(cond ((and proced-enable-color-flag
|
|
|
|
(not (file-remote-p default-directory))
|
|
|
|
(equal pid (emacs-pid)))
|
|
|
|
(propertize pid-s 'font-lock-face 'proced-emacs-pid))
|
|
|
|
((and proced-enable-color-flag (equal pid (alist-get 'sess proc-info)))
|
|
|
|
(propertize pid-s 'font-lock-face 'proced-session-leader-pid))
|
|
|
|
(proced-enable-color-flag
|
|
|
|
(propertize pid-s 'font-lock-face 'proced-pid))
|
|
|
|
(t pid-s))))
|
|
|
|
|
|
|
|
(defun proced-format-ppid (ppid)
|
|
|
|
"Format PPID."
|
|
|
|
(let ((ppid-s (number-to-string ppid)))
|
|
|
|
(cond ((and proced-enable-color-flag
|
|
|
|
(not (file-remote-p default-directory))
|
|
|
|
(= ppid (emacs-pid)))
|
|
|
|
(propertize ppid-s 'font-lock-face 'proced-emacs-pid))
|
|
|
|
(proced-enable-color-flag
|
|
|
|
(propertize ppid-s 'font-lock-face 'proced-ppid))
|
|
|
|
(t ppid-s))))
|
|
|
|
|
|
|
|
(defun proced-format-pgrp (pgrp)
|
|
|
|
"Format PGRP."
|
|
|
|
(if proced-enable-color-flag
|
|
|
|
(propertize (number-to-string pgrp) 'font-lock-face 'proced-pgrp)
|
|
|
|
(number-to-string pgrp)))
|
|
|
|
|
|
|
|
(defun proced-format-sess (sess)
|
|
|
|
"Format SESS."
|
|
|
|
(if proced-enable-color-flag
|
|
|
|
(propertize (number-to-string sess) 'font-lock-face 'proced-sess)
|
|
|
|
(number-to-string sess)))
|
|
|
|
|
|
|
|
(defun proced-format-cpu (cpu)
|
|
|
|
"Format CPU."
|
|
|
|
(let ((formatted (format "%.1f" cpu)))
|
|
|
|
(if proced-enable-color-flag
|
|
|
|
(propertize formatted 'font-lock-face 'proced-cpu)
|
|
|
|
formatted)))
|
|
|
|
|
|
|
|
(defun proced-format-mem (mem)
|
|
|
|
"Format MEM."
|
|
|
|
(let ((formatted (format "%.1f" mem)))
|
|
|
|
(if proced-enable-color-flag
|
|
|
|
(propertize formatted 'font-lock-face 'proced-mem)
|
|
|
|
formatted)))
|
|
|
|
|
|
|
|
(defun proced-format-user (user)
|
|
|
|
"Format USER."
|
|
|
|
(if proced-enable-color-flag
|
|
|
|
(propertize user 'font-lock-face 'proced-user)
|
|
|
|
user))
|
|
|
|
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
(defun proced-format (process-alist format)
|
|
|
|
"Display PROCESS-ALIST using FORMAT."
|
|
|
|
(if (symbolp format)
|
|
|
|
(setq format (cdr (assq format proced-format-alist))))
|
2008-12-14 17:41:29 +00:00
|
|
|
|
|
|
|
;; Not all systems give us all attributes. We take `emacs-pid' as a
|
|
|
|
;; representative process PID. If FORMAT contains a list of alternative
|
|
|
|
;; attributes, we take the first attribute that is non-nil for `emacs-pid'.
|
|
|
|
;; If none of the alternatives is non-nil, the attribute is ignored
|
|
|
|
;; in the listing.
|
|
|
|
(let ((standard-attributes
|
2022-04-05 15:08:03 +00:00
|
|
|
(car (proced-process-attributes (list-system-processes))))
|
2008-12-14 17:41:29 +00:00
|
|
|
new-format fmi)
|
2009-01-03 12:19:56 +00:00
|
|
|
(if (and proced-tree-flag
|
|
|
|
(assq 'ppid standard-attributes))
|
|
|
|
(push (cons 'tree 0) standard-attributes))
|
2008-12-14 17:41:29 +00:00
|
|
|
(dolist (fmt format)
|
|
|
|
(if (symbolp fmt)
|
|
|
|
(if (assq fmt standard-attributes)
|
|
|
|
(push fmt new-format))
|
|
|
|
(while (setq fmi (pop fmt))
|
|
|
|
(when (assq fmi standard-attributes)
|
|
|
|
(push fmi new-format)
|
|
|
|
(setq fmt nil)))))
|
|
|
|
(setq format (nreverse new-format)))
|
|
|
|
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
(insert (make-string (length process-alist) ?\n))
|
2008-12-14 17:41:29 +00:00
|
|
|
(let ((whitespace " ") (unknown "?")
|
|
|
|
(sort-key (if (consp proced-sort) (car proced-sort) proced-sort))
|
|
|
|
header-list grammar)
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
;; Loop over all attributes
|
2008-12-14 17:41:29 +00:00
|
|
|
(while (setq grammar (assq (pop format) proced-grammar-alist))
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
(let* ((key (car grammar))
|
2020-10-11 22:21:48 +00:00
|
|
|
(nth2grm (nth 2 grammar))
|
|
|
|
(fun (cond ((stringp nth2grm)
|
|
|
|
(lambda (arg) (format nth2grm arg)))
|
|
|
|
((not nth2grm) #'identity)
|
|
|
|
(t nth2grm)))
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
(whitespace (if format whitespace ""))
|
|
|
|
;; Text properties:
|
|
|
|
;; We use the text property `proced-key' to store in each
|
|
|
|
;; field the corresponding key.
|
|
|
|
;; Of course, the sort predicate appearing in help-echo
|
|
|
|
;; is only part of the story. But it gives the main idea.
|
2008-12-28 13:58:10 +00:00
|
|
|
(hprops
|
|
|
|
(if (nth 4 grammar)
|
|
|
|
(let ((descend (if (eq key sort-key) proced-descend (nth 5 grammar))))
|
2017-08-13 14:56:31 +00:00
|
|
|
`(proced-key ,key mouse-face header-line-highlight
|
2008-12-28 13:58:10 +00:00
|
|
|
help-echo ,(format proced-header-help-echo
|
|
|
|
(if descend "-" "+")
|
|
|
|
(nth 1 grammar)
|
|
|
|
(if descend "descending" "ascending"))))))
|
2008-12-14 17:41:29 +00:00
|
|
|
(refiner (nth 7 grammar))
|
|
|
|
(fprops
|
|
|
|
(cond ((functionp (car refiner))
|
|
|
|
`(proced-key ,key mouse-face highlight
|
|
|
|
help-echo ,(format "mouse-2, RET: %s"
|
2009-01-03 12:19:56 +00:00
|
|
|
(nth 1 refiner))))
|
2008-12-14 17:41:29 +00:00
|
|
|
((consp refiner)
|
|
|
|
`(proced-key ,key mouse-face highlight
|
|
|
|
help-echo ,(format "mouse-2, RET: refine by attribute %s %s"
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
(nth 1 grammar)
|
|
|
|
(mapconcat (lambda (s)
|
|
|
|
(if s "+" "-"))
|
2008-12-14 17:41:29 +00:00
|
|
|
refiner ""))))))
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
value)
|
|
|
|
|
2008-09-12 16:59:57 +00:00
|
|
|
;; highlight the header of the sort column
|
2008-12-14 17:41:29 +00:00
|
|
|
(if (eq key sort-key)
|
2008-09-14 16:44:44 +00:00
|
|
|
(setq hprops (append '(face proced-sort-header) hprops)))
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
(goto-char (point-min))
|
|
|
|
(cond ( ;; fixed width of output field
|
|
|
|
(numberp (nth 3 grammar))
|
|
|
|
(dolist (process process-alist)
|
|
|
|
(end-of-line)
|
|
|
|
(setq value (cdr (assq key (cdr process))))
|
|
|
|
(insert (if value
|
2020-10-11 22:21:48 +00:00
|
|
|
(apply #'propertize (funcall fun value) fprops)
|
2008-12-14 17:41:29 +00:00
|
|
|
(format (concat "%" (number-to-string (nth 3 grammar)) "s")
|
|
|
|
unknown))
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
whitespace)
|
|
|
|
(forward-line))
|
|
|
|
(push (format (concat "%" (number-to-string (nth 3 grammar)) "s")
|
2020-10-11 22:21:48 +00:00
|
|
|
(apply #'propertize (nth 1 grammar) hprops))
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
header-list))
|
|
|
|
|
|
|
|
( ;; last field left-justified
|
|
|
|
(and (not format) (eq 'left (nth 3 grammar)))
|
|
|
|
(dolist (process process-alist)
|
|
|
|
(end-of-line)
|
|
|
|
(setq value (cdr (assq key (cdr process))))
|
2020-10-11 22:21:48 +00:00
|
|
|
(insert (if value (apply #'propertize (funcall fun value) fprops)
|
2008-12-14 17:41:29 +00:00
|
|
|
unknown))
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
(forward-line))
|
2020-10-11 22:21:48 +00:00
|
|
|
(push (apply #'propertize (nth 1 grammar) hprops) header-list))
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
|
|
|
|
(t ;; calculated field width
|
|
|
|
(let ((width (length (nth 1 grammar)))
|
|
|
|
field-list value)
|
|
|
|
(dolist (process process-alist)
|
|
|
|
(setq value (cdr (assq key (cdr process))))
|
|
|
|
(if value
|
2020-10-11 22:21:48 +00:00
|
|
|
(setq value (apply #'propertize (funcall fun value) fprops)
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
width (max width (length value))
|
|
|
|
field-list (cons value field-list))
|
2008-12-14 17:41:29 +00:00
|
|
|
(push unknown field-list)
|
|
|
|
(setq width (max width (length unknown)))))
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
(let ((afmt (concat "%" (if (eq 'left (nth 3 grammar)) "-" "")
|
|
|
|
(number-to-string width) "s")))
|
2020-10-11 22:21:48 +00:00
|
|
|
(push (format afmt (apply #'propertize (nth 1 grammar) hprops))
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
header-list)
|
|
|
|
(dolist (value (nreverse field-list))
|
|
|
|
(end-of-line)
|
|
|
|
(insert (format afmt value) whitespace)
|
|
|
|
(forward-line))))))))
|
|
|
|
|
|
|
|
;; final cleanup
|
|
|
|
(goto-char (point-min))
|
|
|
|
(dolist (process process-alist)
|
|
|
|
;; We use the text property `proced-pid' to store in each line
|
|
|
|
;; the corresponding pid
|
|
|
|
(put-text-property (point) (line-end-position) 'proced-pid (car process))
|
|
|
|
(forward-line))
|
|
|
|
;; Set header line
|
|
|
|
(setq proced-header-line
|
2020-10-11 22:21:48 +00:00
|
|
|
(mapconcat #'identity (nreverse header-list) whitespace))
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
(if (string-match "[ \t]+$" proced-header-line)
|
|
|
|
(setq proced-header-line (substring proced-header-line 0
|
|
|
|
(match-beginning 0))))
|
|
|
|
;; (delete-trailing-whitespace)
|
|
|
|
(goto-char (point-min))
|
|
|
|
(while (re-search-forward "[ \t\r]+$" nil t)
|
|
|
|
(delete-region (match-beginning 0) (match-end 0)))))
|
2008-05-21 08:00:05 +00:00
|
|
|
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
(defun proced-format-interactive (scheme &optional revert)
|
|
|
|
"Format Proced buffer using SCHEME.
|
|
|
|
When called interactively, an empty string means nil, i.e., no formatting.
|
2008-09-12 16:59:57 +00:00
|
|
|
Set variable `proced-format' to SCHEME.
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
With prefix REVERT non-nil revert listing."
|
|
|
|
(interactive
|
|
|
|
(let ((scheme (completing-read "Format: "
|
|
|
|
proced-format-alist nil t)))
|
|
|
|
(list (if (string= "" scheme) nil (intern scheme))
|
2021-10-05 16:16:48 +00:00
|
|
|
current-prefix-arg))
|
|
|
|
proced-mode)
|
2008-09-14 16:44:44 +00:00
|
|
|
;; only update if necessary
|
|
|
|
(when (or (not (eq proced-format scheme)) revert)
|
|
|
|
(setq proced-format scheme)
|
|
|
|
(proced-update revert)))
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
|
|
|
|
;; generate listing
|
|
|
|
|
2008-12-14 17:41:29 +00:00
|
|
|
(defun proced-process-attributes (&optional pid-list)
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
"Return alist of attributes for each system process.
|
2008-12-14 17:41:29 +00:00
|
|
|
This alist can be customized via `proced-custom-attributes'.
|
|
|
|
Optional arg PID-LIST is a list of PIDs of system process that are analyzed.
|
|
|
|
If no attributes are known for a process (possibly because it already died)
|
|
|
|
the process is ignored."
|
|
|
|
;; Should we make it customizable whether processes with empty attribute
|
|
|
|
;; lists are ignored? When would such processes be of interest?
|
2009-01-03 12:19:56 +00:00
|
|
|
(let (process-alist attributes attr)
|
2008-12-14 17:41:29 +00:00
|
|
|
(dolist (pid (or pid-list (list-system-processes)) process-alist)
|
2009-02-23 05:06:36 +00:00
|
|
|
(when (setq attributes (process-attributes pid))
|
2009-01-03 12:19:56 +00:00
|
|
|
(setq attributes (cons (cons 'pid pid) attributes))
|
|
|
|
(dolist (fun proced-custom-attributes)
|
|
|
|
(if (setq attr (funcall fun attributes))
|
|
|
|
(push attr attributes)))
|
|
|
|
(push (cons pid attributes) process-alist)))))
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
|
|
|
|
(defun proced-update (&optional revert quiet)
|
2008-12-19 21:53:25 +00:00
|
|
|
"Update the Proced process information. Preserves point and marks.
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
With prefix REVERT non-nil, revert listing.
|
2009-01-03 12:19:56 +00:00
|
|
|
Suppress status information if QUIET is nil.
|
|
|
|
After updating a displayed Proced buffer run the normal hook
|
|
|
|
`proced-post-display-hook'."
|
2008-04-14 01:35:56 +00:00
|
|
|
;; This is the main function that generates and updates the process listing.
|
2021-10-05 16:16:48 +00:00
|
|
|
(interactive "P" proced-mode)
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
(setq revert (or revert (not proced-process-alist)))
|
|
|
|
(or quiet (message (if revert "Updating process information..."
|
|
|
|
"Updating process display...")))
|
2008-09-12 16:59:57 +00:00
|
|
|
(if revert ;; evaluate all processes
|
|
|
|
(setq proced-process-alist (proced-process-attributes)))
|
|
|
|
;; filtering and sorting
|
|
|
|
(setq proced-process-alist
|
2008-12-14 17:41:29 +00:00
|
|
|
(proced-sort (proced-filter proced-process-alist proced-filter)
|
|
|
|
proced-sort proced-descend))
|
2008-09-12 16:59:57 +00:00
|
|
|
|
2008-12-28 13:58:10 +00:00
|
|
|
;; display as process tree?
|
|
|
|
(setq proced-process-alist
|
|
|
|
(proced-tree proced-process-alist))
|
|
|
|
|
2008-09-12 16:59:57 +00:00
|
|
|
;; It is useless to keep undo information if we revert, filter, or
|
|
|
|
;; refine the listing so that `proced-process-alist' has changed.
|
|
|
|
;; We could keep the undo information if we only re-sort the buffer.
|
|
|
|
;; Would that be useful? Re-re-sorting is easy, too.
|
|
|
|
(if (consp buffer-undo-list)
|
|
|
|
(setq buffer-undo-list nil))
|
|
|
|
(let ((buffer-undo-list t)
|
|
|
|
;; If point is on a field, we try to return point to that field.
|
|
|
|
;; Otherwise we try to return to the same column
|
|
|
|
(old-pos (let ((pid (proced-pid-at-point))
|
|
|
|
(key (get-text-property (point) 'proced-key)))
|
|
|
|
(list pid key ; can both be nil
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
(if key
|
|
|
|
(if (get-text-property (1- (point)) 'proced-key)
|
|
|
|
(- (point) (previous-single-property-change
|
|
|
|
(point) 'proced-key))
|
|
|
|
0)
|
|
|
|
(current-column)))))
|
|
|
|
buffer-read-only mp-list)
|
2008-03-26 02:15:28 +00:00
|
|
|
;; remember marked processes (whatever the mark was)
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
(goto-char (point-min))
|
|
|
|
(while (re-search-forward "^\\(\\S-\\)" nil t)
|
|
|
|
(push (cons (save-match-data (proced-pid-at-point))
|
2008-05-20 10:17:15 +00:00
|
|
|
(match-string-no-properties 1)) mp-list))
|
2008-09-12 16:59:57 +00:00
|
|
|
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
;; generate listing
|
2008-03-26 02:15:28 +00:00
|
|
|
(erase-buffer)
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
(proced-format proced-process-alist proced-format)
|
2008-03-26 02:15:28 +00:00
|
|
|
(goto-char (point-min))
|
|
|
|
(while (not (eobp))
|
|
|
|
(insert " ")
|
|
|
|
(forward-line))
|
2011-07-20 09:53:51 +00:00
|
|
|
(setq proced-header-line (concat " " proced-header-line))
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
(if revert (set-buffer-modified-p nil))
|
2008-09-12 16:59:57 +00:00
|
|
|
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
;; set `goal-column'
|
|
|
|
(let ((grammar (assq proced-goal-attribute proced-grammar-alist)))
|
|
|
|
(setq goal-column ;; set to nil if no match
|
|
|
|
(if (and grammar
|
|
|
|
(not (zerop (buffer-size)))
|
|
|
|
(string-match (regexp-quote (nth 1 grammar))
|
|
|
|
proced-header-line))
|
|
|
|
(if (nth 3 grammar)
|
|
|
|
(match-beginning 0)
|
|
|
|
(match-end 0)))))
|
2008-09-12 16:59:57 +00:00
|
|
|
|
2008-09-20 03:03:07 +00:00
|
|
|
;; Restore process marks and buffer position (if possible).
|
|
|
|
;; Sometimes this puts point in the middle of the proced buffer
|
2008-09-12 16:59:57 +00:00
|
|
|
;; where it is not interesting. Is there a better / more flexible solution?
|
2008-05-20 10:17:15 +00:00
|
|
|
(goto-char (point-min))
|
2008-09-12 16:59:57 +00:00
|
|
|
(let (pid mark new-pos)
|
|
|
|
(if (or mp-list (car old-pos))
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
(while (not (eobp))
|
|
|
|
(setq pid (proced-pid-at-point))
|
|
|
|
(when (setq mark (assq pid mp-list))
|
|
|
|
(insert (cdr mark))
|
|
|
|
(delete-char 1)
|
|
|
|
(beginning-of-line))
|
|
|
|
(when (eq (car old-pos) pid)
|
|
|
|
(if (nth 1 old-pos)
|
|
|
|
(let ((limit (line-end-position)) pos)
|
|
|
|
(while (and (not new-pos)
|
|
|
|
(setq pos (next-property-change (point) nil limit)))
|
|
|
|
(goto-char pos)
|
|
|
|
(when (eq (nth 1 old-pos)
|
|
|
|
(get-text-property (point) 'proced-key))
|
|
|
|
(forward-char (min (nth 2 old-pos)
|
|
|
|
(- (next-property-change (point))
|
|
|
|
(point))))
|
|
|
|
(setq new-pos (point))))
|
|
|
|
(unless new-pos
|
2008-09-12 16:59:57 +00:00
|
|
|
;; we found the process, but the field of point
|
|
|
|
;; is not listed anymore
|
|
|
|
(setq new-pos (proced-move-to-goal-column))))
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
(setq new-pos (min (+ (line-beginning-position) (nth 2 old-pos))
|
|
|
|
(line-end-position)))))
|
2008-09-12 16:59:57 +00:00
|
|
|
(forward-line)))
|
|
|
|
(if new-pos
|
|
|
|
(goto-char new-pos)
|
|
|
|
(goto-char (point-min))
|
|
|
|
(proced-move-to-goal-column)))
|
2012-06-02 10:56:09 +00:00
|
|
|
;; update mode line
|
|
|
|
;; Does the long `mode-name' clutter the mode line? It would be nice
|
2008-09-12 16:59:57 +00:00
|
|
|
;; to have some other location for displaying the values of the various
|
|
|
|
;; flags that affect the behavior of proced (flags one might want
|
|
|
|
;; to change on the fly). Where??
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
(setq mode-name
|
|
|
|
(concat "Proced"
|
|
|
|
(if proced-filter
|
|
|
|
(concat ": " (symbol-name proced-filter))
|
|
|
|
"")
|
|
|
|
(if proced-sort
|
2008-12-14 17:41:29 +00:00
|
|
|
(let* ((key (if (consp proced-sort) (car proced-sort)
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
proced-sort))
|
|
|
|
(grammar (assq key proced-grammar-alist)))
|
2008-12-14 17:41:29 +00:00
|
|
|
(concat " by " (if proced-descend "-" "+")
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
(nth 1 grammar)))
|
|
|
|
"")))
|
2008-05-05 02:38:20 +00:00
|
|
|
(force-mode-line-update)
|
2009-01-03 12:19:56 +00:00
|
|
|
;; run `proced-post-display-hook' only for a displayed buffer.
|
|
|
|
(if (get-buffer-window) (run-hooks 'proced-post-display-hook))
|
2008-05-05 02:38:20 +00:00
|
|
|
;; done
|
2008-03-26 02:15:28 +00:00
|
|
|
(or quiet (input-pending-p)
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
(message (if revert "Updating process information...done."
|
|
|
|
"Updating process display...done.")))))
|
2008-03-26 02:15:28 +00:00
|
|
|
|
2011-04-19 13:44:55 +00:00
|
|
|
(defun proced-revert (&rest _args)
|
2008-12-14 23:16:09 +00:00
|
|
|
"Reevaluate the process listing based on the currently running processes.
|
|
|
|
Preserves point and marks."
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
(proced-update t))
|
2008-03-26 02:15:28 +00:00
|
|
|
|
2012-09-23 12:34:23 +00:00
|
|
|
(defun proced-marked-processes ()
|
|
|
|
"Return marked processes as alist of PIDs.
|
|
|
|
If no process is marked return alist with the PID of the process point is on.
|
|
|
|
The cdrs of the alist are the text strings displayed by Proced for these
|
|
|
|
processes. They are used for error messages."
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
(let ((regexp (proced-marker-regexp))
|
|
|
|
process-alist)
|
2008-03-26 02:15:28 +00:00
|
|
|
;; collect marked processes
|
|
|
|
(save-excursion
|
|
|
|
(goto-char (point-min))
|
|
|
|
(while (re-search-forward regexp nil t)
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
(push (cons (proced-pid-at-point)
|
|
|
|
;; How much info should we collect here?
|
2009-01-03 12:19:56 +00:00
|
|
|
(buffer-substring-no-properties
|
|
|
|
(+ 2 (line-beginning-position))
|
|
|
|
(line-end-position)))
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
process-alist)))
|
2012-09-23 12:34:23 +00:00
|
|
|
(if process-alist
|
|
|
|
(nreverse process-alist)
|
|
|
|
;; take current process
|
|
|
|
(let ((pid (proced-pid-at-point)))
|
|
|
|
(if pid
|
|
|
|
(list (cons pid
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
(buffer-substring-no-properties
|
|
|
|
(+ 2 (line-beginning-position))
|
2012-09-23 12:34:23 +00:00
|
|
|
(line-end-position)))))))))
|
|
|
|
|
|
|
|
(defmacro proced-with-processes-buffer (process-alist &rest body)
|
|
|
|
"Execute the forms in BODY in a temporary buffer displaying PROCESS-ALIST.
|
|
|
|
PROCESS-ALIST is an alist of process PIDs as in `proced-process-alist'.
|
|
|
|
The value returned is the value of the last form in BODY."
|
|
|
|
(declare (indent 1) (debug t))
|
|
|
|
;; Use leading space in buffer name to make this buffer ephemeral
|
|
|
|
`(let ((bufname " *Marked Processes*")
|
|
|
|
(header-line (substring-no-properties proced-header-line)))
|
|
|
|
(with-current-buffer (get-buffer-create bufname)
|
|
|
|
(setq truncate-lines t
|
|
|
|
proced-header-line header-line ; inherit header line
|
|
|
|
header-line-format '(:eval (proced-header-line)))
|
2020-10-11 22:21:48 +00:00
|
|
|
(add-hook 'post-command-hook #'force-mode-line-update nil t) ;FIXME: Why?
|
2012-09-23 12:34:23 +00:00
|
|
|
(let ((inhibit-read-only t))
|
|
|
|
(erase-buffer)
|
|
|
|
(buffer-disable-undo)
|
|
|
|
(setq buffer-read-only t)
|
|
|
|
(dolist (process ,process-alist)
|
|
|
|
(insert " " (cdr process) "\n"))
|
|
|
|
(delete-char -1)
|
|
|
|
(goto-char (point-min)))
|
|
|
|
(save-window-excursion
|
|
|
|
;; Analogous to `dired-pop-to-buffer'
|
|
|
|
;; Don't split window horizontally. (Bug#1806)
|
Delete many items obsolete since 24.3
* lisp/allout.el (allout-exposure-change-hook)
(allout-structure-added-hook, allout-structure-deleted-hook)
(allout-structure-shifted-hook):
* lisp/arc-mode.el (archive-extract-hooks):
* lisp/buff-menu.el (Buffer-menu-buffer+size-width):
* lisp/calendar/timeclock.el (timeclock-modeline-display)
(timeclock-modeline-display, timeclock-update-modeline):
* lisp/cedet/semantic/db-el.el
(semanticdb-elisp-sym-function-arglist):
* lisp/cedet/semantic/db-file.el (semanticdb-save-database-hooks):
* lisp/cedet/semantic/edit.el (semantic-change-hooks)
(semantic-edits-new-change-hooks)
(semantic-edits-delete-change-hooks)
(semantic-edits-reparse-change-hooks):
* lisp/cedet/semantic/lex.el (semantic-lex-reset-hooks):
* lisp/comint.el (comint--unquote&expand-filename)
(comint-unquote-filename):
* lisp/custom.el (user-variable-p):
* lisp/dired.el (dired-shrink-to-fit, dired-pop-to-buffer)
(dired-sort-set-modeline):
* lisp/ebuff-menu.el (Electric-buffer-menu-mode):
* lisp/emacs-lisp/byte-run.el (macro-declaration-function):
* lisp/emacs-lisp/checkdoc.el (custom-print-functions)
(checkdoc-comment-style-hooks):
* lisp/emacs-lisp/cl-lib.el (custom-print-functions):
* lisp/emacs-lisp/edebug.el (gud-inhibit-global-bindings):
* lisp/erc/erc-dcc.el (erc-dcc-chat-filter-hook):
* lisp/eshell/esh-mode.el (eshell-status-in-modeline):
* lisp/eshell/eshell.el (eshell-add-to-window-buffer-names)
(eshell-remove-from-window-buffer-names):
* lisp/faces.el (set-face-underline-p, font-list-limit):
* lisp/files.el (automount-dir-prefix, toggle-read-only):
* lisp/filesets.el (filesets-cache-fill-content-hooks):
* lisp/frame.el (automatic-hscrolling):
* lisp/generic-x.el (javascript-generic-mode)
(javascript-generic-mode-hook):
* lisp/gnus/gnus-start.el (gnus-subscribe-newsgroup-hooks):
* lisp/gnus/nndiary.el (nndiary-request-create-group-hooks)
(nndiary-request-update-info-hooks)
(nndiary-request-accept-article-hooks):
* lisp/htmlfontify.el (hfy-post-html-hooks):
* lisp/international/mule-cmds.el
(inactivate-current-input-method-function)
(inactivate-input-method, input-method-inactivate-hook)
(ucs-insert):
* lisp/international/quail.el (quail-inactivate)
(quail-inactivate-hook):
* lisp/international/robin.el (robin-inactivate)
(robin-inactivate-hook):
* lisp/leim/quail/hangul.el (hangul-input-method-inactivate):
* lisp/leim/quail/uni-input.el (ucs-input-inactivate):
* lisp/mail/emacsbug.el (report-emacs-bug-info):
* lisp/mh-e/mh-e.el (mh-kill-folder-suppress-prompt-hooks):
* lisp/mpc.el (mpc-string-prefix-p):
* lisp/net/rcirc.el (rcirc-print-hooks, rcirc-sentinel-hooks)
(rcirc-receive-message-hooks, rcirc-activity-hooks):
* lisp/obsolete/crisp.el (crisp-mode-modeline-string):
* lisp/pcomplete.el (pcomplete-arg-quote-list)
(pcomplete-quote-argument):
* lisp/progmodes/cc-mode.el (c-prepare-bug-report-hooks):
* lisp/progmodes/python.el (python-info-ppss-context)
(python-info-ppss-context-type)
(python-info-ppss-comment-or-string-p, python-indent)
(python-guess-indent, python-buffer, python-preoutput-result)
(python-proc, python-send-receive, python-send-string)
(python-use-skeletons):
* lisp/progmodes/sh-script.el (sh-maybe-here-document):
* lisp/replace.el (query-replace-interactive):
* lisp/strokes.el (strokes-modeline-string):
* lisp/subr.el (redraw-modeline):
* lisp/term.el (term-default-fg-color, term-default-bg-color):
* lisp/textmodes/tex-mode.el (latex-string-prefix-p)
(tex-string-prefix-p):
* lisp/url/url-parse.el (url-recreate-url-attributes):
* lisp/vc/add-log.el (change-log-acknowledgement):
* lisp/vc/ediff-wind.el
(ediff-choose-window-setup-function-automatically):
* lisp/vc/pcvs-util.el (cvs-string-prefix-p):
* lisp/vc/vc.el (vc-string-prefix-p):
* lisp/window.el (display-buffer-function):
* lisp/winner.el (winner-mode-leave-hook): Remove many functions and
variables obsolete since 24.3.
* lisp/buff-menu.el (list-buffers--refresh):
* lisp/dired.el (dired-mode-map):
* lisp/files.el (abbreviate-file-name):
* lisp/generic-x.el (generic-default-modes):
* lisp/mh-e/mh-funcs.el (mh-kill-folder):
* lisp/progmodes/hideif.el (hide-ifdef-mode-submap):
* lisp/replace.el (query-replace-read-from):
* lisp/term.el (term):
* lisp/window.el (display-buffer): Don't use above deleted
functions and variables.
* src/marker.c (Fbuffer_has_markers_at): Delete DEFUN obsolete
since 24.3.
(syms_of_marker) <Sbuffer_has_markers_at>: Delete defsubr.
* lisp/subr.el (buffer-has-markers-at): Remove obsoletion
of above deleted DEFUN.
* etc/TODO: Doc fix; don't mention above deleted function.
* admin/cus-test.el (cus-test-get-options):
* lisp/pcomplete.el: Doc fixes; don't mention removed items.
; * etc/NEWS: List removed items.
2022-07-10 11:27:36 +00:00
|
|
|
;; FIXME: `dired-pop-to-buffer' was removed and replaced with
|
|
|
|
;; `dired-mark-pop-up'. Should we just use
|
|
|
|
;; `pop-to-buffer' here also?
|
2019-06-05 20:57:07 +00:00
|
|
|
(display-buffer (current-buffer)
|
|
|
|
'(display-buffer-in-direction
|
|
|
|
(direction . bottom)
|
|
|
|
(window-height . fit-window-to-buffer)))
|
2012-09-23 12:34:23 +00:00
|
|
|
,@body))))
|
|
|
|
|
|
|
|
(defun proced-send-signal (&optional signal process-alist)
|
|
|
|
"Send a SIGNAL to processes in PROCESS-ALIST.
|
|
|
|
PROCESS-ALIST is an alist as returned by `proced-marked-processes'.
|
|
|
|
Interactively, PROCESS-ALIST contains the marked processes.
|
|
|
|
If no process is marked, it contains the process point is on,
|
|
|
|
SIGNAL may be a string (HUP, INT, TERM, etc.) or a number.
|
|
|
|
After sending SIGNAL to all processes in PROCESS-ALIST, this command
|
|
|
|
runs the normal hook `proced-after-send-signal-hook'.
|
|
|
|
|
|
|
|
For backward compatibility SIGNAL and PROCESS-ALIST may be nil.
|
|
|
|
Then PROCESS-ALIST contains the marked processes or the process point is on
|
|
|
|
and SIGNAL is queried interactively. This noninteractive usage is still
|
2022-04-05 15:08:03 +00:00
|
|
|
supported but discouraged. It will be removed in a future version of Emacs."
|
2012-09-23 12:34:23 +00:00
|
|
|
(interactive
|
|
|
|
(let* ((process-alist (proced-marked-processes))
|
|
|
|
(pnum (if (= 1 (length process-alist))
|
|
|
|
"1 process"
|
|
|
|
(format "%d processes" (length process-alist))))
|
|
|
|
(completion-ignore-case t)
|
|
|
|
(completion-extra-properties
|
2020-10-11 22:21:48 +00:00
|
|
|
`(:annotation-function
|
|
|
|
,(lambda (s) (cdr (assoc s proced-signal-list))))))
|
2012-09-23 12:34:23 +00:00
|
|
|
(proced-with-processes-buffer process-alist
|
2021-10-05 01:34:08 +00:00
|
|
|
(list (completing-read (format-prompt "Send signal [%s]"
|
|
|
|
"TERM" pnum)
|
2012-09-23 12:34:23 +00:00
|
|
|
proced-signal-list
|
|
|
|
nil nil nil nil "TERM")
|
2021-10-05 16:16:48 +00:00
|
|
|
process-alist)))
|
|
|
|
proced-mode)
|
2012-09-23 12:34:23 +00:00
|
|
|
|
|
|
|
(unless (and signal process-alist)
|
2012-10-05 05:57:24 +00:00
|
|
|
;; Discouraged usage (supported for backward compatibility):
|
2012-09-23 12:34:23 +00:00
|
|
|
;; The new calling sequence separates more cleanly between the parts
|
|
|
|
;; of the code required for interactive and noninteractive calls so that
|
|
|
|
;; the command can be used more flexibly in noninteractive ways, too.
|
|
|
|
(unless (get 'proced-send-signal 'proced-outdated)
|
|
|
|
(put 'proced-send-signal 'proced-outdated t)
|
|
|
|
(message "Outdated usage of `proced-send-signal'")
|
|
|
|
(sit-for 2))
|
|
|
|
(setq process-alist (proced-marked-processes))
|
2008-08-18 00:47:12 +00:00
|
|
|
(unless signal
|
2012-09-23 12:34:23 +00:00
|
|
|
(let ((pnum (if (= 1 (length process-alist))
|
|
|
|
"1 process"
|
|
|
|
(format "%d processes" (length process-alist))))
|
|
|
|
(completion-ignore-case t)
|
|
|
|
(completion-extra-properties
|
2020-10-11 22:21:48 +00:00
|
|
|
`(:annotation-function
|
|
|
|
,(lambda (s) (cdr (assoc s proced-signal-list))))))
|
2012-09-23 12:34:23 +00:00
|
|
|
(proced-with-processes-buffer process-alist
|
2021-10-05 01:34:08 +00:00
|
|
|
(setq signal (completing-read (format-prompt "Send signal [%s]"
|
|
|
|
"TERM" pnum)
|
2012-09-23 12:34:23 +00:00
|
|
|
proced-signal-list
|
|
|
|
nil nil nil nil "TERM"))))))
|
|
|
|
|
2022-04-05 15:08:03 +00:00
|
|
|
(let (failures)
|
2012-09-23 12:34:23 +00:00
|
|
|
;; Why not always use `signal-process'? See
|
2017-11-26 06:45:41 +00:00
|
|
|
;; https://lists.gnu.org/r/emacs-devel/2008-03/msg02955.html
|
2012-09-23 12:34:23 +00:00
|
|
|
(if (functionp proced-signal-function)
|
|
|
|
;; use built-in `signal-process'
|
|
|
|
(let ((signal (if (stringp signal)
|
|
|
|
(if (string-match "\\`[0-9]+\\'" signal)
|
|
|
|
(string-to-number signal)
|
|
|
|
(make-symbol signal))
|
|
|
|
signal))) ; number
|
2009-04-20 20:42:45 +00:00
|
|
|
(dolist (process process-alist)
|
2012-09-23 12:34:23 +00:00
|
|
|
(condition-case err
|
|
|
|
(unless (zerop (funcall
|
2022-03-30 11:16:54 +00:00
|
|
|
proced-signal-function (car process) signal
|
|
|
|
(file-remote-p default-directory)))
|
2012-09-23 12:34:23 +00:00
|
|
|
(proced-log "%s\n" (cdr process))
|
|
|
|
(push (cdr process) failures))
|
|
|
|
(error ; catch errors from failed signals
|
|
|
|
(proced-log "%s\n" err)
|
|
|
|
(proced-log "%s\n" (cdr process))
|
|
|
|
(push (cdr process) failures)))))
|
|
|
|
;; use external system call
|
|
|
|
(let ((signal (format "-%s" signal)))
|
|
|
|
(dolist (process process-alist)
|
|
|
|
(with-temp-buffer
|
|
|
|
(condition-case nil
|
2022-03-30 11:16:54 +00:00
|
|
|
(unless (zerop (process-file
|
2012-09-23 12:34:23 +00:00
|
|
|
proced-signal-function nil t nil
|
|
|
|
signal (number-to-string (car process))))
|
|
|
|
(proced-log (current-buffer))
|
|
|
|
(proced-log "%s\n" (cdr process))
|
|
|
|
(push (cdr process) failures))
|
|
|
|
(error ; catch errors from failed signals
|
|
|
|
(proced-log (current-buffer))
|
|
|
|
(proced-log "%s\n" (cdr process))
|
|
|
|
(push (cdr process) failures)))))))
|
|
|
|
(if failures
|
|
|
|
;; Proced error message are not always very precise.
|
|
|
|
;; Can we issue a useful one-line summary in the
|
|
|
|
;; message area (using FAILURES) if only one signal failed?
|
|
|
|
(proced-log-summary
|
|
|
|
(format "Signal %s" signal)
|
|
|
|
(format "%d of %d signal%s failed"
|
|
|
|
(length failures) (length process-alist)
|
|
|
|
(if (= 1 (length process-alist)) "" "s")))
|
|
|
|
(proced-success-message "Sent signal to" (length process-alist))))
|
|
|
|
;; final clean-up
|
|
|
|
(run-hooks 'proced-after-send-signal-hook))
|
|
|
|
|
|
|
|
(defun proced-renice (priority process-alist)
|
|
|
|
"Renice the processes in PROCESS-ALIST to PRIORITY.
|
|
|
|
PROCESS-ALIST is an alist as returned by `proced-marked-processes'.
|
|
|
|
Interactively, PROCESS-ALIST contains the marked processes.
|
|
|
|
If no process is marked, it contains the process point is on,
|
|
|
|
After renicing all processes in PROCESS-ALIST, this command runs
|
2022-04-05 15:08:03 +00:00
|
|
|
the normal hook `proced-after-send-signal-hook'."
|
2012-09-23 12:34:23 +00:00
|
|
|
(interactive
|
|
|
|
(let ((process-alist (proced-marked-processes)))
|
|
|
|
(proced-with-processes-buffer process-alist
|
|
|
|
(list (read-number "New priority: ")
|
2021-10-05 16:16:48 +00:00
|
|
|
process-alist)))
|
|
|
|
proced-mode)
|
2012-09-23 12:34:23 +00:00
|
|
|
(if (numberp priority)
|
|
|
|
(setq priority (number-to-string priority)))
|
2022-04-05 15:08:03 +00:00
|
|
|
(let (failures)
|
2012-09-23 12:34:23 +00:00
|
|
|
(dolist (process process-alist)
|
|
|
|
(with-temp-buffer
|
|
|
|
(condition-case nil
|
2022-03-30 11:16:54 +00:00
|
|
|
(unless (zerop (process-file
|
2012-09-23 12:34:23 +00:00
|
|
|
proced-renice-command nil t nil
|
|
|
|
priority (number-to-string (car process))))
|
|
|
|
(proced-log (current-buffer))
|
|
|
|
(proced-log "%s\n" (cdr process))
|
|
|
|
(push (cdr process) failures))
|
|
|
|
(error ; catch errors from failed renice
|
|
|
|
(proced-log (current-buffer))
|
|
|
|
(proced-log "%s\n" (cdr process))
|
|
|
|
(push (cdr process) failures)))))
|
|
|
|
(if failures
|
|
|
|
(proced-log-summary
|
|
|
|
(format "Renice %s" priority)
|
|
|
|
(format "%d of %d renice%s failed"
|
|
|
|
(length failures) (length process-alist)
|
|
|
|
(if (= 1 (length process-alist)) "" "s")))
|
|
|
|
(proced-success-message "Reniced" (length process-alist))))
|
|
|
|
;; final clean-up
|
|
|
|
(run-hooks 'proced-after-send-signal-hook))
|
2008-08-18 00:47:12 +00:00
|
|
|
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
;; similar to `dired-why'
|
2008-08-18 00:47:12 +00:00
|
|
|
(defun proced-why ()
|
|
|
|
"Pop up a buffer with error log output from Proced.
|
|
|
|
A group of errors from a single command ends with a formfeed.
|
|
|
|
Thus, use \\[backward-page] to find the beginning of a group of errors."
|
2021-10-05 16:16:48 +00:00
|
|
|
(interactive nil proced-mode)
|
2008-08-18 00:47:12 +00:00
|
|
|
(if (get-buffer proced-log-buffer)
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
(save-selected-window
|
|
|
|
;; move `proced-log-buffer' to the front of the buffer list
|
|
|
|
(select-window (display-buffer (get-buffer proced-log-buffer)))
|
|
|
|
(setq truncate-lines t)
|
|
|
|
(set-buffer-modified-p nil)
|
|
|
|
(setq buffer-read-only t)
|
|
|
|
(goto-char (point-max))
|
|
|
|
(forward-line -1)
|
|
|
|
(backward-page 1)
|
|
|
|
(recenter 0))))
|
2008-08-18 00:47:12 +00:00
|
|
|
|
|
|
|
;; similar to `dired-log'
|
|
|
|
(defun proced-log (log &rest args)
|
|
|
|
"Log a message or the contents of a buffer.
|
|
|
|
If LOG is a string and there are more args, it is formatted with
|
|
|
|
those ARGS. Usually the LOG string ends with a \\n.
|
|
|
|
End each bunch of errors with (proced-log t signal):
|
|
|
|
this inserts the current time, buffer and signal at the start of the page,
|
|
|
|
and \f (formfeed) at the end."
|
|
|
|
(let ((obuf (current-buffer)))
|
|
|
|
(with-current-buffer (get-buffer-create proced-log-buffer)
|
|
|
|
(goto-char (point-max))
|
Require time-date.
(proced-command-alist, proced-command, proced-goal-header-re)
(proced-sorting-schemes-alist, proced-sorting-scheme)
(proced-header-alist, proced-sorting-schemes-re)
(proced-skip-regexp, proced-next-line, proced-previous-line)
(proced-listing-type, proced-sorting-scheme-p): Removed.
(proced-grammar-alist, proced-custom-attributes)
(proced-format-alist, proced-format, proced-filter-alist)
(proced-filter, proced-sort, proced-goal-attribute)
(proced-timer-interval, proced-timer-flag, proced-timer)
(proced-process-alist, proced-sort-internal, proced-process-tree)
(proced-header-help-echo, proced-field-help-echo): New variables.
(proced-pid-at-point, proced-timer, proced-mark-process-alist)
(proced-omit-process, proced-filter, proced-process-tree)
(proced-filter-children, proced-children-pids)
(proced-filter-parents, proced-<, proced-string-lessp)
(proced-time-lessp, proced-xor, proced-sort-p)
(proced-format-time, proced-format-start, proced-format-ttname)
(proced-format, proced-process-attributes): New functions.
(proced-toggle-timer-flag, proced-mark-children)
(proced-mark-parents, proced-filter-interactive)
(proced-filter-attribute, proced-sort-interactive)
(proced-sort-header, proced-format-interactive): New commands.
(proced-move-to-goal-column): Use goal-column.
(proced-mode): Use proced-timer.
(proced-do-mark-all): Display process count. Use use-region-p.
Simplify.
(proced-omit-processes): Use use-region-p.
(proced-sort-pcpu, proced-sort-pmem, proced-sort-pid)
(proced-sort-start, proced-sort-time, proced-sort-user): Use
proced-sort-interactive.
(proced-sort): Make it a function that performs the actual sort.
(proced-update): New arg revert. Use proced-process-alist,
proced-filter, proced-sort, proced-format, and
proced-grammar-alist. Preserve position of point based on fields.
Make header line and fields clickable.
(proced-send-signal): Use proced-pid-at-point and
proced-process-alist.
(proced-why): Use save-selected-window.
(proced-log): Use buffer-read-only.
2008-09-06 23:05:49 +00:00
|
|
|
(let (buffer-read-only)
|
2008-08-18 00:47:12 +00:00
|
|
|
(cond ((stringp log)
|
|
|
|
(insert (if args
|
More-conservative ‘format’ quote restyling
Instead of restyling curved quotes for every call to ‘format’,
create a new function ‘format-message’ that does the restyling,
and using the new function instead of ‘format’ only in contexts
where this seems appropriate.
Problem reported by Dmitry Gutov and Andreas Schwab in:
http://lists.gnu.org/archive/html/emacs-devel/2015-08/msg00826.html
http://lists.gnu.org/archive/html/emacs-devel/2015-08/msg00827.html
* doc/lispref/commands.texi (Using Interactive):
* doc/lispref/control.texi (Signaling Errors, Signaling Errors):
* doc/lispref/display.texi (Displaying Messages, Progress):
* doc/lispref/elisp.texi:
* doc/lispref/help.texi (Keys in Documentation):
* doc/lispref/minibuf.texi (Minibuffer Misc):
* doc/lispref/strings.texi (Formatting Strings):
* etc/NEWS:
Document the changes.
* lisp/abbrev.el (expand-region-abbrevs):
* lisp/apropos.el (apropos-library):
* lisp/calc/calc-ext.el (calc-record-message)
(calc-user-function-list):
* lisp/calc/calc-help.el (calc-describe-key, calc-full-help):
* lisp/calc/calc-lang.el (math-read-big-balance):
* lisp/calc/calc-store.el (calc-edit-variable):
* lisp/calc/calc-units.el (math-build-units-table-buffer):
* lisp/calc/calc-yank.el (calc-edit-mode):
* lisp/calendar/icalendar.el (icalendar-export-region)
(icalendar--add-diary-entry):
* lisp/cedet/mode-local.el (mode-local-print-binding)
(mode-local-describe-bindings-2):
* lisp/cedet/semantic/complete.el (semantic-completion-message):
* lisp/cedet/semantic/edit.el (semantic-parse-changes-failed):
* lisp/cedet/semantic/wisent/comp.el (wisent-log):
* lisp/cedet/srecode/insert.el (srecode-insert-show-error-report):
* lisp/descr-text.el (describe-text-properties-1, describe-char):
* lisp/dframe.el (dframe-message):
* lisp/dired-aux.el (dired-query):
* lisp/emacs-lisp/byte-opt.el (byte-compile-log-lap-1):
* lisp/emacs-lisp/bytecomp.el (byte-compile-log)
(byte-compile-log-file, byte-compile-warn, byte-compile-form):
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use)
(cconv-analyze-form):
* lisp/emacs-lisp/check-declare.el (check-declare-warn):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine):
* lisp/emacs-lisp/cl-macs.el (cl-symbol-macrolet):
* lisp/emacs-lisp/edebug.el (edebug-format):
* lisp/emacs-lisp/eieio-core.el (eieio-oref):
* lisp/emacs-lisp/eldoc.el (eldoc-minibuffer-message)
(eldoc-message):
* lisp/emacs-lisp/elint.el (elint-file, elint-log):
* lisp/emacs-lisp/find-func.el (find-function-library):
* lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning):
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p):
* lisp/emacs-lisp/nadvice.el (advice--make-docstring):
* lisp/emacs-lisp/package.el (package-compute-transaction)
(package-install-button-action, package-delete-button-action)
(package-menu--list-to-prompt):
* lisp/emacs-lisp/timer.el (timer-event-handler):
* lisp/emacs-lisp/warnings.el (lwarn, warn):
* lisp/emulation/viper-cmd.el:
(viper-toggle-parse-sexp-ignore-comments)
(viper-kill-buffer, viper-brac-function):
* lisp/emulation/viper-macs.el (viper-record-kbd-macro):
* lisp/facemenu.el (facemenu-add-new-face):
* lisp/faces.el (face-documentation, read-face-name)
(face-read-string, read-face-font, describe-face):
* lisp/files.el (find-alternate-file, hack-local-variables)
(hack-one-local-variable--obsolete, write-file)
(basic-save-buffer, delete-directory):
* lisp/format.el (format-write-file, format-find-file)
(format-insert-file):
* lisp/help-fns.el (help-fns--key-bindings)
(help-fns--compiler-macro, help-fns--obsolete)
(help-fns--interactive-only, describe-function-1)
(describe-variable):
* lisp/help.el (describe-mode):
* lisp/info-xref.el (info-xref-output):
* lisp/info.el (Info-virtual-index-find-node)
(Info-virtual-index, info-apropos):
* lisp/international/kkc.el (kkc-error):
* lisp/international/mule-cmds.el:
(select-safe-coding-system-interactively)
(select-safe-coding-system, describe-input-method):
* lisp/international/mule-conf.el (code-offset):
* lisp/international/mule-diag.el (describe-character-set)
(list-input-methods-1):
* lisp/international/quail.el (quail-error):
* lisp/minibuffer.el (minibuffer-message):
* lisp/mpc.el (mpc--debug):
* lisp/msb.el (msb--choose-menu):
* lisp/net/ange-ftp.el (ange-ftp-message):
* lisp/net/gnutls.el (gnutls-message-maybe):
* lisp/net/newst-backend.el (newsticker--sentinel-work):
* lisp/net/newst-treeview.el (newsticker--treeview-load):
* lisp/net/nsm.el (nsm-query-user):
* lisp/net/rlogin.el (rlogin):
* lisp/net/soap-client.el (soap-warning):
* lisp/net/tramp.el (tramp-debug-message):
* lisp/nxml/nxml-outln.el (nxml-report-outline-error):
* lisp/nxml/nxml-parse.el (nxml-parse-error):
* lisp/nxml/rng-cmpct.el (rng-c-error):
* lisp/nxml/rng-match.el (rng-compile-error):
* lisp/nxml/rng-uri.el (rng-uri-error):
* lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer):
* lisp/org/org-ctags.el:
(org-ctags-ask-rebuild-tags-file-then-find-tag):
* lisp/proced.el (proced-log):
* lisp/progmodes/ebnf2ps.el (ebnf-log):
* lisp/progmodes/flymake.el (flymake-log):
* lisp/progmodes/vhdl-mode.el (vhdl-warning-when-idle):
* lisp/replace.el (occur-1):
* lisp/simple.el (execute-extended-command)
(undo-outer-limit-truncate, define-alternatives):
* lisp/startup.el (command-line):
* lisp/subr.el (error, user-error, add-to-list):
* lisp/tutorial.el (tutorial--describe-nonstandard-key)
(tutorial--find-changed-keys):
* src/callint.c (Fcall_interactively):
* src/editfns.c (Fmessage, Fmessage_box):
Restyle the quotes of format strings intended for use as a
diagnostic, when restyling seems appropriate.
* lisp/subr.el (format-message): New function.
* src/doc.c (Finternal__text_restyle): New function.
(syms_of_doc): Define it.
2015-08-24 05:38:02 +00:00
|
|
|
(apply #'format-message log args)
|
2008-08-18 00:47:12 +00:00
|
|
|
log)))
|
|
|
|
((bufferp log)
|
|
|
|
(insert-buffer-substring log))
|
|
|
|
((eq t log)
|
|
|
|
(backward-page 1)
|
|
|
|
(unless (bolp)
|
|
|
|
(insert "\n"))
|
|
|
|
(insert (current-time-string)
|
Go back to grave quoting in source-code docstrings etc.
This reverts almost all my recent changes to use curved quotes
in docstrings and/or strings used for error diagnostics.
There are a few exceptions, e.g., Bahá’í proper names.
* admin/unidata/unidata-gen.el (unidata-gen-table):
* lisp/abbrev.el (expand-region-abbrevs):
* lisp/align.el (align-region):
* lisp/allout.el (allout-mode, allout-solicit-alternate-bullet)
(outlineify-sticky):
* lisp/apropos.el (apropos-library):
* lisp/bookmark.el (bookmark-default-annotation-text):
* lisp/button.el (button-category-symbol, button-put)
(make-text-button):
* lisp/calc/calc-aent.el (math-read-if, math-read-factor):
* lisp/calc/calc-embed.el (calc-do-embedded):
* lisp/calc/calc-ext.el (calc-user-function-list):
* lisp/calc/calc-graph.el (calc-graph-show-dumb):
* lisp/calc/calc-help.el (calc-describe-key)
(calc-describe-thing, calc-full-help):
* lisp/calc/calc-lang.el (calc-c-language)
(math-parse-fortran-vector-end, math-parse-tex-sum)
(math-parse-eqn-matrix, math-parse-eqn-prime)
(calc-yacas-language, calc-maxima-language, calc-giac-language)
(math-read-giac-subscr, math-read-math-subscr)
(math-read-big-rec, math-read-big-balance):
* lisp/calc/calc-misc.el (calc-help, report-calc-bug):
* lisp/calc/calc-mode.el (calc-auto-why, calc-save-modes)
(calc-auto-recompute):
* lisp/calc/calc-prog.el (calc-fix-token-name)
(calc-read-parse-table-part, calc-user-define-invocation)
(math-do-arg-check):
* lisp/calc/calc-store.el (calc-edit-variable):
* lisp/calc/calc-units.el (math-build-units-table-buffer):
* lisp/calc/calc-vec.el (math-read-brackets):
* lisp/calc/calc-yank.el (calc-edit-mode):
* lisp/calc/calc.el (calc, calc-do, calc-user-invocation):
* lisp/calendar/appt.el (appt-display-message):
* lisp/calendar/diary-lib.el (diary-check-diary-file)
(diary-mail-entries, diary-from-outlook):
* lisp/calendar/icalendar.el (icalendar-export-region)
(icalendar--convert-float-to-ical)
(icalendar--convert-date-to-ical)
(icalendar--convert-ical-to-diary)
(icalendar--convert-recurring-to-diary)
(icalendar--add-diary-entry):
* lisp/calendar/time-date.el (format-seconds):
* lisp/calendar/timeclock.el (timeclock-mode-line-display)
(timeclock-make-hours-explicit, timeclock-log-data):
* lisp/calendar/todo-mode.el (todo-prefix, todo-delete-category)
(todo-item-mark, todo-check-format)
(todo-insert-item--next-param, todo-edit-item--next-key)
(todo-mode):
* lisp/cedet/ede/pmake.el (ede-proj-makefile-insert-dist-rules):
* lisp/cedet/mode-local.el (describe-mode-local-overload)
(mode-local-print-binding, mode-local-describe-bindings-2):
* lisp/cedet/semantic/complete.el (semantic-displayor-show-request):
* lisp/cedet/srecode/srt-mode.el (srecode-macro-help):
* lisp/cus-start.el (standard):
* lisp/cus-theme.el (describe-theme-1):
* lisp/custom.el (custom-add-dependencies, custom-check-theme)
(custom--sort-vars-1, load-theme):
* lisp/descr-text.el (describe-text-properties-1, describe-char):
* lisp/dired-x.el (dired-do-run-mail):
* lisp/dired.el (dired-log):
* lisp/emacs-lisp/advice.el (ad-read-advised-function)
(ad-read-advice-class, ad-read-advice-name, ad-enable-advice)
(ad-disable-advice, ad-remove-advice, ad-set-argument)
(ad-set-arguments, ad--defalias-fset, ad-activate)
(ad-deactivate):
* lisp/emacs-lisp/byte-opt.el (byte-compile-inline-expand)
(byte-compile-unfold-lambda, byte-optimize-form-code-walker)
(byte-optimize-while, byte-optimize-apply):
* lisp/emacs-lisp/byte-run.el (defun, defsubst):
* lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode)
(byte-compile-log-file, byte-compile-format-warn)
(byte-compile-nogroup-warn, byte-compile-arglist-warn)
(byte-compile-cl-warn)
(byte-compile-warn-about-unresolved-functions)
(byte-compile-file, byte-compile--declare-var)
(byte-compile-file-form-defmumble, byte-compile-form)
(byte-compile-normal-call, byte-compile-check-variable)
(byte-compile-variable-ref, byte-compile-variable-set)
(byte-compile-subr-wrong-args, byte-compile-setq-default)
(byte-compile-negation-optimizer)
(byte-compile-condition-case--old)
(byte-compile-condition-case--new, byte-compile-save-excursion)
(byte-compile-defvar, byte-compile-autoload)
(byte-compile-lambda-form)
(byte-compile-make-variable-buffer-local, display-call-tree)
(batch-byte-compile):
* lisp/emacs-lisp/cconv.el (cconv-convert, cconv--analyze-use):
* lisp/emacs-lisp/chart.el (chart-space-usage):
* lisp/emacs-lisp/check-declare.el (check-declare-scan)
(check-declare-warn, check-declare-file)
(check-declare-directory):
* lisp/emacs-lisp/checkdoc.el (checkdoc-this-string-valid-engine)
(checkdoc-message-text-engine):
* lisp/emacs-lisp/cl-extra.el (cl-parse-integer)
(cl--describe-class):
* lisp/emacs-lisp/cl-generic.el (cl-defgeneric)
(cl--generic-describe, cl-generic-generalizers):
* lisp/emacs-lisp/cl-macs.el (cl--parse-loop-clause, cl-tagbody)
(cl-symbol-macrolet):
* lisp/emacs-lisp/cl.el (cl-unload-function, flet):
* lisp/emacs-lisp/copyright.el (copyright)
(copyright-update-directory):
* lisp/emacs-lisp/edebug.el (edebug-read-list):
* lisp/emacs-lisp/eieio-base.el (eieio-persistent-read):
* lisp/emacs-lisp/eieio-core.el (eieio--slot-override)
(eieio-oref):
* lisp/emacs-lisp/eieio-opt.el (eieio-help-constructor):
* lisp/emacs-lisp/eieio-speedbar.el:
(eieio-speedbar-child-make-tag-lines)
(eieio-speedbar-child-description):
* lisp/emacs-lisp/eieio.el (defclass, change-class):
* lisp/emacs-lisp/elint.el (elint-file, elint-get-top-forms)
(elint-init-form, elint-check-defalias-form)
(elint-check-let-form):
* lisp/emacs-lisp/ert.el (ert-get-test, ert-results-mode-menu)
(ert-results-pop-to-backtrace-for-test-at-point)
(ert-results-pop-to-messages-for-test-at-point)
(ert-results-pop-to-should-forms-for-test-at-point)
(ert-describe-test):
* lisp/emacs-lisp/find-func.el (find-function-search-for-symbol)
(find-function-library):
* lisp/emacs-lisp/generator.el (iter-yield):
* lisp/emacs-lisp/gv.el (gv-define-simple-setter):
* lisp/emacs-lisp/lisp-mnt.el (lm-verify):
* lisp/emacs-lisp/macroexp.el (macroexp--obsolete-warning):
* lisp/emacs-lisp/map-ynp.el (map-y-or-n-p):
* lisp/emacs-lisp/nadvice.el (advice--make-docstring)
(advice--make, define-advice):
* lisp/emacs-lisp/package-x.el (package-upload-file):
* lisp/emacs-lisp/package.el (package-version-join)
(package-disabled-p, package-activate-1, package-activate)
(package--download-one-archive)
(package--download-and-read-archives)
(package-compute-transaction, package-install-from-archive)
(package-install, package-install-selected-packages)
(package-delete, package-autoremove, describe-package-1)
(package-install-button-action, package-delete-button-action)
(package-menu-hide-package, package-menu--list-to-prompt)
(package-menu--perform-transaction)
(package-menu--find-and-notify-upgrades):
* lisp/emacs-lisp/pcase.el (pcase-exhaustive, pcase--u1):
* lisp/emacs-lisp/re-builder.el (reb-enter-subexp-mode):
* lisp/emacs-lisp/ring.el (ring-previous, ring-next):
* lisp/emacs-lisp/rx.el (rx-check, rx-anything)
(rx-check-any-string, rx-check-any, rx-check-not, rx-=)
(rx-repeat, rx-check-backref, rx-syntax, rx-check-category)
(rx-form):
* lisp/emacs-lisp/smie.el (smie-config-save):
* lisp/emacs-lisp/subr-x.el (internal--check-binding):
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-put-tag):
* lisp/emacs-lisp/testcover.el (testcover-1value):
* lisp/emacs-lisp/timer.el (timer-event-handler):
* lisp/emulation/viper-cmd.el (viper-toggle-parse-sexp-ignore-comments)
(viper-toggle-search-style, viper-kill-buffer)
(viper-brac-function):
* lisp/emulation/viper-macs.el (viper-record-kbd-macro):
* lisp/env.el (setenv):
* lisp/erc/erc-button.el (erc-nick-popup):
* lisp/erc/erc.el (erc-cmd-LOAD, erc-handle-login, english):
* lisp/eshell/em-dirs.el (eshell/cd):
* lisp/eshell/em-glob.el (eshell-glob-regexp)
(eshell-glob-entries):
* lisp/eshell/em-pred.el (eshell-parse-modifiers):
* lisp/eshell/esh-opt.el (eshell-show-usage):
* lisp/facemenu.el (facemenu-add-new-face)
(facemenu-add-new-color):
* lisp/faces.el (read-face-name, read-face-font, describe-face)
(x-resolve-font-name):
* lisp/files-x.el (modify-file-local-variable):
* lisp/files.el (locate-user-emacs-file, find-alternate-file)
(set-auto-mode, hack-one-local-variable--obsolete)
(dir-locals-set-directory-class, write-file, basic-save-buffer)
(delete-directory, copy-directory, recover-session)
(recover-session-finish, insert-directory)
(file-modes-char-to-who, file-modes-symbolic-to-number)
(move-file-to-trash):
* lisp/filesets.el (filesets-add-buffer, filesets-remove-buffer):
* lisp/find-cmd.el (find-generic, find-to-string):
* lisp/finder.el (finder-commentary):
* lisp/font-lock.el (font-lock-fontify-buffer):
* lisp/format.el (format-write-file, format-find-file)
(format-insert-file):
* lisp/frame.el (get-device-terminal, select-frame-by-name):
* lisp/fringe.el (fringe--check-style):
* lisp/gnus/nnmairix.el (nnmairix-widget-create-query):
* lisp/help-fns.el (help-fns--key-bindings)
(help-fns--compiler-macro, help-fns--parent-mode)
(help-fns--obsolete, help-fns--interactive-only)
(describe-function-1, describe-variable):
* lisp/help.el (describe-mode)
(describe-minor-mode-from-indicator):
* lisp/image.el (image-type):
* lisp/international/ccl.el (ccl-dump):
* lisp/international/fontset.el (x-must-resolve-font-name):
* lisp/international/mule-cmds.el (prefer-coding-system)
(select-safe-coding-system-interactively)
(select-safe-coding-system, activate-input-method)
(toggle-input-method, describe-current-input-method)
(describe-language-environment):
* lisp/international/mule-conf.el (code-offset):
* lisp/international/mule-diag.el (describe-character-set)
(list-input-methods-1):
* lisp/mail/feedmail.el (feedmail-run-the-queue):
* lisp/mouse.el (minor-mode-menu-from-indicator):
* lisp/mpc.el (mpc-playlist-rename):
* lisp/msb.el (msb--choose-menu):
* lisp/net/ange-ftp.el (ange-ftp-shell-command):
* lisp/net/imap.el (imap-interactive-login):
* lisp/net/mairix.el (mairix-widget-create-query):
* lisp/net/newst-backend.el (newsticker--sentinel-work):
* lisp/net/newst-treeview.el (newsticker--treeview-load):
* lisp/net/rlogin.el (rlogin):
* lisp/obsolete/iswitchb.el (iswitchb-possible-new-buffer):
* lisp/obsolete/otodo-mode.el (todo-more-important-p):
* lisp/obsolete/pgg-gpg.el (pgg-gpg-process-region):
* lisp/obsolete/pgg-pgp.el (pgg-pgp-process-region):
* lisp/obsolete/pgg-pgp5.el (pgg-pgp5-process-region):
* lisp/org/ob-core.el (org-babel-goto-named-src-block)
(org-babel-goto-named-result):
* lisp/org/ob-fortran.el (org-babel-fortran-ensure-main-wrap):
* lisp/org/ob-ref.el (org-babel-ref-resolve):
* lisp/org/org-agenda.el (org-agenda-prepare):
* lisp/org/org-clock.el (org-clock-notify-once-if-expired)
(org-clock-resolve):
* lisp/org/org-ctags.el (org-ctags-ask-rebuild-tags-file-then-find-tag):
* lisp/org/org-feed.el (org-feed-parse-atom-entry):
* lisp/org/org-habit.el (org-habit-parse-todo):
* lisp/org/org-mouse.el (org-mouse-popup-global-menu)
(org-mouse-context-menu):
* lisp/org/org-table.el (org-table-edit-formulas):
* lisp/org/ox.el (org-export-async-start):
* lisp/proced.el (proced-log):
* lisp/progmodes/ada-mode.el (ada-get-indent-case)
(ada-check-matching-start, ada-goto-matching-start):
* lisp/progmodes/ada-prj.el (ada-prj-display-page):
* lisp/progmodes/ada-xref.el (ada-find-executable):
* lisp/progmodes/ebrowse.el (ebrowse-tags-apropos):
* lisp/progmodes/etags.el (etags-tags-apropos-additional):
* lisp/progmodes/flymake.el (flymake-parse-err-lines)
(flymake-start-syntax-check-process):
* lisp/progmodes/python.el (python-shell-get-process-or-error)
(python-define-auxiliary-skeleton):
* lisp/progmodes/sql.el (sql-comint):
* lisp/progmodes/verilog-mode.el (verilog-load-file-at-point):
* lisp/progmodes/vhdl-mode.el (vhdl-widget-directory-validate):
* lisp/recentf.el (recentf-open-files):
* lisp/replace.el (query-replace-read-from)
(occur-after-change-function, occur-1):
* lisp/scroll-bar.el (scroll-bar-columns):
* lisp/server.el (server-get-auth-key):
* lisp/simple.el (execute-extended-command)
(undo-outer-limit-truncate, list-processes--refresh)
(compose-mail, set-variable, choose-completion-string)
(define-alternatives):
* lisp/startup.el (site-run-file, tty-handle-args, command-line)
(command-line-1):
* lisp/subr.el (noreturn, define-error, add-to-list)
(read-char-choice, version-to-list):
* lisp/term/common-win.el (x-handle-xrm-switch)
(x-handle-name-switch, x-handle-args):
* lisp/term/x-win.el (x-handle-parent-id, x-handle-smid):
* lisp/textmodes/reftex-ref.el (reftex-label):
* lisp/textmodes/reftex-toc.el (reftex-toc-rename-label):
* lisp/textmodes/two-column.el (2C-split):
* lisp/tutorial.el (tutorial--describe-nonstandard-key)
(tutorial--find-changed-keys):
* lisp/type-break.el (type-break-noninteractive-query):
* lisp/wdired.el (wdired-do-renames, wdired-do-symlink-changes)
(wdired-do-perm-changes):
* lisp/whitespace.el (whitespace-report-region):
Prefer grave quoting in source-code strings used to generate help
and diagnostics.
* lisp/faces.el (face-documentation):
No need to convert quotes, since the result is a docstring.
* lisp/info.el (Info-virtual-index-find-node)
(Info-virtual-index, info-apropos):
Simplify by generating only curved quotes, since info files are
typically that ways nowadays anyway.
* lisp/international/mule-diag.el (list-input-methods):
Don’t assume text quoting style is curved.
* lisp/org/org-bibtex.el (org-bibtex-fields):
Revert my recent changes, going back to the old quoting style.
2015-09-07 15:41:44 +00:00
|
|
|
(format-message "\tBuffer `%s', signal `%s'\n"
|
Top-level elisp files respect ‘text-quoting-style’
In top-level elisp files, use format-message in diagnostic formats,
so that they follow user preference as per ‘text-quoting-style’
rather than being hard-coded to quote `like this'.
* lisp/allout.el (allout-get-configvar-values):
* lisp/apropos.el (apropos-symbols-internal):
* lisp/dired-aux.el (dired-do-shell-command, dired-create-files)
(dired-do-create-files-regexp, dired-create-files-non-directory):
* lisp/dired-x.el (dired-do-run-mail):
* lisp/dired.el (dired-log, dired-dnd-handle-local-file):
* lisp/disp-table.el (standard-display-european):
* lisp/find-dired.el (find-dired):
* lisp/forms.el (forms-mode):
* lisp/ido.el (ido-buffer-internal):
* lisp/info.el (Info-index-next):
* lisp/outline.el (outline-invent-heading):
* lisp/printing.el (pr-ps-outfile-preprint, pr-i-ps-send):
* lisp/proced.el (proced-log):
* lisp/ps-print.el (ps-print-preprint, ps-get-size):
* lisp/recentf.el (recentf-open-files, recentf-save-list):
* lisp/savehist.el (savehist-save):
* lisp/server.el (server-ensure-safe-dir):
* lisp/ses.el (ses-rename-cell):
* lisp/simple.el (list-processes--refresh):
* lisp/startup.el (command-line):
* lisp/strokes.el (strokes-unset-last-stroke)
(strokes-execute-stroke):
Use format-message so that quotes are restyled.
* lisp/cus-edit.el (custom-raised-buttons, customize-browse):
Don’t quote ‘raised’.
* lisp/descr-text.el (describe-char):
* lisp/dirtrack.el (dirtrack-debug-message):
* lisp/hexl.el (hexl-insert-multibyte-char):
Apply substitute-command-keys to help string.
* lisp/wdired.el (wdired-do-renames, wdired-do-symlink-changes)
(wdired-do-perm-changes):
Let dired-log do the formatting.
2015-08-26 08:30:29 +00:00
|
|
|
(buffer-name obuf) (car args)))
|
2008-08-18 00:47:12 +00:00
|
|
|
(goto-char (point-max))
|
|
|
|
(insert "\f\n")))))))
|
|
|
|
|
|
|
|
;; similar to `dired-log-summary'
|
|
|
|
(defun proced-log-summary (signal string)
|
|
|
|
"State a summary of SIGNAL's failures, in echo area and log buffer.
|
|
|
|
STRING is an overall summary of the failures."
|
|
|
|
(message "Signal %s: %s--type ? for details" signal string)
|
|
|
|
;; Log a summary describing a bunch of errors.
|
|
|
|
(proced-log (concat "\n" string "\n"))
|
|
|
|
(proced-log t signal))
|
2008-03-26 02:15:28 +00:00
|
|
|
|
|
|
|
(defun proced-help ()
|
2008-12-19 21:53:25 +00:00
|
|
|
"Provide help for the Proced user."
|
2021-10-05 16:16:48 +00:00
|
|
|
(interactive nil proced-mode)
|
2008-08-18 00:47:12 +00:00
|
|
|
(proced-why)
|
2008-03-26 02:15:28 +00:00
|
|
|
(if (eq last-command 'proced-help)
|
|
|
|
(describe-mode)
|
2022-09-15 07:17:30 +00:00
|
|
|
(message (substitute-command-keys proced-help-string))))
|
2008-03-26 02:15:28 +00:00
|
|
|
|
|
|
|
(defun proced-undo ()
|
2008-12-19 21:53:25 +00:00
|
|
|
"Undo in a Proced buffer.
|
|
|
|
This doesn't recover killed processes, it just undoes changes in the Proced
|
2008-03-26 02:15:28 +00:00
|
|
|
buffer. You can use it to recover marks."
|
2021-10-05 16:16:48 +00:00
|
|
|
(interactive nil proced-mode)
|
2008-03-26 02:15:28 +00:00
|
|
|
(let (buffer-read-only)
|
|
|
|
(undo))
|
2008-05-20 10:17:15 +00:00
|
|
|
(message "Change in Proced buffer undone.
|
2008-03-26 02:15:28 +00:00
|
|
|
Killed processes cannot be recovered by Emacs."))
|
|
|
|
|
|
|
|
(provide 'proced)
|
|
|
|
|
2008-08-18 00:47:12 +00:00
|
|
|
;;; proced.el ends here
|