Mercurial > emacs
annotate lisp/proced.el @ 97707:eace908aca16
*** empty log message ***
author | Eli Zaretskii <eliz@gnu.org> |
---|---|
date | Mon, 25 Aug 2008 21:51:40 +0000 |
parents | 9709454b59a8 |
children | 9ec9b806fd81 |
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 |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
25 ;; Proced makes an Emacs buffer containing a listing of the current system |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
26 ;; processes (using ps(1)). You can use the normal Emacs commands |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
27 ;; to move around in this buffer, and special Proced commands to operate |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
28 ;; on the processes listed. |
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: |
97522
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
31 ;; - use list-system-processes and system-process-attributes |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
32 ;; - sort and filter by user name or other criteria |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
33 ;; - make fields clickable for marking / filtering / sorting: |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
34 ;; clicking on a USER field marks all processes of this user etc |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
35 ;; clicking on a %MEM field marks all processes with at least this %MEM. |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
36 ;; clicking on a header field sorts according to this header |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
37 ;; - mark parent and children PIDs (or both) |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
38 ;; - automatic update of process list |
97522
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
39 ;; - allow "sudo kill PID", "renice PID" |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
40 |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
41 ;;; Code: |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
42 |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
43 (defgroup proced nil |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
44 "Proced mode." |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
45 :group 'processes |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
46 :group 'unix |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
47 :prefix "proced-") |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
48 |
95135
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
49 ;; FIXME: a better approach instead of PID-COLUMN would be based |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
50 ;; on `proced-header-alist' once we have a reliable scheme to set this variable |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
51 (defcustom proced-command-alist |
94621
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
52 (cond ((memq system-type '(berkeley-unix)) |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
53 '(("user" ("ps" "-uxgww") 2) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
54 ("user-running" ("ps" "-uxrgww") 2) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
55 ("all" ("ps" "-auxgww") 2) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
56 ("all-running" ("ps" "-auxrgww") 2))) |
94621
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
57 ((memq system-type '(gnu gnu/linux)) ; BSD syntax |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
58 `(("user" ("ps" "uxwww") 2) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
59 ("user-running" ("ps" "uxrwww") 2) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
60 ("all" ("ps" "auxwww") 2) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
61 ("all-running" ("ps" "auxrwww") 2) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
62 ("emacs" ("ps" "--pid" ,(number-to-string (emacs-pid)) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
63 "--ppid" ,(number-to-string (emacs-pid)) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
64 "uwww") 2))) |
94109
6457a4cc8690
(proced-command-alist): Add support for darwin.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94108
diff
changeset
|
65 ((memq system-type '(darwin)) |
6457a4cc8690
(proced-command-alist): Add support for darwin.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94108
diff
changeset
|
66 `(("user" ("ps" "-u" ,(number-to-string (user-uid))) 2) |
6457a4cc8690
(proced-command-alist): Add support for darwin.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94108
diff
changeset
|
67 ("all" ("ps" "-Au") 2))) |
94621
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
68 (t ; standard UNIX syntax; doesn't allow to list running processes only |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
69 `(("user" ("ps" "-fu" ,(number-to-string (user-uid))) 2) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
70 ("all" ("ps" "-ef") 2)))) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
71 "Alist of commands to get list of processes. |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
72 Each element has the form (NAME COMMAND PID-COLUMN). |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
73 NAME is a shorthand name to select the type of listing. |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
74 COMMAND is a list (COMMAND-NAME ARG1 ARG2 ...), |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
75 where COMMAND-NAME is the command to generate the listing (usually \"ps\"). |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
76 ARG1, ARG2, ... are arguments passed to COMMAND-NAME to generate |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
77 a particular listing. These arguments differ under various operating systems. |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
78 PID-COLUMN is the column number (starting from 1) of the process ID." |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
79 :group 'proced |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
80 :type '(repeat (group (string :tag "name") |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
81 (cons (string :tag "command") |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
82 (repeat (string :tag "option"))) |
94621
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
83 (integer :tag "PID column")))) |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
84 |
95135
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
85 (defcustom proced-command (if (zerop (user-real-uid)) "all" "user") |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
86 "Name of process listing. |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
87 Must be the car of an element of `proced-command-alist'." |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
88 :group 'proced |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
89 :type '(string :tag "name")) |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
90 (make-variable-buffer-local 'proced-command) |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
91 |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
92 ;; Should we incorporate in NAME that sorting can be done in ascending |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
93 ;; or descending order? Then we couldn't associate NAME anymore with one |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
94 ;; of the headers in the output of ps(1). |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
95 ;; FIXME: A sorting scheme without options or with an option being a symbol |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
96 ;; should be implemented in elisp |
94621
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
97 (defcustom proced-sorting-schemes-alist |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
98 (cond ((memq system-type '(gnu gnu/linux)) ; GNU long options |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
99 '(("%CPU" "--sort" "-pcpu") ; descending order |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
100 ("%MEM" "--sort" "-pmem") ; descending order |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
101 ("COMMAND" "--sort" "args") |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
102 ("PID" "--sort" "pid") |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
103 ("PGID,PID" "--sort" "pgid,pid") |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
104 ("PPID,PID" "--sort" "ppid,pid") |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
105 ("RSS" "--sort" "rss,pid") ; equal RSS's are rare |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
106 ("STAT,PID" "--sort" "stat,pid") |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
107 ("START" "--sort" "start_time") |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
108 ("TIME" "--sort" "cputime") |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
109 ("TTY,PID" "--sort" "tty,pid") |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
110 ("UID,PID" "--sort" "uid,pid") |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
111 ("USER,PID" "--sort" "user,pid") |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
112 ("VSZ,PID" "--sort" "vsz,pid")))) |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
113 "Alist of sorting schemes. |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
114 Each element is a list (NAME OPTION1 OPTION2 ...). |
95135
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
115 NAME denotes the sorting scheme. It is the name of a header or a |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
116 comma-separated sequence of headers in the output of ps(1). |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
117 OPTION1, OPTION2, ... are options defining the sorting scheme." |
94621
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
118 :group 'proced |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
119 :type '(repeat (cons (string :tag "name") |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
120 (repeat (string :tag "option"))))) |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
121 |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
122 (defcustom proced-sorting-scheme nil |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
123 "Proced sorting type. |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
124 Must be the car of an element of `proced-sorting-schemes-alist' or nil." |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
125 :group 'proced |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
126 :type `(choice ,@(append '((const nil)) ; sorting type may be nil |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
127 (mapcar (lambda (item) |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
128 (list 'const (car item))) |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
129 proced-sorting-schemes-alist)))) |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
130 (make-variable-buffer-local 'proced-sorting-scheme) |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
131 |
95135
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
132 (defcustom proced-goal-header-re "\\b\\(CMD\\|COMMAND\\)\\b" |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
133 "If non-nil, regexp that defines the `proced-goal-column'." |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
134 :group 'proced |
95135
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
135 :type '(choice (const :tag "none" nil) |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
136 (regexp :tag "regexp"))) |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
137 |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
138 (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
|
139 "Name of signal function. |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
140 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
|
141 the external command (usually \"kill\")." |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
142 :group 'proced |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
143 :type '(choice (function :tag "function") |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
144 (string :tag "command"))) |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
145 |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
146 (defcustom proced-signal-list |
97522
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
147 '(;; signals supported on all POSIX compliant systems |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
148 ("HUP (1. Hangup)") |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
149 ("INT (2. Terminal interrupt)") |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
150 ("QUIT (3. Terminal quit)") |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
151 ("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
|
152 ("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
|
153 ("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
|
154 ("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
|
155 ;; 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
|
156 ;; 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
|
157 ;; 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
|
158 ("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
|
159 ("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
|
160 ("TSTP (Terminal stop / pause)")) |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
161 "List of signals, used for minibuffer completion." |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
162 :group 'proced |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
163 :type '(repeat (string :tag "signal"))) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
164 |
95135
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
165 ;; Internal variables |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
166 (defvar proced-marker-char ?* ; the answer is 42 |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
167 "In proced, the current mark character.") |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
168 |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
169 ;; face and font-lock code taken from dired |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
170 (defgroup proced-faces nil |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
171 "Faces used by Proced." |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
172 :group 'proced |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
173 :group 'faces) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
174 |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
175 (defface proced-mark |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
176 '((t (:inherit font-lock-constant-face))) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
177 "Face used for proced marks." |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
178 :group 'proced-faces) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
179 (defvar proced-mark-face 'proced-mark |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
180 "Face name used for proced marks.") |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
181 |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
182 (defface proced-marked |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
183 '((t (:inherit font-lock-warning-face))) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
184 "Face used for marked processes." |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
185 :group 'proced-faces) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
186 (defvar proced-marked-face 'proced-marked |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
187 "Face name used for marked processes.") |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
188 |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
189 (defvar proced-re-mark "^[^ \n]" |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
190 "Regexp matching a marked line. |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
191 Important: the match ends just after the marker.") |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
192 |
95135
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
193 (defvar proced-goal-column nil |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
194 "Proced goal column. Initialized based on `proced-goal-header-re'.") |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
195 (make-variable-buffer-local 'proced-goal-column) |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
196 |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
197 (defvar proced-font-lock-keywords |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
198 (list |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
199 ;; |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
200 ;; Proced marks. |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
201 (list proced-re-mark '(0 proced-mark-face)) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
202 ;; |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
203 ;; Marked files. |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
204 (list (concat "^[" (char-to-string 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
|
205 '(".+" (proced-move-to-goal-column) nil (0 proced-marked-face))))) |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
206 |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
207 (defvar proced-mode-map |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
208 (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
|
209 ;; moving |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
210 (define-key km " " 'proced-next-line) |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
211 (define-key km "n" 'proced-next-line) |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
212 (define-key km "p" 'proced-previous-line) |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
213 (define-key km "\C-n" 'proced-next-line) |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
214 (define-key km "\C-p" 'proced-previous-line) |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
215 (define-key km "\C-?" 'proced-previous-line) |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
216 (define-key km [down] 'proced-next-line) |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
217 (define-key km [up] 'proced-previous-line) |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
218 ;; marking |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
219 (define-key km "d" 'proced-mark) ; Dired compatibility |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
220 (define-key km "m" 'proced-mark) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
221 (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
|
222 (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
|
223 (define-key km "M" 'proced-mark-all) |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
224 (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
|
225 (define-key km "t" 'proced-toggle-marks) |
95135
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
226 ;; sorting |
94621
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
227 (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
|
228 (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
|
229 (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
|
230 (define-key km "ss" 'proced-sort-start) |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
231 (define-key km "sS" 'proced-sort) |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
232 (define-key km "st" 'proced-sort-time) |
95135
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
233 ;; operate |
97522
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
234 (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
|
235 (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
|
236 (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
|
237 ;; misc |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
238 (define-key km "l" 'proced-listing-type) |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
239 (define-key km "g" 'revert-buffer) ; 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
|
240 (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
|
241 (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
|
242 (define-key km "q" 'quit-window) |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
243 (define-key km [remap undo] 'proced-undo) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
244 (define-key km [remap advertised-undo] 'proced-undo) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
245 km) |
97522
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
246 "Keymap for proced commands.") |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
247 |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
248 (easy-menu-define |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
249 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
|
250 `("Proced" |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
251 ["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
|
252 :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
|
253 ["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
|
254 :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
|
255 ["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
|
256 :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
|
257 ["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
|
258 :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
|
259 ["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
|
260 :help "Marked Processes Become Unmarked, and Vice Versa"] |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
261 "--" |
97522
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
262 ["Sort..." proced-sort |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
263 :help "Sort Process List"] |
94621
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
264 ["Sort by %CPU" proced-sort-pcpu (proced-sorting-scheme-p "%CPU")] |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
265 ["Sort by %MEM" proced-sort-pmem (proced-sorting-scheme-p "%MEM")] |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
266 ["Sort by PID" proced-sort-pid (proced-sorting-scheme-p "PID")] |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
267 ["Sort by START" proced-sort-start (proced-sorting-scheme-p "START")] |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
268 ["Sort by TIME" proced-sort-time (proced-sorting-scheme-p "TIME")] |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
269 "--" |
97522
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
270 ["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
|
271 :help "Omit Marked Processes in Process Listing."] |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
272 "--" |
97522
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
273 ["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
|
274 :help "Revert Process Listing"] |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
275 ["Send signal" proced-send-signal |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
276 :help "Send Signal to Marked Processes"] |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
277 ("Listing Type" |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
278 :help "Select Type of Process Listing" |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
279 ,@(mapcar (lambda (el) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
280 (let ((command (car el))) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
281 `[,command (proced-listing-type ,command) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
282 :style radio |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
283 :selected (string= proced-command ,command)])) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
284 proced-command-alist)))) |
93212
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 (defconst proced-help-string |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
287 "(n)ext, (p)revious, (m)ark, (u)nmark, (k)ill, (q)uit (type ? for more help)" |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
288 "Help string for proced.") |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
289 |
95168
a031e38a88d4
(proced-header-line): New variable and new function.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
95135
diff
changeset
|
290 (defvar proced-header-line nil |
a031e38a88d4
(proced-header-line): New variable and new function.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
95135
diff
changeset
|
291 "Headers in Proced buffer as a string.") |
a031e38a88d4
(proced-header-line): New variable and new function.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
95135
diff
changeset
|
292 (make-variable-buffer-local 'proced-header-line) |
a031e38a88d4
(proced-header-line): New variable and new function.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
95135
diff
changeset
|
293 |
95135
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
294 (defvar proced-header-alist nil |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
295 "Alist of headers in Proced buffer. |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
296 Each element is of the form (NAME START END JUSTIFY). |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
297 NAME is name of header in the output of ps(1). |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
298 START and END are column numbers starting from 0. |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
299 END is t if there is no end column for that field. |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
300 JUSTIFY is 'left or 'right for left or right-justified output of ps(1).") |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
301 (make-variable-buffer-local 'proced-header-alist) |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
302 |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
303 (defvar proced-sorting-schemes-re nil |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
304 "Regexp to match valid sorting schemes.") |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
305 (make-variable-buffer-local 'proced-sorting-schemes-re) |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
306 |
97522
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
307 (defvar proced-log-buffer "*Proced log*" |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
308 "Name of 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
|
309 |
95135
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
310 ;; helper functions |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
311 (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
|
312 "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
|
313 ;; `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
|
314 (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
|
315 |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
316 (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
|
317 "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
|
318 (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
|
319 |
95135
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
320 (defun proced-move-to-goal-column () |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
321 "Move to `proced-goal-column' if non-nil." |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
322 (beginning-of-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
|
323 (if proced-goal-column |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
324 (forward-char proced-goal-column) |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
325 (forward-char 2))) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
326 |
95135
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
327 ;; FIXME: a better approach would be based on `proced-header-alist' |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
328 ;; once we have a reliable scheme to set this variable |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
329 (defsubst proced-skip-regexp () |
95135
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
330 "Regexp to skip in process listing to find PID column." |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
331 (apply 'concat (make-list (1- (nth 2 (assoc proced-command |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
332 proced-command-alist))) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
333 "\\s-+\\S-+"))) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
334 |
94108
7ab68bf3a905
(proced-mode): Redefine as just the major-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94066
diff
changeset
|
335 (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
|
336 "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
|
337 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
|
338 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
|
339 |
7ab68bf3a905
(proced-mode): Redefine as just the major-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94066
diff
changeset
|
340 \\{proced-mode-map}" |
7ab68bf3a905
(proced-mode): Redefine as just the major-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94066
diff
changeset
|
341 (abbrev-mode 0) |
7ab68bf3a905
(proced-mode): Redefine as just the major-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94066
diff
changeset
|
342 (auto-fill-mode 0) |
7ab68bf3a905
(proced-mode): Redefine as just the major-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94066
diff
changeset
|
343 (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
|
344 truncate-lines t |
a031e38a88d4
(proced-header-line): New variable and new function.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
95135
diff
changeset
|
345 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
|
346 (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
|
347 (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
|
348 (set (make-local-variable 'font-lock-defaults) |
7ab68bf3a905
(proced-mode): Redefine as just the major-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94066
diff
changeset
|
349 '(proced-font-lock-keywords t nil nil beginning-of-line))) |
7ab68bf3a905
(proced-mode): Redefine as just the major-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94066
diff
changeset
|
350 |
7ab68bf3a905
(proced-mode): Redefine as just the major-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94066
diff
changeset
|
351 ;; 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
|
352 (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
|
353 |
7ab68bf3a905
(proced-mode): Redefine as just the major-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94066
diff
changeset
|
354 ;;;###autoload |
7ab68bf3a905
(proced-mode): Redefine as just the major-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94066
diff
changeset
|
355 (defun proced (&optional arg) |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
356 "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
|
357 Type \\<proced-mode-map>\\[proced-mark] to mark a process for later commands. |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
358 Type \\[proced-send-signal] to send signals to marked processes. |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
359 |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
360 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
|
361 information will be displayed but not selected. |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
362 |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
363 \\{proced-mode-map}" |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
364 (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
|
365 (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
|
366 (set-buffer buffer) |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
367 (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
|
368 (if new (proced-mode)) |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
369 (if (or new arg) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
370 (proced-update)) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
371 (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
|
372 (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
|
373 (pop-to-buffer buffer) |
96824
9ebcc98e40f8
(proced-mode, proced): Add \\<proced-mode-map> to docstrings.
Juri Linkov <juri@jurta.org>
parents:
95300
diff
changeset
|
374 (message |
9ebcc98e40f8
(proced-mode, proced): Add \\<proced-mode-map> to docstrings.
Juri Linkov <juri@jurta.org>
parents:
95300
diff
changeset
|
375 (substitute-command-keys |
9ebcc98e40f8
(proced-mode, proced): Add \\<proced-mode-map> to docstrings.
Juri Linkov <juri@jurta.org>
parents:
95300
diff
changeset
|
376 "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
|
377 |
95135
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
378 (defun proced-next-line (arg) |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
379 "Move down lines then position at `proced-goal-column'. |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
380 Optional prefix ARG says how many lines to move; default is one line." |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
381 (interactive "p") |
95300
cf89ac5d2869
(proced-next-line, proced-previous-line): Avoid calling `next-line'
John Paul Wallington <jpw@pobox.com>
parents:
95286
diff
changeset
|
382 (forward-line arg) |
95135
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
383 (proced-move-to-goal-column)) |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
384 |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
385 (defun proced-previous-line (arg) |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
386 "Move up lines then position at `proced-goal-column'. |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
387 Optional prefix ARG says how many lines to move; default is one line." |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
388 (interactive "p") |
95300
cf89ac5d2869
(proced-next-line, proced-previous-line): Avoid calling `next-line'
John Paul Wallington <jpw@pobox.com>
parents:
95286
diff
changeset
|
389 (forward-line (- arg)) |
95135
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
390 (proced-move-to-goal-column)) |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
391 |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
392 (defun proced-mark (&optional count) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
393 "Mark the current (or next COUNT) processes." |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
394 (interactive "p") |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
395 (proced-do-mark t count)) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
396 |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
397 (defun proced-unmark (&optional count) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
398 "Unmark the current (or next COUNT) processes." |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
399 (interactive "p") |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
400 (proced-do-mark nil count)) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
401 |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
402 (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
|
403 "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
|
404 ;; 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
|
405 ;; 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
|
406 (interactive "p") |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
407 (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
|
408 |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
409 (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
|
410 "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
|
411 (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
|
412 (let ((backward (< count 0)) |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
413 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
|
414 (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
|
415 (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
|
416 (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
|
417 (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
|
418 (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
|
419 (proced-move-to-goal-column))) |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
420 |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
421 (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
|
422 "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
|
423 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
|
424 mark the region." |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
425 (interactive) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
426 (proced-do-mark-all t)) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
427 |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
428 (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
|
429 "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
|
430 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
|
431 unmark the region." |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
432 (interactive) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
433 (proced-do-mark-all nil)) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
434 |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
435 (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
|
436 "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
|
437 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
|
438 mark the region." |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
439 (let (buffer-read-only) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
440 (save-excursion |
97522
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
441 (if (and transient-mark-mode mark-active) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
442 ;; 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
|
443 ;; 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
|
444 ;; `proced-move-to-goal-column'. |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
445 (let ((end (save-excursion |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
446 (goto-char (region-end)) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
447 (unless (looking-at "^") (forward-line)) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
448 (point)))) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
449 (goto-char (region-beginning)) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
450 (unless (looking-at "^") (beginning-of-line)) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
451 (while (< (point) end) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
452 (proced-insert-mark mark))) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
453 (goto-char (point-min)) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
454 (while (not (eobp)) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
455 (proced-insert-mark mark)))))) |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
456 |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
457 (defun proced-toggle-marks () |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
458 "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
|
459 (interactive) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
460 (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
|
461 buffer-read-only) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
462 (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
|
463 (goto-char (point-min)) |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
464 (while (not (eobp)) |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
465 (cond ((looking-at mark-re) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
466 (proced-insert-mark nil)) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
467 ((looking-at " ") |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
468 (proced-insert-mark t)) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
469 (t |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
470 (forward-line 1))))))) |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
471 |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
472 (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
|
473 "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
|
474 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
|
475 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
|
476 (if backward (forward-line -1)) |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
477 (insert (if mark proced-marker-char ?\s)) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
478 (delete-char 1) |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
479 (unless backward (forward-line))) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
480 |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
481 ;; 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
|
482 ;; 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
|
483 ;; include the current line, whereas `dired-mark' for negative args operates |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
484 ;; 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
|
485 (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
|
486 "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
|
487 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
|
488 \(A negative argument omits backward.) |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
489 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
|
490 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
|
491 (interactive "P") |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
492 (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
|
493 (count 0) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
494 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
|
495 (if arg |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
496 ;; Omit ARG 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
|
497 (delete-region (line-beginning-position) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
498 (save-excursion |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
499 (if (<= 0 arg) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
500 (setq count (- arg (forward-line arg))) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
501 (setq count (min (1- (line-number-at-pos)) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
502 (abs arg))) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
503 (forward-line (- count))) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
504 (point))) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
505 ;; Omit marked lines |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
506 (save-excursion |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
507 (goto-char (point-min)) |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
508 (while (and (not (eobp)) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
509 (re-search-forward mark-re nil t)) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
510 (delete-region (match-beginning 0) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
511 (save-excursion (forward-line) (point))) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
512 (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
|
513 (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
|
514 (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
|
515 count)) |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
516 |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
517 (defun proced-listing-type (command) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
518 "Select `proced' listing type COMMAND from `proced-command-alist'." |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
519 (interactive |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
520 (list (completing-read "Listing type: " proced-command-alist nil t))) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
521 (setq proced-command command) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
522 (proced-update)) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
523 |
95168
a031e38a88d4
(proced-header-line): New variable and new function.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
95135
diff
changeset
|
524 (defun proced-header-line () |
a031e38a88d4
(proced-header-line): New variable and new function.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
95135
diff
changeset
|
525 "Return header line for Proced buffer." |
95286
3680efd5ada2
(proced-header-line): Use the :align-to 0 feature
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
95168
diff
changeset
|
526 (list (propertize " " 'display '(space :align-to 0)) |
95168
a031e38a88d4
(proced-header-line): New variable and new function.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
95135
diff
changeset
|
527 (replace-regexp-in-string |
a031e38a88d4
(proced-header-line): New variable and new function.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
95135
diff
changeset
|
528 "%" "%%" (substring proced-header-line (window-hscroll))))) |
a031e38a88d4
(proced-header-line): New variable and new function.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
95135
diff
changeset
|
529 |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
530 (defun proced-update (&optional quiet) |
97522
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
531 "Update the `proced' process information. Preserves point and marks. |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
532 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
|
533 ;; This is the main function that generates and updates the process listing. |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
534 (interactive) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
535 (or quiet (message "Updating process information...")) |
94621
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
536 (let* ((command (cadr (assoc proced-command proced-command-alist))) |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
537 (regexp (concat (proced-skip-regexp) "\\s-+\\([0-9]+\\>\\)")) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
538 (old-pos (if (save-excursion |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
539 (beginning-of-line) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
540 (looking-at (concat "^[* ]" regexp))) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
541 (cons (match-string-no-properties 1) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
542 (current-column)))) |
95135
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
543 buffer-read-only mp-list) |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
544 (goto-char (point-min)) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
545 ;; remember marked processes (whatever the mark was) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
546 (while (re-search-forward (concat "^\\(\\S-\\)" regexp) nil t) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
547 (push (cons (match-string-no-properties 2) |
95135
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
548 (match-string-no-properties 1)) mp-list)) |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
549 ;; generate new listing |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
550 (erase-buffer) |
94621
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
551 (apply 'call-process (car command) nil t nil |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
552 (append (cdr command) (cdr (assoc proced-sorting-scheme |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
553 proced-sorting-schemes-alist)))) |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
554 (goto-char (point-min)) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
555 (while (not (eobp)) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
556 (insert " ") |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
557 (forward-line)) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
558 ;; (delete-trailing-whitespace) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
559 (goto-char (point-min)) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
560 (while (re-search-forward "[ \t\r]+$" nil t) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
561 (delete-region (match-beginning 0) (match-end 0))) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
562 (goto-char (point-min)) |
95135
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
563 (let ((lep (line-end-position))) |
95168
a031e38a88d4
(proced-header-line): New variable and new function.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
95135
diff
changeset
|
564 (setq proced-header-line (buffer-substring-no-properties (point) lep)) |
95135
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
565 (setq proced-header-alist nil) |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
566 ;; FIXME: handle left/right justification properly |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
567 (while (re-search-forward "\\([^ \t\n]+\\)[ \t]*\\($\\)?" lep t) |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
568 (push (list (match-string-no-properties 1) |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
569 ;; take the column number starting from zero |
95286
3680efd5ada2
(proced-header-line): Use the :align-to 0 feature
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
95168
diff
changeset
|
570 (- (match-beginning 0) (point-min)) |
3680efd5ada2
(proced-header-line): Use the :align-to 0 feature
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
95168
diff
changeset
|
571 (or (not (not (match-beginning 2))) |
3680efd5ada2
(proced-header-line): Use the :align-to 0 feature
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
95168
diff
changeset
|
572 (- (match-end 0) (point-min))) |
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 'left) |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
574 proced-header-alist))) |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
575 (let ((temp (regexp-opt (mapcar 'car proced-header-alist) t))) |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
576 (setq proced-sorting-schemes-re |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
577 (concat "\\`" temp "\\(," temp "\\)*\\'"))) |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
578 ;; remove header line from ps(1) output |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
579 (goto-char (point-min)) |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
580 (delete-region (point) |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
581 (save-excursion (forward-line) (point))) |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
582 (set-buffer-modified-p nil) |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
583 ;; set `proced-goal-column' |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
584 (if proced-goal-header-re |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
585 (let ((hlist proced-header-alist) header) |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
586 (while (setq header (pop hlist)) |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
587 (if (string-match proced-goal-header-re (car header)) |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
588 (setq proced-goal-column |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
589 (if (eq 'left (nth 3 header)) |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
590 (nth 1 header) (nth 2 header)) |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
591 hlist nil))))) |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
592 ;; restore process marks |
95135
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
593 (if mp-list |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
594 (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
|
595 (goto-char (point-min)) |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
596 (let (mark) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
597 (while (re-search-forward (concat "^" regexp) nil 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
|
598 (if (setq mark (assoc (match-string-no-properties 1) mp-list)) |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
599 (save-excursion |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
600 (beginning-of-line) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
601 (insert (cdr mark)) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
602 (delete-char 1))))))) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
603 ;; restore buffer position (if possible) |
95135
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
604 (goto-char (point-min)) |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
605 (if (and old-pos |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
606 (re-search-forward |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
607 (concat "^[* ]" (proced-skip-regexp) "\\s-+" (car old-pos) "\\>") |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
608 nil t)) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
609 (progn |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
610 (beginning-of-line) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
611 (forward-char (cdr old-pos))) |
95135
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
612 (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
|
613 ;; update modeline |
95135
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
614 ;; Does the long mode-name clutter the modeline? |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
615 (setq mode-name (concat "Proced: " proced-command |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
616 (if proced-sorting-scheme |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
617 (concat " by " proced-sorting-scheme) |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
618 ""))) |
94621
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
619 (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
|
620 ;; done |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
621 (or quiet (input-pending-p) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
622 (message "Updating process information...done.")))) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
623 |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
624 (defun proced-revert (&rest args) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
625 "Analog of `revert-buffer'." |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
626 (proced-update)) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
627 |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
628 ;; 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
|
629 ;; 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
|
630 ;; 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
|
631 ;; `shrink-window-if-larger-than-buffer'? |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
632 (autoload 'dired-pop-to-buffer "dired") |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
633 |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
634 (defun proced-send-signal (&optional signal) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
635 "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
|
636 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
|
637 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
|
638 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
|
639 (interactive) |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
640 (let ((regexp (concat (proced-marker-regexp) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
641 (proced-skip-regexp) "\\s-+\\([0-9]+\\>\\).*$")) |
95135
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
642 process-list) |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
643 ;; collect marked processes |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
644 (save-excursion |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
645 (goto-char (point-min)) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
646 (while (re-search-forward regexp nil t) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
647 (push (cons (match-string-no-properties 1) |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
648 ;; How much info should we collect here? Would it be |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
649 ;; better to collect only the PID (to avoid ambiguities) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
650 ;; and the command name? |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
651 (substring (match-string-no-properties 0) 2)) |
95135
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
652 process-list))) |
97522
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
653 (setq process-list |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
654 (if process-list |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
655 (nreverse process-list) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
656 ;; take current process |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
657 (save-excursion |
97524
9709454b59a8
proced.el (proced-send-signal): Use beginning-of-line.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97522
diff
changeset
|
658 (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
|
659 (looking-at (concat "^" (proced-skip-regexp) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
660 "\\s-+\\([0-9]+\\>\\).*$")) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
661 (list (cons (match-string-no-properties 1) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
662 (substring (match-string-no-properties 0) 2)))))) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
663 (unless signal |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
664 ;; 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
|
665 (let ((bufname " *Marked Processes*") |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
666 (header proced-header-line)) ; inherit header line |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
667 (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
|
668 (setq truncate-lines t |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
669 proced-header-line header |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
670 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
|
671 (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
|
672 (erase-buffer) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
673 (dolist (process process-list) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
674 (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
|
675 (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
|
676 (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
|
677 (let* ((completion-ignore-case t) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
678 (pnum (if (= 1 (length process-list)) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
679 "1 process" |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
680 (format "%d processes" (length process-list)))) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
681 ;; The following is an ugly hack. Is there a better way |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
682 ;; 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
|
683 ;; their meanings? |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
684 (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
|
685 "] (default TERM): ") |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
686 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
|
687 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
|
688 (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
|
689 (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
|
690 ;; send signal |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
691 (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
|
692 failures) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
693 ;; 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
|
694 ;; 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
|
695 (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
|
696 ;; 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
|
697 (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
|
698 (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
|
699 (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
|
700 (make-symbol signal)) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
701 signal))) ; number |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
702 (dolist (process process-list) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
703 (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
|
704 (if (zerop (funcall |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
705 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
|
706 (string-to-number (car process)) signal)) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
707 (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
|
708 (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
|
709 (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
|
710 (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
|
711 (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
|
712 (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
|
713 (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
|
714 ;; 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
|
715 (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
|
716 (number-to-string signal) signal)))) |
95135
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
717 (dolist (process process-list) |
97522
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
718 (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
|
719 (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
|
720 (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
|
721 proced-signal-function nil t nil |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
722 signal (car process))) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
723 (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
|
724 (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
|
725 (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
|
726 (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
|
727 (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
|
728 (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
|
729 (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
|
730 (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
|
731 (if failures |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
732 (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
|
733 signal |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
734 (format "%d of %d signal%s failed" |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
735 (length failures) (length process-list) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
736 (if (= 1 (length process-list)) "" "s"))) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
737 (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
|
738 ;; 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
|
739 (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
|
740 |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
741 ;; just like `dired-why' |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
742 (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
|
743 "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
|
744 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
|
745 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
|
746 (interactive) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
747 (if (get-buffer 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
|
748 (let ((owindow (selected-window)) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
749 (window (display-buffer (get-buffer 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
|
750 (unwind-protect |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
751 (progn |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
752 (select-window window) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
753 (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
|
754 (forward-line -1) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
755 (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
|
756 (recenter 0)) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
757 (select-window owindow))))) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
758 |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
759 ;; 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
|
760 (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
|
761 "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
|
762 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
|
763 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
|
764 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
|
765 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
|
766 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
|
767 (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
|
768 (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
|
769 (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
|
770 (let ((inhibit-read-only t)) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
771 (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
|
772 (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
|
773 (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
|
774 log))) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
775 ((bufferp log) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
776 (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
|
777 ((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
|
778 (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
|
779 (unless (bolp) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
780 (insert "\n")) |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
781 (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
|
782 "\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
|
783 (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
|
784 (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
|
785 (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
|
786 |
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
787 ;; 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
|
788 (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
|
789 "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
|
790 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
|
791 (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
|
792 ;; 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
|
793 (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
|
794 (proced-log t signal)) |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
795 |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
796 (defun proced-help () |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
797 "Provide help for the `proced' user." |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
798 (interactive) |
97522
ce7e3551dd0e
(proced-signal-list): Add POSIX 1003.1-2001 signals.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
97317
diff
changeset
|
799 (proced-why) |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
800 (if (eq last-command 'proced-help) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
801 (describe-mode) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
802 (message proced-help-string))) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
803 |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
804 (defun proced-undo () |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
805 "Undo in a proced buffer. |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
806 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
|
807 buffer. You can use it to recover marks." |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
808 (interactive) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
809 (let (buffer-read-only) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
810 (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
|
811 (message "Change in Proced buffer undone. |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
812 Killed processes cannot be recovered by Emacs.")) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
813 |
94621
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
814 ;;; Sorting |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
815 (defun proced-sort (scheme) |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
816 "Sort Proced buffer using SCHEME. |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
817 When called interactively, an empty string means nil, i.e., no sorting." |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
818 (interactive |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
819 (list (let* ((completion-ignore-case 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
|
820 ;; restrict completion list to applicable sorting schemes |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
821 (completion-list |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
822 (apply 'append |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
823 (mapcar (lambda (x) |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
824 (if (string-match proced-sorting-schemes-re |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
825 (car x)) |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
826 (list (car x)))) |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
827 proced-sorting-schemes-alist))) |
94621
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
828 (scheme (completing-read "Sorting type: " |
95135
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
829 completion-list nil t))) |
94621
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
830 (if (string= "" scheme) nil scheme)))) |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
831 (if (proced-sorting-scheme-p scheme) |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
832 (progn |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
833 (setq proced-sorting-scheme scheme) |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
834 (proced-update)) |
95135
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
835 (error "Proced sorting scheme %s not applicable" scheme))) |
94621
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
836 |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
837 (defun proced-sorting-scheme-p (scheme) |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
838 "Return non-nil if SCHEME is an applicable sorting scheme. |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
839 SCHEME must be a string or nil." |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
840 (or (not scheme) |
95135
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
841 (and (string-match proced-sorting-schemes-re scheme) |
33ea0b47d336
(proced-goal-header-re): Renamed from proced-procname-column-regexp.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94678
diff
changeset
|
842 (assoc scheme proced-sorting-schemes-alist)))) |
94621
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
843 |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
844 (defun 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
|
845 "Sort Proced buffer by percentage CPU time (%CPU)." |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
846 (interactive) |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
847 (proced-sort "%CPU")) |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
848 |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
849 (defun 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
|
850 "Sort Proced buffer by percentage memory usage (%MEM)." |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
851 (interactive) |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
852 (proced-sort "%MEM")) |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
853 |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
854 (defun 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
|
855 "Sort Proced buffer by PID." |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
856 (interactive) |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
857 (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
|
858 |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
859 (defun proced-sort-start () |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
860 "Sort Proced buffer by time the command started (START)." |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
861 (interactive) |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
862 (proced-sort "START")) |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
863 |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
864 (defun proced-sort-time () |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
865 "Sort Proced buffer by cumulative CPU time (TIME)." |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
866 (interactive) |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
867 (proced-sort "TIME")) |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
868 |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
869 (provide 'proced) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
870 |
93248
072dbbf778d2
Add arch-tag.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93213
diff
changeset
|
871 ;; 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
|
872 ;;; proced.el ends here |