Mercurial > emacs
annotate lisp/proced.el @ 98194:6cf707f7e962
(select-frame-set-input-focus): With non-nil
mouse-autoselect-window always move mouse cursor to frame's
selected window. Otherwise restore pre 2008-09-13 behavior.
(select-frame-by-name): Use select-frame-set-input-focus.
author | Martin Rudalics <rudalics@gmx.at> |
---|---|
date | Tue, 16 Sep 2008 08:20:21 +0000 |
parents | 87d64c3d48ac |
children | 538f59dc1be8 |
rev | line source |
---|---|
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
1 ;;; proced.el --- operate on system processes like dired |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
2 |
93213
f51aae2fc6a4
Update copyright.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93212
diff
changeset
|
3 ;; Copyright (C) 2008 Free Software Foundation, Inc. |
f51aae2fc6a4
Update copyright.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93212
diff
changeset
|
4 |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
5 ;; Author: Roland Winkler <Roland.Winkler@physik.uni-erlangen.de> |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
6 ;; Keywords: Processes, Unix |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
7 |
93213
f51aae2fc6a4
Update copyright.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93212
diff
changeset
|
8 ;; This file is part of GNU Emacs. |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
9 |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94621
diff
changeset
|
10 ;; GNU Emacs is free software: you can redistribute it and/or modify |
93213
f51aae2fc6a4
Update copyright.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93212
diff
changeset
|
11 ;; it under the terms of the GNU General Public License as published by |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94621
diff
changeset
|
12 ;; the Free Software Foundation, either version 3 of the License, or |
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94621
diff
changeset
|
13 ;; (at your option) any later version. |
93213
f51aae2fc6a4
Update copyright.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93212
diff
changeset
|
14 |
f51aae2fc6a4
Update copyright.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93212
diff
changeset
|
15 ;; GNU Emacs is distributed in the hope that it will be useful, |
f51aae2fc6a4
Update copyright.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93212
diff
changeset
|
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
f51aae2fc6a4
Update copyright.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93212
diff
changeset
|
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
f51aae2fc6a4
Update copyright.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93212
diff
changeset
|
18 ;; GNU General Public License for more details. |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
19 |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
20 ;; You should have received a copy of the GNU General Public License |
94678
ee5932bf781d
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
94621
diff
changeset
|
21 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
22 |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
23 ;;; Commentary: |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
24 |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
25 ;; Proced makes an Emacs buffer containing a listing of the current |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
26 ;; system processes. You can use the normal Emacs commands to move around |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
27 ;; in this buffer, and special Proced commands to operate on the processes |
98162
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
28 ;; listed. See `proced-mode' for getting started. |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
29 ;; |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
30 ;; To do: |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
31 ;; - use defcustom where appropriate |
98162
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
32 ;; - interactive temporary customizability of flags in `proced-grammar-alist' |
97522
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
33 ;; - allow "sudo kill PID", "renice PID" |
98162
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
34 ;; |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
35 ;; Wishlist |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
36 ;; - tree view like pstree(1) |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
37 |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
38 ;;; Code: |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
39 |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
40 (require 'time-date) ; for `with-decoded-time-value' |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
41 |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
42 (defgroup proced nil |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
43 "Proced mode." |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
44 :group 'processes |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
45 :group 'unix |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
46 :prefix "proced-") |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
47 |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
48 (defcustom proced-signal-function 'signal-process |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
49 "Name of signal function. |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
50 It can be an elisp function (usually `signal-process') or a string specifying |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
51 the external command (usually \"kill\")." |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
52 :group 'proced |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
53 :type '(choice (function :tag "function") |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
54 (string :tag "command"))) |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
55 |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
56 (defcustom proced-signal-list |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
57 '( ;; signals supported on all POSIX compliant systems |
97522
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
58 ("HUP (1. Hangup)") |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
59 ("INT (2. Terminal interrupt)") |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
60 ("QUIT (3. Terminal quit)") |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
61 ("ABRT (6. Process abort)") |
97522
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
62 ("KILL (9. Kill - cannot be caught or ignored)") |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
63 ("ALRM (14. Alarm Clock)") |
97522
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
64 ("TERM (15. Termination)") |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
65 ;; POSIX 1003.1-2001 |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
66 ;; Which systems do not support these signals so that we can |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
67 ;; exclude them from `proced-signal-list'? |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
68 ("CONT (Continue executing)") |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
69 ("STOP (Stop executing / pause - cannot be caught or ignored)") |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
70 ("TSTP (Terminal stop / pause)")) |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
71 "List of signals, used for minibuffer completion." |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
72 :group 'proced |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
73 :type '(repeat (string :tag "signal"))) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
74 |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
75 ;; For which attributes can we use a fixed width of the output field? |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
76 ;; A fixed width speeds up formatting, yet it can make |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
77 ;; `proced-grammar-alist' system-dependent. |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
78 ;; (If proced runs like top(1) we want it to be fast.) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
79 ;; |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
80 ;; If it is impossible / unlikely that an attribute has the same value |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
81 ;; for two processes, then sorting can be based on one ordinary (fast) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
82 ;; predicate like `<'. Otherwise, a list of proced predicates can be used |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
83 ;; to refine the sort. |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
84 ;; |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
85 ;; It would be neat if one could temporarily override the following |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
86 ;; predefined rules. |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
87 (defvar proced-grammar-alist |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
88 '( ;; attributes defined in `system-process-attributes' |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
89 (euid "EUID" "%d" right proced-< nil (euid pid) (nil t nil)) |
98162
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
90 (user "USER" nil left proced-string-lessp nil (user pid) (nil t nil)) |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
91 (egid "EGID" "%d" right proced-< nil (egid euid pid) (nil t nil)) |
98162
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
92 (group "GROUP" nil left proced-string-lessp nil (group user pid) (nil t nil)) |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
93 (comm "COMMAND" nil left proced-string-lessp nil (comm pid) (nil t nil)) |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
94 (state "STAT" nil left proced-string-lessp nil (state pid) (nil t nil)) |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
95 (ppid "PPID" "%d" right proced-< nil (ppid pid) (nil t nil)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
96 (pgrp "PGRP" "%d" right proced-< nil (pgrp euid pid) (nil t nil)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
97 (sess "SESS" "%d" right proced-< nil (sess pid) (nil t nil)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
98 (ttname "TTY" proced-format-ttname left proced-string-lessp nil (ttname pid) (nil t nil)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
99 (tpgid "TPGID" "%d" right proced-< nil (tpgid pid) (nil t nil)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
100 (minflt "MINFLT" "%d" right proced-< nil (minflt pid) (nil t t)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
101 (majflt "MAJFLT" "%d" right proced-< nil (majflt pid) (nil t t)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
102 (cminflt "CMINFLT" "%d" right proced-< nil (cminflt pid) (nil t t)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
103 (cmajflt "CMAJFLT" "%d" right proced-< nil (cmajflt pid) (nil t t)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
104 (utime "UTIME" proced-format-time right proced-time-lessp t (utime pid) (nil t t)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
105 (stime "STIME" proced-format-time right proced-time-lessp t (stime pid) (nil t t)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
106 (cutime "CUTIME" proced-format-time right proced-time-lessp t (cutime pid) (nil t t)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
107 (cstime "CSTIME" proced-format-time right proced-time-lessp t (cstime pid) (nil t t)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
108 (pri "PR" "%d" right proced-< t (pri pid) (nil t t)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
109 (nice "NI" "%3d" 3 proced-< t (nice pid) (t t nil)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
110 (thcount "THCOUNT" "%d" right proced-< t (thcount pid) (nil t t)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
111 (start "START" proced-format-start 6 proced-time-lessp nil (start pid) (t t nil)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
112 (vsize "VSIZE" "%d" right proced-< t (vsize pid) (nil t t)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
113 (rss "RSS" "%d" right proced-< t (rss pid) (nil t t)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
114 (etime "ETIME" proced-format-time right proced-time-lessp t (etime pid) (nil t t)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
115 (pcpu "%CPU" "%.1f" right proced-< t (pcpu pid) (nil t t)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
116 (pmem "%MEM" "%.1f" right proced-< t (pmem pid) (nil t t)) |
98162
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
117 (args "ARGS" proced-format-args left proced-string-lessp nil (args pid) (nil t nil)) |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
118 ;; |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
119 ;; attributes defined by proced (see `proced-process-attributes') |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
120 (pid "PID" "%d" right proced-< nil (pid) (t t nil)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
121 ;; time: sum of utime and stime |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
122 (time "TIME" proced-format-time right proced-time-lessp t (time pid) (nil t t)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
123 ;; ctime: sum of cutime and cstime |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
124 (ctime "CTIME" proced-format-time right proced-time-lessp t (ctime pid) (nil t t))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
125 "Alist of rules for handling Proced attributes. |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
126 |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
127 Each element has the form |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
128 |
98162
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
129 (KEY NAME FORMAT JUSTIFY PREDICATE REVERSE SORT-SCHEME REFINE-FLAGS). |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
130 |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
131 KEY is the car of a process attribute. |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
132 |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
133 NAME appears in the header line. |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
134 |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
135 FORMAT specifies the format for displaying the attribute values. |
98162
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
136 It can be a string passed to `format'. It can be a function called |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
137 with one argument, the value of the attribute. Nil means take as is. |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
138 |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
139 If JUSTIFY is an integer, its modulus gives the width of the attribute |
98162
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
140 values formatted with FORMAT. If JUSTIFY is positive, NAME appears |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
141 right-justified, otherwise it appears left-justified. If JUSTIFY is 'left |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
142 or 'right, the field width is calculated from all field values in the listing. |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
143 If JUSTIFY is 'left, the field values are formatted left-justified and |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
144 right-justified otherwise. |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
145 |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
146 PREDICATE is the predicate for sorting and filtering the process listing |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
147 based on attribute KEY. PREDICATE takes two arguments P1 and P2, |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
148 the corresponding attribute values of two processes. PREDICATE should |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
149 return 'equal if P1 has same rank like P2. Any other non-nil value says |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
150 that P1 is \"less than\" P2, or nil if not. |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
151 |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
152 REVERSE is non-nil if the sort order is opposite to the order defined |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
153 by PREDICATE. |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
154 |
98162
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
155 SORT-SCHEME is a list (KEY1 KEY2 ...) defining a hierarchy of rules |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
156 for sorting the process listing. KEY1, KEY2, ... are KEYs appearing as cars |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
157 of `proced-grammar-alist'. First the PREDICATE of KEY1 is evaluated. |
98162
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
158 If it yields non-equal, it defines the sort order for the corresponding |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
159 processes. If it evaluates to 'equal the PREDICATE of KEY2 is evaluated, etc. |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
160 |
98162
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
161 REFINE-FLAGS is a list (LESS-B EQUAL-B LARGER-B) used by the command |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
162 `proced-refine' (see there) to refine the listing based on attribute KEY. |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
163 This command compares the value of attribute KEY of every process with |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
164 the value of attribute KEY of the process at the position of point |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
165 using PREDICATE. |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
166 If PREDICATE yields non-nil, the process is accepted if LESS-B is non-nil. |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
167 If PREDICATE yields 'equal, the process is accepted if EQUAL-B is non-nil. |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
168 If PREDICATE yields nil, the process is accepted if LARGER-B is non-nil.") |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
169 |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
170 (defvar proced-custom-attributes nil |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
171 "List of functions defining custom attributes. |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
172 This variable extends the functionality of `proced-process-attributes'. |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
173 Each function is called with one argument, the list of attributes |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
174 of a system process. It returns a cons cell of the form (KEY . VALUE) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
175 like `system-process-attributes'.") |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
176 |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
177 ;; Formatting and sorting rules are defined "per attribute". If formatting |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
178 ;; and / or sorting should use more than one attribute, it appears more |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
179 ;; transparent to define a new derived attribute, so that formatting and |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
180 ;; sorting can use them consistently. (Are there exceptions to this rule? |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
181 ;; Would it be advantageous to have yet more general methods available?) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
182 ;; Sorting can also be based on attributes that are invisible in the listing. |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
183 |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
184 (defvar proced-format-alist |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
185 '((short user pid pcpu pmem start time args) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
186 (medium user pid pcpu pmem vsize rss ttname state start time args) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
187 (long user euid group pid pri nice pcpu pmem vsize rss ttname state |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
188 start time args) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
189 (verbose user euid group egid pid ppid pgrp sess comm pri nice pcpu pmem |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
190 state thcount vsize rss ttname tpgid minflt majflt cminflt cmajflt |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
191 start time utime stime ctime cutime cstime etime args)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
192 "Alist of formats of listing. |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
193 The car of each element is a symbol, the name of the format. |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
194 The cdr is a list of keys appearing in `proced-grammar-alist'.") |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
195 |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
196 (defvar proced-format 'short |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
197 "Current format of Proced listing. |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
198 It can be the car of an element of `proced-format-alist'. |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
199 It can also be a list of keys appearing in `proced-grammar-alist'.") |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
200 (make-variable-buffer-local 'proced-format) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
201 |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
202 ;; FIXME: is there a better name for filter `user' that does not coincide |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
203 ;; with an attribute key? |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
204 (defvar proced-filter-alist |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
205 `((user (user . ,(concat "\\`" (user-real-login-name) "\\'"))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
206 (user-running (user . ,(concat "\\`" (user-real-login-name) "\\'")) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
207 (state . "\\`[Rr]\\'")) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
208 (all) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
209 (all-running (state . "\\`[Rr]\\'")) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
210 (emacs (fun-all . (lambda (list) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
211 (proced-filter-children list ,(emacs-pid)))))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
212 "Alist of process filters. |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
213 The car of each element is a symbol, the name of the filter. |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
214 The cdr is a list of elementary filters that are applied to every process. |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
215 A process is displayed if it passes all elementary filters of a selected |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
216 filter. |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
217 |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
218 An elementary filter can be one of the following: |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
219 \(KEY . REGEXP) If value of attribute KEY matches REGEXP, |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
220 accept this process. |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
221 \(KEY . FUN) Apply function FUN to attribute KEY. Accept this process, |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
222 if FUN returns non-nil. |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
223 \(function . FUN) For each process, apply function FUN to list of attributes |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
224 of each. Accept the process if FUN returns non-nil. |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
225 \(fun-all . FUN) Apply function FUN to entire process list. |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
226 FUN must return the filtered list.") |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
227 |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
228 (defvar proced-filter 'user |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
229 "Current filter of proced listing. |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
230 It can be the car of an element of `proced-filter-alist'. |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
231 It can also be a list of elementary filters as in the cdrs of the elements |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
232 of `proced-filter-alist'.") |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
233 (make-variable-buffer-local 'proced-filter) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
234 |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
235 (defvar proced-sort 'pcpu |
98162
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
236 "Current sort scheme for proced listing. |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
237 It must be the KEY of an element of `proced-grammar-alist'. |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
238 It can also be a list of KEYs as in the SORT-SCHEMEs of the elements |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
239 of `proced-grammar-alist'.") |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
240 (make-variable-buffer-local 'proced-format) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
241 |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
242 (defcustom proced-goal-attribute 'args |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
243 "If non-nil, key of the attribute that defines the `goal-column'." |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
244 :group 'proced |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
245 :type '(choice (const :tag "none" nil) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
246 (symbol :tag "key"))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
247 |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
248 (defcustom proced-timer-interval 5 |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
249 "Time interval in seconds for updating Proced buffers." |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
250 :group 'proced |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
251 :type 'integer) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
252 |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
253 (defcustom proced-timer-flag nil |
98162
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
254 "Non-nil for auto update of a Proced buffer. |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
255 Can be changed interactively via `proced-toggle-timer-flag'." |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
256 :group 'proced |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
257 :type 'boolean) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
258 (make-variable-buffer-local 'proced-timer-flag) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
259 |
95135
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
260 ;; Internal variables |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
261 |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
262 (defvar proced-process-alist nil |
98162
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
263 "Alist of processes displayed by Proced. |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
264 The car of each element is the PID, and the cdr is a list of |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
265 cons pairs, see `proced-process-attributes'.") |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
266 (make-variable-buffer-local 'proced-process-alist) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
267 |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
268 (defvar proced-sort-internal nil |
98162
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
269 "Sort scheme for listing (internal format).") |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
270 |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
271 (defvar proced-marker-char ?* ; the answer is 42 |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
272 "In proced, the current mark character.") |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
273 |
98172
87d64c3d48ac
(proced-mark-face, proced-marked-face)
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98162
diff
changeset
|
274 ;; Faces and font-lock code taken from dired, |
87d64c3d48ac
(proced-mark-face, proced-marked-face)
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98162
diff
changeset
|
275 ;; but face variables are deprecated for new code. |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
276 (defgroup proced-faces nil |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
277 "Faces used by Proced." |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
278 :group 'proced |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
279 :group 'faces) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
280 |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
281 (defface proced-mark |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
282 '((t (:inherit font-lock-constant-face))) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
283 "Face used for proced marks." |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
284 :group 'proced-faces) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
285 |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
286 (defface proced-marked |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
287 '((t (:inherit font-lock-warning-face))) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
288 "Face used for marked processes." |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
289 :group 'proced-faces) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
290 |
98162
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
291 (defface proced-sort-header |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
292 '((t (:inherit font-lock-keyword-face))) |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
293 "Face used for header of attribute used for sorting." |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
294 :group 'proced-faces) |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
295 |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
296 (defvar proced-re-mark "^[^ \n]" |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
297 "Regexp matching a marked line. |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
298 Important: the match ends just after the marker.") |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
299 |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
300 (defvar proced-header-line nil |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
301 "Headers in Proced buffer as a string.") |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
302 (make-variable-buffer-local 'proced-header-line) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
303 |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
304 (defvar proced-log-buffer "*Proced log*" |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
305 "Name of Proced Log buffer.") |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
306 |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
307 (defvar proced-process-tree nil |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
308 "Process tree of listing (internal variable).") |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
309 |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
310 (defvar proced-timer nil |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
311 "Stores if Proced timer is already installed.") |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
312 |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
313 (defconst proced-help-string |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
314 "(n)ext, (p)revious, (m)ark, (u)nmark, (k)ill, (q)uit (type ? for more help)" |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
315 "Help string for proced.") |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
316 |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
317 (defconst proced-header-help-echo |
98162
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
318 "mouse-1, mouse-2: sort by attribute %s%s (%s)" |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
319 "Help string shown when mouse is over a sortable header.") |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
320 |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
321 (defconst proced-field-help-echo |
98162
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
322 "mouse-2, RET: refine by attribute %s %s" |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
323 "Help string shown when mouse is over a refinable field.") |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
324 |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
325 (defvar proced-font-lock-keywords |
98172
87d64c3d48ac
(proced-mark-face, proced-marked-face)
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98162
diff
changeset
|
326 `(;; (Any) proced marks. |
87d64c3d48ac
(proced-mark-face, proced-marked-face)
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98162
diff
changeset
|
327 (,proced-re-mark . 'proced-mark) |
87d64c3d48ac
(proced-mark-face, proced-marked-face)
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98162
diff
changeset
|
328 ;; Processes marked with `proced-marker-char' |
87d64c3d48ac
(proced-mark-face, proced-marked-face)
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98162
diff
changeset
|
329 ;; Should we make sure that only certain attributes are font-locked? |
87d64c3d48ac
(proced-mark-face, proced-marked-face)
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98162
diff
changeset
|
330 (,(concat "^[" (char-to-string proced-marker-char) "]") |
87d64c3d48ac
(proced-mark-face, proced-marked-face)
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98162
diff
changeset
|
331 ".+" (proced-move-to-goal-column) nil (0 'proced-marked)))) |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
332 |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
333 (defvar proced-mode-map |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
334 (let ((km (make-sparse-keymap))) |
95135
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
335 ;; moving |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
336 (define-key km " " 'proced-next-line) |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
337 (define-key km "n" 'next-line) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
338 (define-key km "p" 'previous-line) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
339 (define-key km "\C-n" 'next-line) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
340 (define-key km "\C-p" 'previous-line) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
341 (define-key km "\C-?" 'previous-line) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
342 (define-key km [down] 'next-line) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
343 (define-key km [up] 'previous-line) |
95135
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
344 ;; marking |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
345 (define-key km "d" 'proced-mark) ; Dired compatibility ("delete") |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
346 (define-key km "m" 'proced-mark) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
347 (define-key km "u" 'proced-unmark) |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
348 (define-key km "\177" 'proced-unmark-backward) |
95135
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
349 (define-key km "M" 'proced-mark-all) |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
350 (define-key km "U" 'proced-unmark-all) |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
351 (define-key km "t" 'proced-toggle-marks) |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
352 (define-key km "C" 'proced-mark-children) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
353 (define-key km "P" 'proced-mark-parents) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
354 ;; filtering |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
355 (define-key km "f" 'proced-filter-interactive) |
98162
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
356 (define-key km [mouse-2] 'proced-refine) |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
357 (define-key km "\C-m" 'proced-refine) |
95135
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
358 ;; sorting |
94621
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
359 (define-key km "sc" 'proced-sort-pcpu) |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
360 (define-key km "sm" 'proced-sort-pmem) |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
361 (define-key km "sp" 'proced-sort-pid) |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
362 (define-key km "ss" 'proced-sort-start) |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
363 (define-key km "sS" 'proced-sort-interactive) |
94621
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
364 (define-key km "st" 'proced-sort-time) |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
365 (define-key km "su" 'proced-sort-user) |
98162
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
366 ;; similar to `Buffer-menu-sort-by-column' |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
367 (define-key km [header-line mouse-1] 'proced-sort-header) |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
368 (define-key km [header-line mouse-2] 'proced-sort-header) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
369 ;; formatting |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
370 (define-key km "F" 'proced-format-interactive) |
95135
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
371 ;; operate |
97522
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
372 (define-key km "o" 'proced-omit-processes) |
95135
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
373 (define-key km "x" 'proced-send-signal) ; Dired compatibility |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
374 (define-key km "k" 'proced-send-signal) ; kill processes |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
375 ;; misc |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
376 (define-key km "g" 'revert-buffer) ; Dired compatibility |
95135
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
377 (define-key km "h" 'describe-mode) |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
378 (define-key km "?" 'proced-help) |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
379 (define-key km "q" 'quit-window) |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
380 (define-key km [remap undo] 'proced-undo) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
381 (define-key km [remap advertised-undo] 'proced-undo) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
382 km) |
97522
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
383 "Keymap for proced commands.") |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
384 |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
385 (easy-menu-define |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
386 proced-menu proced-mode-map "Proced Menu" |
97522
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
387 `("Proced" |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
388 ["Mark" proced-mark |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
389 :help "Mark Current Process"] |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
390 ["Unmark" proced-unmark |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
391 :help "Unmark Current Process"] |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
392 ["Mark All" proced-mark-all |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
393 :help "Mark All Processes"] |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
394 ["Unmark All" proced-unmark-all |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
395 :help "Unmark All Process"] |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
396 ["Toggle Marks" proced-toggle-marks |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
397 :help "Marked Processes Become Unmarked, and Vice Versa"] |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
398 ["Mark Children" proced-mark-children |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
399 :help "Mark Current Process and its Children"] |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
400 ["Mark Parents" proced-mark-parents |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
401 :help "Mark Current Process and its Parents"] |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
402 "--" |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
403 ("Filters" |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
404 :help "Select Filter for Process Listing" |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
405 ,@(mapcar (lambda (el) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
406 (let ((filter (car el))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
407 `[,(symbol-name filter) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
408 (proced-filter-interactive ',filter) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
409 :style radio |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
410 :selected (eq proced-filter ',filter)])) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
411 proced-filter-alist)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
412 ("Sorting" |
98162
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
413 :help "Select Sort Scheme" |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
414 ["Sort..." proced-sort-interactive |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
415 :help "Sort Process List"] |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
416 "--" |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
417 ["Sort by %CPU" proced-sort-pcpu] |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
418 ["Sort by %MEM" proced-sort-pmem] |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
419 ["Sort by PID" proced-sort-pid] |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
420 ["Sort by START" proced-sort-start] |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
421 ["Sort by TIME" proced-sort-time] |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
422 ["Sort by USER" proced-sort-user]) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
423 ("Formats" |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
424 :help "Select Format for Process Listing" |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
425 ,@(mapcar (lambda (el) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
426 (let ((format (car el))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
427 `[,(symbol-name format) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
428 (proced-format-interactive ',format) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
429 :style radio |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
430 :selected (eq proced-format ',format)])) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
431 proced-format-alist)) |
94621
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
432 "--" |
97522
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
433 ["Omit Marked Processes" proced-omit-processes |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
434 :help "Omit Marked Processes in Process Listing."] |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
435 "--" |
97522
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
436 ["Revert" revert-buffer |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
437 :help "Revert Process Listing"] |
98162
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
438 ["Auto Update" proced-toggle-timer-flag |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
439 :style radio |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
440 :selected (eval proced-timer-flag) |
98162
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
441 :help "Auto Update of Proced Buffer"] |
97522
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
442 ["Send signal" proced-send-signal |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
443 :help "Send Signal to Marked Processes"])) |
97522
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
444 |
95135
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
445 ;; helper functions |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
446 (defun proced-marker-regexp () |
94621
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
447 "Return regexp matching `proced-marker-char'." |
95135
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
448 ;; `proced-marker-char' must appear in column zero |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
449 (concat "^" (regexp-quote (char-to-string proced-marker-char)))) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
450 |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
451 (defun proced-success-message (action count) |
94621
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
452 "Display success message for ACTION performed for COUNT processes." |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
453 (message "%s %s process%s" action count (if (= 1 count) "" "es"))) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
454 |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
455 ;; Unlike dired, we do not define our own commands for vertical motion. |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
456 ;; If `goal-column' is set, `next-line' and `previous-line' are fancy |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
457 ;; commands to satisfy our modest needs. If `proced-goal-attribute' |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
458 ;; and/or `goal-column' are not set, `next-line' and `previous-line' |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
459 ;; are really what we need to preserve the column of point. |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
460 ;; We use `proced-move-to-goal-column' for "non-interactive" cases only |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
461 ;; to get a well-defined position of point. |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
462 |
95135
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
463 (defun proced-move-to-goal-column () |
98162
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
464 "Move to `goal-column' if non-nil. Return position of point." |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
465 (beginning-of-line) |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
466 (unless (eobp) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
467 (if goal-column |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
468 (forward-char goal-column) |
98162
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
469 (forward-char 2))) |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
470 (point)) |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
471 |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
472 (defun proced-header-line () |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
473 "Return header line for Proced buffer." |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
474 (list (propertize " " 'display '(space :align-to 0)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
475 (replace-regexp-in-string ;; preserve text properties |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
476 "\\(%\\)" "\\1\\1" (substring proced-header-line (window-hscroll))))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
477 |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
478 (defun proced-pid-at-point () |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
479 "Return pid of system process at point. |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
480 Return nil if point is not on a process line." |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
481 (save-excursion |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
482 (beginning-of-line) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
483 (if (looking-at "^. .") |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
484 (get-text-property (match-end 0) 'proced-pid)))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
485 |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
486 ;; proced mode |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
487 |
94108
7ab68bf3a905
(proced-mode): Redefine as just the major-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94066
diff
changeset
|
488 (define-derived-mode proced-mode nil "Proced" |
7ab68bf3a905
(proced-mode): Redefine as just the major-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94066
diff
changeset
|
489 "Mode for displaying UNIX system processes and sending signals to them. |
96824
9ebcc98e40f8
(proced-mode, proced): Add \\<proced-mode-map> to docstrings.
Juri Linkov <juri@jurta.org>
parents:
95300
diff
changeset
|
490 Type \\<proced-mode-map>\\[proced-mark] to mark a process for later commands. |
94108
7ab68bf3a905
(proced-mode): Redefine as just the major-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94066
diff
changeset
|
491 Type \\[proced-send-signal] to send signals to marked processes. |
7ab68bf3a905
(proced-mode): Redefine as just the major-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94066
diff
changeset
|
492 |
98162
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
493 The initial content of a listing is defined by the variable `proced-filter' |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
494 and the variable `proced-format'. |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
495 The variable `proced-filter' specifies which system processes are displayed. |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
496 The variable `proced-format' specifies which attributes are displayed for |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
497 each process. Type \\[proced-filter-interactive] and \\[proced-format-interactive] |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
498 to change the values of `proced-filter' and `proced-format'. |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
499 The current value of the variable `proced-filter' is indicated in the |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
500 mode line. |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
501 |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
502 The sort order of Proced listings is defined by the variable `proced-sort'. |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
503 Type \\[proced-sort-interactive] or click on a header in the header line |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
504 to change the sort scheme. The current sort scheme is indicated in the |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
505 mode line, using \"+\" or \"-\" for ascending or descending sort order. |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
506 |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
507 An existing Proced listing can be refined by typing \\[proced-refine] |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
508 with point on the attribute of a process. If point is on the attribute ATTR, |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
509 this compares the value of ATTR of every process with the value of ATTR |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
510 of the process at the position of point. See `proced-refine' for details. |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
511 Refining an existing listing does not update the variable `proced-filter'. |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
512 |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
513 The attribute-specific rules for formatting, filtering, sorting, and refining |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
514 are defined in `proced-grammar-alist'. |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
515 |
94108
7ab68bf3a905
(proced-mode): Redefine as just the major-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94066
diff
changeset
|
516 \\{proced-mode-map}" |
7ab68bf3a905
(proced-mode): Redefine as just the major-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94066
diff
changeset
|
517 (abbrev-mode 0) |
7ab68bf3a905
(proced-mode): Redefine as just the major-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94066
diff
changeset
|
518 (auto-fill-mode 0) |
7ab68bf3a905
(proced-mode): Redefine as just the major-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94066
diff
changeset
|
519 (setq buffer-read-only t |
95168
a031e38a88d4
(proced-header-line): New variable and new function.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
95135
diff
changeset
|
520 truncate-lines t |
a031e38a88d4
(proced-header-line): New variable and new function.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
95135
diff
changeset
|
521 header-line-format '(:eval (proced-header-line))) |
a031e38a88d4
(proced-header-line): New variable and new function.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
95135
diff
changeset
|
522 (add-hook 'post-command-hook 'force-mode-line-update nil t) |
94108
7ab68bf3a905
(proced-mode): Redefine as just the major-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94066
diff
changeset
|
523 (set (make-local-variable 'revert-buffer-function) 'proced-revert) |
7ab68bf3a905
(proced-mode): Redefine as just the major-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94066
diff
changeset
|
524 (set (make-local-variable 'font-lock-defaults) |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
525 '(proced-font-lock-keywords t nil nil beginning-of-line)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
526 (if (and (not proced-timer) proced-timer-interval) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
527 (setq proced-timer |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
528 (run-at-time t proced-timer-interval 'proced-timer)))) |
94108
7ab68bf3a905
(proced-mode): Redefine as just the major-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94066
diff
changeset
|
529 |
7ab68bf3a905
(proced-mode): Redefine as just the major-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94066
diff
changeset
|
530 ;; Proced mode is suitable only for specially formatted data. |
7ab68bf3a905
(proced-mode): Redefine as just the major-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94066
diff
changeset
|
531 (put 'proced-mode 'mode-class 'special) |
7ab68bf3a905
(proced-mode): Redefine as just the major-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94066
diff
changeset
|
532 |
7ab68bf3a905
(proced-mode): Redefine as just the major-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94066
diff
changeset
|
533 ;;;###autoload |
7ab68bf3a905
(proced-mode): Redefine as just the major-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94066
diff
changeset
|
534 (defun proced (&optional arg) |
98162
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
535 "Generate a listing of UNIX system processes. |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
536 If invoked with optional ARG the window displaying the process |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
537 information will be displayed but not selected. |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
538 |
98162
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
539 See `proced-mode' for a descreption of features available in Proced buffers." |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
540 (interactive "P") |
95135
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
541 (let ((buffer (get-buffer-create "*Proced*")) new) |
94621
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
542 (set-buffer buffer) |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
543 (setq new (zerop (buffer-size))) |
94621
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
544 (if new (proced-mode)) |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
545 (if (or new arg) |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
546 (proced-update t)) |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
547 (if arg |
94621
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
548 (display-buffer buffer) |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
549 (pop-to-buffer buffer) |
96824
9ebcc98e40f8
(proced-mode, proced): Add \\<proced-mode-map> to docstrings.
Juri Linkov <juri@jurta.org>
parents:
95300
diff
changeset
|
550 (message |
9ebcc98e40f8
(proced-mode, proced): Add \\<proced-mode-map> to docstrings.
Juri Linkov <juri@jurta.org>
parents:
95300
diff
changeset
|
551 (substitute-command-keys |
9ebcc98e40f8
(proced-mode, proced): Add \\<proced-mode-map> to docstrings.
Juri Linkov <juri@jurta.org>
parents:
95300
diff
changeset
|
552 "Type \\<proced-mode-map>\\[quit-window] to quit, \\[proced-help] for help"))))) |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
553 |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
554 (defun proced-timer () |
98162
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
555 "Auto-update Proced buffers using `run-at-time'." |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
556 (dolist (buf (buffer-list)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
557 (with-current-buffer buf |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
558 (if (and (eq major-mode 'proced-mode) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
559 proced-timer-flag) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
560 (proced-update t t))))) |
95135
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
561 |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
562 (defun proced-toggle-timer-flag (arg) |
98162
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
563 "Change whether this Proced buffer is updated automatically. |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
564 With prefix ARG, update this buffer automatically if ARG is positive, |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
565 otherwise do not update. Sets the variable `proced-timer-flag'. |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
566 The time interval for updates is specified via `proced-timer-interval'." |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
567 (interactive (list (or current-prefix-arg 'toggle))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
568 (setq proced-timer-flag |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
569 (cond ((eq arg 'toggle) (not proced-timer-flag)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
570 (arg (> (prefix-numeric-value arg) 0)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
571 (t (not proced-timer-flag)))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
572 (message "`proced-timer-flag' set to %s" proced-timer-flag)) |
95135
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
573 |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
574 (defun proced-mark (&optional count) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
575 "Mark the current (or next COUNT) processes." |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
576 (interactive "p") |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
577 (proced-do-mark t count)) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
578 |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
579 (defun proced-unmark (&optional count) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
580 "Unmark the current (or next COUNT) processes." |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
581 (interactive "p") |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
582 (proced-do-mark nil count)) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
583 |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
584 (defun proced-unmark-backward (&optional count) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
585 "Unmark the previous (or COUNT previous) processes." |
94621
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
586 ;; Analogous to `dired-unmark-backward', |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
587 ;; but `ibuffer-unmark-backward' behaves different. |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
588 (interactive "p") |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
589 (proced-do-mark nil (- (or count 1)))) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
590 |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
591 (defun proced-do-mark (mark &optional count) |
97522
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
592 "Mark the current (or next COUNT) processes using MARK." |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
593 (or count (setq count 1)) |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
594 (let ((backward (< count 0)) |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
595 buffer-read-only) |
95135
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
596 (setq count (1+ (if (<= 0 count) count |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
597 (min (1- (line-number-at-pos)) (abs count))))) |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
598 (beginning-of-line) |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
599 (while (not (or (zerop (setq count (1- count))) (eobp))) |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
600 (proced-insert-mark mark backward)) |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
601 (proced-move-to-goal-column))) |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
602 |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
603 (defun proced-mark-all () |
97522
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
604 "Mark all processes. |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
605 If `transient-mark-mode' is turned on and the region is active, |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
606 mark the region." |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
607 (interactive) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
608 (proced-do-mark-all t)) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
609 |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
610 (defun proced-unmark-all () |
97522
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
611 "Unmark all processes. |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
612 If `transient-mark-mode' is turned on and the region is active, |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
613 unmark the region." |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
614 (interactive) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
615 (proced-do-mark-all nil)) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
616 |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
617 (defun proced-do-mark-all (mark) |
97522
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
618 "Mark all processes using MARK. |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
619 If `transient-mark-mode' is turned on and the region is active, |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
620 mark the region." |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
621 (let ((count 0) end buffer-read-only) |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
622 (save-excursion |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
623 (if (use-region-p) |
97522
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
624 ;; Operate even on those lines that are only partially a part |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
625 ;; of region. This appears most consistent with |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
626 ;; `proced-move-to-goal-column'. |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
627 (progn (setq end (save-excursion |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
628 (goto-char (region-end)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
629 (unless (looking-at "^") (forward-line)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
630 (point))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
631 (goto-char (region-beginning)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
632 (unless (looking-at "^") (beginning-of-line))) |
97522
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
633 (goto-char (point-min)) |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
634 (setq end (point-max))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
635 (while (< (point) end) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
636 (setq count (1+ count)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
637 (proced-insert-mark mark)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
638 (proced-success-message "Marked" count)))) |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
639 |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
640 (defun proced-toggle-marks () |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
641 "Toggle marks: marked processes become unmarked, and vice versa." |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
642 (interactive) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
643 (let ((mark-re (proced-marker-regexp)) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
644 buffer-read-only) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
645 (save-excursion |
95135
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
646 (goto-char (point-min)) |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
647 (while (not (eobp)) |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
648 (cond ((looking-at mark-re) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
649 (proced-insert-mark nil)) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
650 ((looking-at " ") |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
651 (proced-insert-mark t)) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
652 (t |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
653 (forward-line 1))))))) |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
654 |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
655 (defun proced-insert-mark (mark &optional backward) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
656 "If MARK is non-nil, insert `proced-marker-char'. |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
657 If BACKWARD is non-nil, move one line backwards before inserting the mark. |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
658 Otherwise move one line forward after inserting the mark." |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
659 (if backward (forward-line -1)) |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
660 (insert (if mark proced-marker-char ?\s)) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
661 (delete-char 1) |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
662 (unless backward (forward-line))) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
663 |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
664 (defun proced-mark-children (ppid &optional omit-ppid) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
665 "Mark child processes of process PPID. |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
666 Also mark process PPID unless prefix OMIT-PPID is non-nil." |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
667 (interactive (list (proced-pid-at-point) current-prefix-arg)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
668 (proced-mark-process-alist |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
669 (proced-filter-children proced-process-alist ppid omit-ppid))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
670 |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
671 (defun proced-mark-parents (cpid &optional omit-cpid) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
672 "Mark parent processes of process CPID. |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
673 Also mark CPID unless prefix OMIT-CPID is non-nil." |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
674 (interactive (list (proced-pid-at-point) current-prefix-arg)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
675 (proced-mark-process-alist |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
676 (proced-filter-parents proced-process-alist cpid omit-cpid))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
677 |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
678 (defun proced-mark-process-alist (process-alist &optional quiet) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
679 (let ((count 0)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
680 (if process-alist |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
681 (let (buffer-read-only) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
682 (save-excursion |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
683 (goto-char (point-min)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
684 (while (not (eobp)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
685 (when (assq (proced-pid-at-point) process-alist) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
686 (insert proced-marker-char) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
687 (delete-char 1) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
688 (setq count (1+ count))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
689 (forward-line))))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
690 (unless quiet |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
691 (proced-success-message "Marked" count)))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
692 |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
693 ;; Mostly analog of `dired-do-kill-lines'. |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
694 ;; However, for negative args the target lines of `dired-do-kill-lines' |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
695 ;; include the current line, whereas `dired-mark' for negative args operates |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
696 ;; on the preceding lines. Here we are consistent with `dired-mark'. |
97522
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
697 (defun proced-omit-processes (&optional arg quiet) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
698 "Omit marked processes. |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
699 With prefix ARG, omit that many lines starting with the current line. |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
700 \(A negative argument omits backward.) |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
701 If `transient-mark-mode' is turned on and the region is active, |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
702 omit the processes in region. |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
703 If QUIET is non-nil suppress status message. |
97522
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
704 Returns count of omitted lines." |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
705 (interactive "P") |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
706 (let ((mark-re (proced-marker-regexp)) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
707 (count 0) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
708 buffer-read-only) |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
709 (cond ((use-region-p) ;; Omit active region |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
710 (let ((lines (count-lines (region-beginning) (region-end)))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
711 (save-excursion |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
712 (goto-char (region-beginning)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
713 (while (< count lines) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
714 (proced-omit-process) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
715 (setq count (1+ count)))))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
716 ((not arg) ;; Omit marked lines |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
717 (save-excursion |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
718 (goto-char (point-min)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
719 (while (and (not (eobp)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
720 (re-search-forward mark-re nil t)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
721 (proced-omit-process) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
722 (setq count (1+ count))))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
723 ((< 0 arg) ;; Omit forward |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
724 (while (and (not (eobp)) (< count arg)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
725 (proced-omit-process) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
726 (setq count (1+ count)))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
727 ((< arg 0) ;; Omit backward |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
728 (while (and (not (bobp)) (< count (- arg))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
729 (forward-line -1) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
730 (proced-omit-process) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
731 (setq count (1+ count))))) |
95135
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
732 (unless (zerop count) (proced-move-to-goal-column)) |
97522
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
733 (unless quiet (proced-success-message "Omitted" count)) |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
734 count)) |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
735 |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
736 (defun proced-omit-process () |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
737 "Omit process from listing point is on. |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
738 Update `proced-process-alist' accordingly." |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
739 (setq proced-process-alist |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
740 (assq-delete-all (proced-pid-at-point) proced-process-alist)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
741 (delete-region (line-beginning-position) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
742 (save-excursion (forward-line) (point)))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
743 |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
744 ;;; Filtering |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
745 |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
746 (defun proced-filter (process-alist filter-list) |
98162
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
747 "Apply FILTER-LIST to PROCESS-ALIST. |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
748 Return the filtered process list." |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
749 (if (symbolp filter-list) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
750 (setq filter-list (cdr (assq filter-list proced-filter-alist)))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
751 (dolist (filter filter-list) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
752 (let (new-alist) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
753 (cond ( ;; apply function to entire process list |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
754 (eq (car filter) 'fun-all) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
755 (setq new-alist (funcall (cdr filter) process-alist))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
756 ( ;; apply predicate to each list of attributes |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
757 (eq (car filter) 'function) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
758 (dolist (process process-alist) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
759 (if (funcall (car filter) (cdr process)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
760 (push process new-alist)))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
761 (t ;; apply predicate to specified attribute |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
762 (let ((fun (if (stringp (cdr filter)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
763 `(lambda (val) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
764 (string-match ,(cdr filter) val)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
765 (cdr filter))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
766 value) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
767 (dolist (process process-alist) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
768 (setq value (cdr (assq (car filter) (cdr process)))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
769 (if (and value (funcall fun value)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
770 (push process new-alist)))))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
771 (setq process-alist new-alist))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
772 process-alist) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
773 |
98162
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
774 (defun proced-filter-interactive (scheme) |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
775 "Filter Proced buffer using SCHEME. |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
776 When called interactively, an empty string means nil, i.e., no filtering. |
98162
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
777 Set variable `proced-filter' to SCHEME. Revert listing." |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
778 (interactive |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
779 (let ((scheme (completing-read "Filter: " |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
780 proced-filter-alist nil t))) |
98162
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
781 (list (if (string= "" scheme) nil (intern scheme))))) |
98172
87d64c3d48ac
(proced-mark-face, proced-marked-face)
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98162
diff
changeset
|
782 ;; only update if necessary |
87d64c3d48ac
(proced-mark-face, proced-marked-face)
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98162
diff
changeset
|
783 (unless (eq proced-filter scheme) |
87d64c3d48ac
(proced-mark-face, proced-marked-face)
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98162
diff
changeset
|
784 (setq proced-filter scheme) |
87d64c3d48ac
(proced-mark-face, proced-marked-face)
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98162
diff
changeset
|
785 (proced-update t))) |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
786 |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
787 (defun proced-process-tree (process-alist) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
788 "Return process tree for PROCESS-ALIST. |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
789 The process tree is an alist with elements (PPID PID1 PID2 ...). |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
790 PPID is a parent PID. PID1, PID2, ... are the child processes of PPID. |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
791 The list of children does not include grandchildren." |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
792 (let (children-list ppid cpids) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
793 (dolist (process process-alist children-list) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
794 (setq ppid (cdr (assq 'ppid (cdr process)))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
795 (if ppid |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
796 (setq children-list |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
797 (if (setq cpids (assq ppid children-list)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
798 (cons (cons ppid (cons (car process) (cdr cpids))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
799 (assq-delete-all ppid children-list)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
800 (cons (list ppid (car process)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
801 children-list))))))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
802 |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
803 (defun proced-filter-children (process-alist ppid &optional omit-ppid) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
804 "For PROCESS-ALIST return list of child processes of PPID. |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
805 This list includes PPID unless OMIT-PPID is non-nil." |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
806 (let ((proced-process-tree (proced-process-tree process-alist)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
807 new-alist) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
808 (dolist (pid (proced-children-pids ppid)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
809 (push (assq pid process-alist) new-alist)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
810 (if omit-ppid |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
811 (assq-delete-all ppid new-alist) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
812 new-alist))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
813 |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
814 ;; helper function |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
815 (defun proced-children-pids (ppid) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
816 "Return list of children PIDs of PPID (including PPID)." |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
817 (let ((cpids (cdr (assq ppid proced-process-tree)))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
818 (if cpids |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
819 (cons ppid (apply 'append (mapcar 'proced-children-pids cpids))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
820 (list ppid)))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
821 |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
822 (defun proced-filter-parents (process-alist pid &optional omit-pid) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
823 "For PROCESS-ALIST return list of parent processes of PID. |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
824 This list includes CPID unless OMIT-CPID is non-nil." |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
825 (let ((parent-list (unless omit-pid (list (assq pid process-alist))))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
826 (while (setq pid (cdr (assq 'ppid (cdr (assq pid process-alist))))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
827 (push (assq pid process-alist) parent-list)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
828 parent-list)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
829 |
98162
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
830 ;; Refining |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
831 |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
832 ;; Filters are used to select the processes in a new listing. |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
833 ;; Refiners are used to narrow down further (interactively) the processes |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
834 ;; in an existing listing. |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
835 |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
836 (defun proced-refine (&optional event) |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
837 "Refine Proced listing by comparing with the attribute value at point. |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
838 Optional EVENT is the location of the Proced field. |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
839 |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
840 If point is on the attribute ATTR, this command compares the value of ATTR |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
841 of every process with the value of ATTR of the process at the position |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
842 of point. One can select processes for which the value of ATTR is |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
843 \"less than\", \"equal\", and / or \"larger\" than ATTR of the process |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
844 point is on. |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
845 |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
846 The predicate for the comparison of two ATTR values is defined |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
847 in `proced-grammar-alist'. For each return value of the predicate |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
848 a refine flag is defined in `proced-grammar-alist'. A process is included |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
849 in the new listing if the refine flag for the return value of the predicate |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
850 is non-nil. |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
851 The help-echo string for `proced-refine' uses \"+\" or \"-\" to indicate |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
852 the current values of the refine flags. |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
853 |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
854 This command refines an already existing process listing based initially |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
855 on the variable `proced-filter'. It does not change this variable. |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
856 It does not revert the listing. If you frequently need a certain refinement, |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
857 consider defining a new filter in `proced-filter-alist'." |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
858 (interactive (list last-input-event)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
859 (if event (posn-set-point (event-end event))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
860 (let ((key (get-text-property (point) 'proced-key)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
861 (pid (get-text-property (point) 'proced-pid))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
862 (if (and key pid) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
863 (let* ((grammar (assq key proced-grammar-alist)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
864 (predicate (nth 4 grammar)) |
98162
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
865 (refiner (nth 7 grammar)) |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
866 (ref (cdr (assq key (cdr (assq pid proced-process-alist))))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
867 val new-alist) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
868 (when ref |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
869 (dolist (process proced-process-alist) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
870 (setq val (funcall predicate (cdr (assq key (cdr process))) ref)) |
98162
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
871 (if (cond ((not val) (nth 2 refiner)) |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
872 ((eq val 'equal) (nth 1 refiner)) |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
873 (val (car refiner))) |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
874 (push process new-alist))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
875 (setq proced-process-alist new-alist) |
98162
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
876 ;; Do not revert listing. |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
877 (proced-update))) |
98162
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
878 (message "No refiner defined here.")))) |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
879 |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
880 ;; Proced predicates for sorting and filtering are based on a three-valued |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
881 ;; logic: |
98162
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
882 ;; Predicates take two arguments P1 and P2, the corresponding attribute |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
883 ;; values of two processes. Predicates should return 'equal if P1 has |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
884 ;; same rank like P2. Any other non-nil value says that P1 is "less than" P2, |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
885 ;; or nil if not. |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
886 |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
887 (defun proced-< (num1 num2) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
888 "Return t if NUM1 less than NUM2. |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
889 Return `equal' if NUM1 equals NUM2. Return nil if NUM1 greater than NUM2." |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
890 (if (= num1 num2) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
891 'equal |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
892 (< num1 num2))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
893 |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
894 (defun proced-string-lessp (s1 s2) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
895 "Return t if string S1 is less than S2 in lexicographic order. |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
896 Return `equal' if S1 and S2 have identical contents. |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
897 Return nil otherwise." |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
898 (if (string= s1 s2) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
899 'equal |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
900 (string-lessp s1 s2))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
901 |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
902 (defun proced-time-lessp (t1 t2) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
903 "Return t if time value T1 is less than time value T2. |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
904 Return `equal' if T1 equals T2. Return nil otherwise." |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
905 (with-decoded-time-value ((high1 low1 micro1 t1) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
906 (high2 low2 micro2 t2)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
907 (cond ((< high1 high2)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
908 ((< high2 high1) nil) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
909 ((< low1 low2)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
910 ((< low2 low1) nil) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
911 ((< micro1 micro2)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
912 ((< micro2 micro1) nil) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
913 (t 'equal)))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
914 |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
915 ;;; Sorting |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
916 |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
917 (defsubst proced-xor (b1 b2) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
918 "Return the logical exclusive or of args B1 and B2." |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
919 (and (or b1 b2) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
920 (not (and b1 b2)))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
921 |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
922 (defun proced-sort-p (p1 p2) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
923 "Predicate for sorting processes P1 and P2." |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
924 (if (not (cdr proced-sort-internal)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
925 ;; only one predicate: fast scheme |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
926 (let* ((sorter (car proced-sort-internal)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
927 (k1 (cdr (assq (car sorter) (cdr p1)))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
928 (k2 (cdr (assq (car sorter) (cdr p2))))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
929 ;; if the attributes are undefined, we should really abort sorting |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
930 (if (and k1 k2) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
931 (proced-xor (funcall (nth 1 sorter) k1 k2) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
932 (nth 2 sorter)))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
933 (let ((sort-list proced-sort-internal) sorter predicate k1 k2) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
934 (catch 'done |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
935 (while (setq sorter (pop sort-list)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
936 (setq k1 (cdr (assq (car sorter) (cdr p1))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
937 k2 (cdr (assq (car sorter) (cdr p2))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
938 predicate |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
939 (if (and k1 k2) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
940 (funcall (nth 1 sorter) k1 k2))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
941 (if (not (eq predicate 'equal)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
942 (throw 'done (proced-xor predicate (nth 2 sorter))))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
943 (eq t predicate))))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
944 |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
945 (defun proced-sort (process-alist sorter) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
946 "Sort PROCESS-ALIST using scheme SORTER. |
98162
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
947 Return the sorted process list." |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
948 ;; translate SORTER into a list of lists (KEY PREDICATE REVERSE) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
949 (setq proced-sort-internal |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
950 (mapcar (lambda (arg) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
951 (let ((grammar (assq arg proced-grammar-alist))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
952 (list arg (nth 4 grammar) (nth 5 grammar)))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
953 (cond ((listp sorter) sorter) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
954 ((and (symbolp sorter) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
955 (nth 6 (assq sorter proced-grammar-alist)))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
956 ((symbolp sorter) (list sorter)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
957 (t (error "Sorter undefined %s" sorter))))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
958 (if proced-sort-internal |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
959 (sort process-alist 'proced-sort-p) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
960 process-alist)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
961 |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
962 (defun proced-sort-interactive (scheme &optional revert) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
963 "Sort Proced buffer using SCHEME. |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
964 When called interactively, an empty string means nil, i.e., no sorting. |
98162
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
965 With prefix REVERT non-nil revert listing. |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
966 |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
967 Set variable `proced-sort' to SCHEME. The current sort scheme is displayed |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
968 in the mode line, using \"+\" or \"-\" for ascending or descending order." |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
969 (interactive |
98162
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
970 (let ((scheme (completing-read "Sort attribute: " |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
971 proced-grammar-alist nil t))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
972 (list (if (string= "" scheme) nil (intern scheme)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
973 current-prefix-arg))) |
98172
87d64c3d48ac
(proced-mark-face, proced-marked-face)
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98162
diff
changeset
|
974 ;; only update if necessary |
87d64c3d48ac
(proced-mark-face, proced-marked-face)
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98162
diff
changeset
|
975 (when (or (not (eq proced-sort scheme)) revert) |
87d64c3d48ac
(proced-mark-face, proced-marked-face)
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98162
diff
changeset
|
976 (setq proced-sort scheme) |
87d64c3d48ac
(proced-mark-face, proced-marked-face)
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98162
diff
changeset
|
977 (proced-update revert))) |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
978 |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
979 (defun proced-sort-pcpu (&optional revert) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
980 "Sort Proced buffer by percentage CPU time (%CPU)." |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
981 (interactive "P") |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
982 (proced-sort-interactive 'pcpu revert)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
983 |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
984 (defun proced-sort-pmem (&optional revert) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
985 "Sort Proced buffer by percentage memory usage (%MEM)." |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
986 (interactive "P") |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
987 (proced-sort-interactive 'pmem)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
988 |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
989 (defun proced-sort-pid (&optional revert) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
990 "Sort Proced buffer by PID." |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
991 (interactive "P") |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
992 (proced-sort-interactive 'pid revert)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
993 |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
994 (defun proced-sort-start (&optional revert) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
995 "Sort Proced buffer by time the command started (START)." |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
996 (interactive "P") |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
997 (proced-sort-interactive 'start revert)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
998 |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
999 (defun proced-sort-time (&optional revert) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1000 "Sort Proced buffer by CPU time (TIME)." |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1001 (interactive "P") |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1002 (proced-sort-interactive 'time revert)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1003 |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1004 (defun proced-sort-user (&optional revert) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1005 "Sort Proced buffer by USER." |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1006 (interactive "P") |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1007 (proced-sort-interactive 'user revert)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1008 |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1009 (defun proced-sort-header (event &optional revert) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1010 "Sort Proced listing based on an attribute. |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1011 EVENT is a mouse event with starting position in the header line. |
98162
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
1012 It is converted in the corresponding attribute key. |
98172
87d64c3d48ac
(proced-mark-face, proced-marked-face)
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98162
diff
changeset
|
1013 This command updates the variable `proced-sort'." |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1014 (interactive "e\nP") |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1015 (let ((start (event-start event)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1016 col key) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1017 (save-selected-window |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1018 (select-window (posn-window start)) |
98172
87d64c3d48ac
(proced-mark-face, proced-marked-face)
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98162
diff
changeset
|
1019 (setq col (+ (1- (car (posn-actual-col-row start))) |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1020 (window-hscroll))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1021 (when (and (<= 0 col) (< col (length proced-header-line))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1022 (setq key (get-text-property col 'proced-key proced-header-line)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1023 (if key |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1024 (proced-sort-interactive key revert) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1025 (message "No sorter defined here.")))))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1026 |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1027 ;;; Formating |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1028 |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1029 (defun proced-format-time (time) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1030 "Format time intervall TIME." |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1031 (let* ((ftime (float-time time)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1032 (days (truncate ftime 86400)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1033 (ftime (mod ftime 86400)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1034 (hours (truncate ftime 3600)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1035 (ftime (mod ftime 3600)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1036 (minutes (truncate ftime 60)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1037 (seconds (mod ftime 60))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1038 (cond ((< 0 days) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1039 (format "%d-%02d:%02d:%02d" days hours minutes seconds)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1040 ((< 0 hours) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1041 (format "%02d:%02d:%02d" hours minutes seconds)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1042 (t |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1043 (format "%02d:%02d" minutes seconds))))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1044 |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1045 (defun proced-format-start (start) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1046 "Format time START. |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1047 The return string is always 6 characters wide." |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1048 (let ((d-start (decode-time start)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1049 (d-current (decode-time))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1050 (cond ( ;; process started in previous years |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1051 (< (nth 5 d-start) (nth 5 d-current)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1052 (format-time-string " %Y" start)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1053 ;; process started today |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1054 ((and (= (nth 3 d-start) (nth 3 d-current)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1055 (= (nth 4 d-start) (nth 4 d-current))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1056 (format-time-string " %H:%M" start)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1057 (t ;; process started this year |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1058 (format-time-string "%b %e" start))))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1059 |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1060 (defun proced-format-ttname (ttname) |
98162
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
1061 "Format attribute TTNAME, omitting path \"/dev/\"." |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1062 ;; Does this work for all systems? |
98162
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
1063 (substring ttname (if (string-match "\\`/dev/" ttname) |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
1064 (match-end 0) 0))) |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
1065 |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
1066 (defun proced-format-args (args) |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
1067 "Format attribute ARGS. |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
1068 Replace newline characters by \"^J\" (two characters)." |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
1069 (replace-regexp-in-string "\n" "^J" args)) |
95168
a031e38a88d4
(proced-header-line): New variable and new function.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
95135
diff
changeset
|
1070 |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1071 (defun proced-format (process-alist format) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1072 "Display PROCESS-ALIST using FORMAT." |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1073 (if (symbolp format) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1074 (setq format (cdr (assq format proced-format-alist)))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1075 (insert (make-string (length process-alist) ?\n)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1076 (let ((whitespace " ") header-list grammar) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1077 ;; Loop over all attributes |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1078 (while (setq grammar (pop format)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1079 (if (symbolp grammar) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1080 (setq grammar (assq grammar proced-grammar-alist))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1081 (let* ((key (car grammar)) |
98162
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
1082 (fun (cond ((stringp (nth 2 grammar)) |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
1083 `(lambda (arg) (format ,(nth 2 grammar) arg))) |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
1084 ((not (nth 2 grammar)) 'identity) |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
1085 ( t (nth 2 grammar)))) |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1086 (whitespace (if format whitespace "")) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1087 ;; Text properties: |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1088 ;; We use the text property `proced-key' to store in each |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1089 ;; field the corresponding key. |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1090 ;; Of course, the sort predicate appearing in help-echo |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1091 ;; is only part of the story. But it gives the main idea. |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1092 (hprops `(proced-key ,key mouse-face highlight |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1093 help-echo ,(format proced-header-help-echo |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1094 (if (nth 5 grammar) "-" "+") |
98162
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
1095 (nth 1 grammar) |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
1096 (if (nth 5 grammar) "descending" "ascending")))) |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1097 (fprops `(proced-key ,key mouse-face highlight |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1098 help-echo ,(format proced-field-help-echo |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1099 (nth 1 grammar) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1100 (mapconcat (lambda (s) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1101 (if s "+" "-")) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1102 (nth 7 grammar) "")))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1103 value) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1104 |
98162
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
1105 ;; highlight the header of the sort column |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
1106 (if (eq key proced-sort) |
98172
87d64c3d48ac
(proced-mark-face, proced-marked-face)
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98162
diff
changeset
|
1107 (setq hprops (append '(face proced-sort-header) hprops))) |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1108 (goto-char (point-min)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1109 (cond ( ;; fixed width of output field |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1110 (numberp (nth 3 grammar)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1111 (dolist (process process-alist) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1112 (end-of-line) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1113 (setq value (cdr (assq key (cdr process)))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1114 (insert (if value |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1115 (apply 'propertize (funcall fun value) fprops) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1116 (make-string (abs (nth 3 grammar)) ?\s)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1117 whitespace) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1118 (forward-line)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1119 (push (format (concat "%" (number-to-string (nth 3 grammar)) "s") |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1120 (apply 'propertize (nth 1 grammar) hprops)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1121 header-list)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1122 |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1123 ( ;; last field left-justified |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1124 (and (not format) (eq 'left (nth 3 grammar))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1125 (dolist (process process-alist) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1126 (end-of-line) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1127 (setq value (cdr (assq key (cdr process)))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1128 (if value (insert (apply 'propertize (funcall fun value) fprops))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1129 (forward-line)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1130 (push (apply 'propertize (nth 1 grammar) hprops) header-list)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1131 |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1132 (t ;; calculated field width |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1133 (let ((width (length (nth 1 grammar))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1134 field-list value) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1135 (dolist (process process-alist) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1136 (setq value (cdr (assq key (cdr process)))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1137 (if value |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1138 (setq value (apply 'propertize (funcall fun value) fprops) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1139 width (max width (length value)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1140 field-list (cons value field-list)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1141 (push "" field-list))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1142 (let ((afmt (concat "%" (if (eq 'left (nth 3 grammar)) "-" "") |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1143 (number-to-string width) "s"))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1144 (push (format afmt (apply 'propertize (nth 1 grammar) hprops)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1145 header-list) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1146 (dolist (value (nreverse field-list)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1147 (end-of-line) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1148 (insert (format afmt value) whitespace) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1149 (forward-line)))))))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1150 |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1151 ;; final cleanup |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1152 (goto-char (point-min)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1153 (dolist (process process-alist) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1154 ;; We use the text property `proced-pid' to store in each line |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1155 ;; the corresponding pid |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1156 (put-text-property (point) (line-end-position) 'proced-pid (car process)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1157 (forward-line)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1158 ;; Set header line |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1159 (setq proced-header-line |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1160 (mapconcat 'identity (nreverse header-list) whitespace)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1161 (if (string-match "[ \t]+$" proced-header-line) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1162 (setq proced-header-line (substring proced-header-line 0 |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1163 (match-beginning 0)))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1164 ;; (delete-trailing-whitespace) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1165 (goto-char (point-min)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1166 (while (re-search-forward "[ \t\r]+$" nil t) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1167 (delete-region (match-beginning 0) (match-end 0))))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1168 |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1169 (defun proced-format-interactive (scheme &optional revert) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1170 "Format Proced buffer using SCHEME. |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1171 When called interactively, an empty string means nil, i.e., no formatting. |
98162
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
1172 Set variable `proced-format' to SCHEME. |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1173 With prefix REVERT non-nil revert listing." |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1174 (interactive |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1175 (let ((scheme (completing-read "Format: " |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1176 proced-format-alist nil t))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1177 (list (if (string= "" scheme) nil (intern scheme)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1178 current-prefix-arg))) |
98172
87d64c3d48ac
(proced-mark-face, proced-marked-face)
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98162
diff
changeset
|
1179 ;; only update if necessary |
87d64c3d48ac
(proced-mark-face, proced-marked-face)
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98162
diff
changeset
|
1180 (when (or (not (eq proced-format scheme)) revert) |
87d64c3d48ac
(proced-mark-face, proced-marked-face)
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98162
diff
changeset
|
1181 (setq proced-format scheme) |
87d64c3d48ac
(proced-mark-face, proced-marked-face)
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98162
diff
changeset
|
1182 (proced-update revert))) |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1183 |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1184 ;; generate listing |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1185 |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1186 (defun proced-process-attributes () |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1187 "Return alist of attributes for each system process. |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1188 This alist can be customized via `proced-custom-attributes'." |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1189 (mapcar (lambda (pid) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1190 (let* ((attributes (system-process-attributes pid)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1191 (utime (cdr (assq 'utime attributes))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1192 (stime (cdr (assq 'stime attributes))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1193 (cutime (cdr (assq 'cutime attributes))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1194 (cstime (cdr (assq 'cstime attributes)))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1195 (setq attributes |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1196 (append (list (cons 'pid pid)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1197 (if (and utime stime) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1198 (list (cons 'time (time-add utime stime)))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1199 (if (and cutime cstime) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1200 (list (cons 'ctime (time-add cutime cstime)))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1201 attributes)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1202 (dolist (fun proced-custom-attributes) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1203 (push (funcall fun attributes) attributes)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1204 (cons pid attributes))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1205 (list-system-processes))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1206 |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1207 (defun proced-update (&optional revert quiet) |
97522
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1208 "Update the `proced' process information. Preserves point and marks. |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1209 With prefix REVERT non-nil, revert listing. |
97522
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1210 Suppress status information if QUIET is nil." |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
1211 ;; This is the main function that generates and updates the process listing. |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1212 (interactive "P") |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1213 (setq revert (or revert (not proced-process-alist))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1214 (or quiet (message (if revert "Updating process information..." |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1215 "Updating process display..."))) |
98162
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
1216 (if revert ;; evaluate all processes |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
1217 (setq proced-process-alist (proced-process-attributes))) |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
1218 ;; filtering and sorting |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
1219 (setq proced-process-alist |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
1220 (proced-sort (proced-filter proced-process-alist |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
1221 proced-filter) proced-sort)) |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
1222 |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
1223 ;; It is useless to keep undo information if we revert, filter, or |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
1224 ;; refine the listing so that `proced-process-alist' has changed. |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
1225 ;; We could keep the undo information if we only re-sort the buffer. |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
1226 ;; Would that be useful? Re-re-sorting is easy, too. |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
1227 (if (consp buffer-undo-list) |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
1228 (setq buffer-undo-list nil)) |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
1229 (let ((buffer-undo-list t) |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
1230 ;; If point is on a field, we try to return point to that field. |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
1231 ;; Otherwise we try to return to the same column |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
1232 (old-pos (let ((pid (proced-pid-at-point)) |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
1233 (key (get-text-property (point) 'proced-key))) |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
1234 (list pid key ; can both be nil |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1235 (if key |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1236 (if (get-text-property (1- (point)) 'proced-key) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1237 (- (point) (previous-single-property-change |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1238 (point) 'proced-key)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1239 0) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1240 (current-column))))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1241 buffer-read-only mp-list) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1242 ;; remember marked processes (whatever the mark was) |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
1243 (goto-char (point-min)) |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1244 (while (re-search-forward "^\\(\\S-\\)" nil t) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1245 (push (cons (save-match-data (proced-pid-at-point)) |
95135
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
1246 (match-string-no-properties 1)) mp-list)) |
98162
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
1247 |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1248 ;; generate listing |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
1249 (erase-buffer) |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1250 (proced-format proced-process-alist proced-format) |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
1251 (goto-char (point-min)) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
1252 (while (not (eobp)) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
1253 (insert " ") |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
1254 (forward-line)) |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1255 (setq proced-header-line (concat " " proced-header-line)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1256 (if revert (set-buffer-modified-p nil)) |
98162
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
1257 |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1258 ;; set `goal-column' |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1259 (let ((grammar (assq proced-goal-attribute proced-grammar-alist))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1260 (setq goal-column ;; set to nil if no match |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1261 (if (and grammar |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1262 (not (zerop (buffer-size))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1263 (string-match (regexp-quote (nth 1 grammar)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1264 proced-header-line)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1265 (if (nth 3 grammar) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1266 (match-beginning 0) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1267 (match-end 0))))) |
98162
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
1268 |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1269 ;; restore process marks and buffer position (if possible) |
98162
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
1270 ;; FIXME: sometimes this puts point in the middle of the proced buffer |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
1271 ;; where it is not interesting. Is there a better / more flexible solution? |
95135
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
1272 (goto-char (point-min)) |
98162
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
1273 (let (pid mark new-pos) |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
1274 (if (or mp-list (car old-pos)) |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1275 (while (not (eobp)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1276 (setq pid (proced-pid-at-point)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1277 (when (setq mark (assq pid mp-list)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1278 (insert (cdr mark)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1279 (delete-char 1) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1280 (beginning-of-line)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1281 (when (eq (car old-pos) pid) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1282 (if (nth 1 old-pos) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1283 (let ((limit (line-end-position)) pos) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1284 (while (and (not new-pos) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1285 (setq pos (next-property-change (point) nil limit))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1286 (goto-char pos) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1287 (when (eq (nth 1 old-pos) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1288 (get-text-property (point) 'proced-key)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1289 (forward-char (min (nth 2 old-pos) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1290 (- (next-property-change (point)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1291 (point)))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1292 (setq new-pos (point)))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1293 (unless new-pos |
98162
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
1294 ;; we found the process, but the field of point |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
1295 ;; is not listed anymore |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
1296 (setq new-pos (proced-move-to-goal-column)))) |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1297 (setq new-pos (min (+ (line-beginning-position) (nth 2 old-pos)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1298 (line-end-position))))) |
98162
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
1299 (forward-line))) |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
1300 (if new-pos |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
1301 (goto-char new-pos) |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
1302 (goto-char (point-min)) |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
1303 (proced-move-to-goal-column))) |
94621
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
1304 ;; update modeline |
98162
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
1305 ;; Does the long `mode-name' clutter the modeline? It would be nice |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
1306 ;; to have some other location for displaying the values of the various |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
1307 ;; flags that affect the behavior of proced (flags one might want |
d5c5ea23d8ea
(proced-sort-header): New face.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
98064
diff
changeset
|
1308 ;; to change on the fly). Where?? |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1309 (setq mode-name |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1310 (concat "Proced" |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1311 (if proced-filter |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1312 (concat ": " (symbol-name proced-filter)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1313 "") |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1314 (if proced-sort |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1315 (let* ((key (if (listp proced-sort) (car proced-sort) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1316 proced-sort)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1317 (grammar (assq key proced-grammar-alist))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1318 (concat " by " (if (nth 5 grammar) "-" "+") |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1319 (nth 1 grammar))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1320 ""))) |
94621
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
1321 (force-mode-line-update) |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
1322 ;; done |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
1323 (or quiet (input-pending-p) |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1324 (message (if revert "Updating process information...done." |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1325 "Updating process display...done."))))) |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
1326 |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
1327 (defun proced-revert (&rest args) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
1328 "Analog of `revert-buffer'." |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1329 (proced-update t)) |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
1330 |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
1331 ;; I do not want to reinvent the wheel. Should we rename `dired-pop-to-buffer' |
95135
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
1332 ;; and move it to window.el so that proced and ibuffer can easily use it, too? |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
1333 ;; What about functions like `appt-disp-window' that use |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
1334 ;; `shrink-window-if-larger-than-buffer'? |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
1335 (autoload 'dired-pop-to-buffer "dired") |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
1336 |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
1337 (defun proced-send-signal (&optional signal) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
1338 "Send a SIGNAL to the marked processes. |
97522
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1339 If no process is marked, operate on current process. |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
1340 SIGNAL may be a string (HUP, INT, TERM, etc.) or a number. |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
1341 If SIGNAL is nil display marked processes and query interactively for SIGNAL." |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
1342 (interactive) |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1343 (let ((regexp (proced-marker-regexp)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1344 process-alist) |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
1345 ;; collect marked processes |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
1346 (save-excursion |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
1347 (goto-char (point-min)) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
1348 (while (re-search-forward regexp nil t) |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1349 (push (cons (proced-pid-at-point) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1350 ;; How much info should we collect here? |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
1351 (substring (match-string-no-properties 0) 2)) |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1352 process-alist))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1353 (setq process-alist |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1354 (if process-alist |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1355 (nreverse process-alist) |
97522
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1356 ;; take current process |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1357 (list (cons (proced-pid-at-point) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1358 (buffer-substring-no-properties |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1359 (+ 2 (line-beginning-position)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1360 (line-end-position)))))) |
97522
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1361 (unless signal |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1362 ;; Display marked processes (code taken from `dired-mark-pop-up'). |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1363 (let ((bufname " *Marked Processes*") |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1364 (header-line (substring-no-properties proced-header-line))) |
97522
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1365 (with-current-buffer (get-buffer-create bufname) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1366 (setq truncate-lines t |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1367 proced-header-line header-line ; inherit header line |
97522
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1368 header-line-format '(:eval (proced-header-line))) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1369 (add-hook 'post-command-hook 'force-mode-line-update nil t) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1370 (erase-buffer) |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1371 (dolist (process process-alist) |
97522
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1372 (insert " " (cdr process) "\n")) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1373 (save-window-excursion |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1374 (dired-pop-to-buffer bufname) ; all we need |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1375 (let* ((completion-ignore-case t) |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1376 (pnum (if (= 1 (length process-alist)) |
97522
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1377 "1 process" |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1378 (format "%d processes" (length process-alist)))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1379 ;; The following is an ugly hack. Is there a better way |
97522
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1380 ;; to help people like me to remember the signals and |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1381 ;; their meanings? |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1382 (tmp (completing-read (concat "Send signal [" pnum |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1383 "] (default TERM): ") |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1384 proced-signal-list |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1385 nil nil nil nil "TERM"))) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1386 (setq signal (if (string-match "^\\(\\S-+\\)\\s-" tmp) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1387 (match-string 1 tmp) tmp)))))) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1388 ;; send signal |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1389 (let ((count 0) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1390 failures) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1391 ;; Why not always use `signal-process'? See |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1392 ;; http://lists.gnu.org/archive/html/emacs-devel/2008-03/msg02955.html |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1393 (if (functionp proced-signal-function) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1394 ;; use built-in `signal-process' |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1395 (let ((signal (if (stringp signal) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1396 (if (string-match "\\`[0-9]+\\'" signal) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1397 (string-to-number signal) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1398 (make-symbol signal)) |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1399 signal))) ; number |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1400 (dolist (process process-alist) |
97522
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1401 (condition-case err |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1402 (if (zerop (funcall |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1403 proced-signal-function (car process) signal)) |
97522
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1404 (setq count (1+ count)) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1405 (proced-log "%s\n" (cdr process)) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1406 (push (cdr process) failures)) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1407 (error ;; catch errors from failed signals |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1408 (proced-log "%s\n" err) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1409 (proced-log "%s\n" (cdr process)) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1410 (push (cdr process) failures))))) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1411 ;; use external system call |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1412 (let ((signal (concat "-" (if (numberp signal) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1413 (number-to-string signal) signal)))) |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1414 (dolist (process process-alist) |
97522
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1415 (with-temp-buffer |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1416 (condition-case err |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1417 (if (zerop (call-process |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1418 proced-signal-function nil t nil |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1419 signal (number-to-string (car process)))) |
97522
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1420 (setq count (1+ count)) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1421 (proced-log (current-buffer)) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1422 (proced-log "%s\n" (cdr process)) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1423 (push (cdr process) failures)) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1424 (error ;; catch errors from failed signals |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1425 (proced-log (current-buffer)) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1426 (proced-log "%s\n" (cdr process)) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1427 (push (cdr process) failures))))))) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1428 (if failures |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1429 ;; Proced error message are not always very precise. |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1430 ;; Can we issue a useful one-line summary in the |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1431 ;; message area (using FAILURES) if only one signal failed? |
97522
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1432 (proced-log-summary |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1433 signal |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1434 (format "%d of %d signal%s failed" |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1435 (length failures) (length process-alist) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1436 (if (= 1 (length process-alist)) "" "s"))) |
97522
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1437 (proced-success-message "Sent signal to" count))) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1438 ;; final clean-up |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1439 (run-hooks 'proced-after-send-signal-hook)))) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1440 |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1441 ;; similar to `dired-why' |
97522
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1442 (defun proced-why () |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1443 "Pop up a buffer with error log output from Proced. |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1444 A group of errors from a single command ends with a formfeed. |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1445 Thus, use \\[backward-page] to find the beginning of a group of errors." |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1446 (interactive) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1447 (if (get-buffer proced-log-buffer) |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1448 (save-selected-window |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1449 ;; move `proced-log-buffer' to the front of the buffer list |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1450 (select-window (display-buffer (get-buffer proced-log-buffer))) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1451 (setq truncate-lines t) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1452 (set-buffer-modified-p nil) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1453 (setq buffer-read-only t) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1454 (goto-char (point-max)) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1455 (forward-line -1) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1456 (backward-page 1) |
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1457 (recenter 0)))) |
97522
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1458 |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1459 ;; similar to `dired-log' |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1460 (defun proced-log (log &rest args) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1461 "Log a message or the contents of a buffer. |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1462 If LOG is a string and there are more args, it is formatted with |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1463 those ARGS. Usually the LOG string ends with a \\n. |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1464 End each bunch of errors with (proced-log t signal): |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1465 this inserts the current time, buffer and signal at the start of the page, |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1466 and \f (formfeed) at the end." |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1467 (let ((obuf (current-buffer))) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1468 (with-current-buffer (get-buffer-create proced-log-buffer) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1469 (goto-char (point-max)) |
98064
9ec9b806fd81
Require time-date.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97524
diff
changeset
|
1470 (let (buffer-read-only) |
97522
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1471 (cond ((stringp log) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1472 (insert (if args |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1473 (apply 'format log args) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1474 log))) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1475 ((bufferp log) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1476 (insert-buffer-substring log)) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1477 ((eq t log) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1478 (backward-page 1) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1479 (unless (bolp) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1480 (insert "\n")) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1481 (insert (current-time-string) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1482 "\tBuffer `" (buffer-name obuf) "', " |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1483 (format "signal `%s'\n" (car args))) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1484 (goto-char (point-max)) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1485 (insert "\f\n"))))))) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1486 |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1487 ;; similar to `dired-log-summary' |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1488 (defun proced-log-summary (signal string) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1489 "State a summary of SIGNAL's failures, in echo area and log buffer. |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1490 STRING is an overall summary of the failures." |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1491 (message "Signal %s: %s--type ? for details" signal string) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1492 ;; Log a summary describing a bunch of errors. |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1493 (proced-log (concat "\n" string "\n")) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1494 (proced-log t signal)) |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
1495 |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
1496 (defun proced-help () |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
1497 "Provide help for the `proced' user." |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
1498 (interactive) |
97522
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1499 (proced-why) |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
1500 (if (eq last-command 'proced-help) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
1501 (describe-mode) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
1502 (message proced-help-string))) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
1503 |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
1504 (defun proced-undo () |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
1505 "Undo in a proced buffer. |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
1506 This doesn't recover killed processes, it just undoes changes in the proced |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
1507 buffer. You can use it to recover marks." |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
1508 (interactive) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
1509 (let (buffer-read-only) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
1510 (undo)) |
95135
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
1511 (message "Change in Proced buffer undone. |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
1512 Killed processes cannot be recovered by Emacs.")) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
1513 |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
1514 (provide 'proced) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
1515 |
93248
072dbbf778d2
Add arch-tag.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93213
diff
changeset
|
1516 ;; arch-tag: a6e312ad-9032-45aa-972d-31a8cfc545af |
97522
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
1517 ;;; proced.el ends here |