Mercurial > emacs
annotate lisp/proced.el @ 94652:3a091c58b092
Move a customization variable.
author | Eric S. Raymond <esr@snark.thyrsus.com> |
---|---|
date | Tue, 06 May 2008 01:41:34 +0000 |
parents | 97585dd63d91 |
children | ee5932bf781d |
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 |
93213
f51aae2fc6a4
Update copyright.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93212
diff
changeset
|
10 ;; GNU Emacs is free software; you can redistribute it and/or modify |
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 |
f51aae2fc6a4
Update copyright.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93212
diff
changeset
|
12 ;; the Free Software Foundation; either version 3, or (at your option) |
f51aae2fc6a4
Update copyright.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93212
diff
changeset
|
13 ;; any later version. |
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 |
93213
f51aae2fc6a4
Update copyright.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93212
diff
changeset
|
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
f51aae2fc6a4
Update copyright.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93212
diff
changeset
|
22 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
23 ;; Boston, MA 02110-1301, USA. |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
24 |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
25 ;;; Commentary: |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
26 |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
27 ;; 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
|
28 ;; 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
|
29 ;; 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
|
30 ;; on the processes listed. |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
31 ;; |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
32 ;; To do: |
94621
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
33 ;; - sort the "cooked" values used in the output format fields |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
34 ;; if ps(1) doesn't support the requested sorting scheme |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
35 ;; - filter by user name or other criteria |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
36 ;; - automatic update of process list |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
37 |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
38 ;;; Code: |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
39 |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
40 (defgroup proced nil |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
41 "Proced mode." |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
42 :group 'processes |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
43 :group 'unix |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
44 :prefix "proced-") |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
45 |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
46 (defcustom proced-procname-column-regexp "\\b\\(CMD\\|COMMAND\\)\\b" |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
47 "If non-nil, regexp that defines the `proced-procname-column'." |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
48 :group 'proced |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
49 :type '(choice (const :tag "none" nil) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
50 (regexp :tag "regexp"))) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
51 |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
52 (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
|
53 (cond ((memq system-type '(berkeley-unix)) |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
54 '(("user" ("ps" "-uxgww") 2) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
55 ("user-running" ("ps" "-uxrgww") 2) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
56 ("all" ("ps" "-auxgww") 2) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
57 ("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
|
58 ((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
|
59 `(("user" ("ps" "uxwww") 2) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
60 ("user-running" ("ps" "uxrwww") 2) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
61 ("all" ("ps" "auxwww") 2) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
62 ("all-running" ("ps" "auxrwww") 2) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
63 ("emacs" ("ps" "--pid" ,(number-to-string (emacs-pid)) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
64 "--ppid" ,(number-to-string (emacs-pid)) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
65 "uwww") 2))) |
94109
6457a4cc8690
(proced-command-alist): Add support for darwin.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94108
diff
changeset
|
66 ((memq system-type '(darwin)) |
6457a4cc8690
(proced-command-alist): Add support for darwin.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94108
diff
changeset
|
67 `(("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
|
68 ("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
|
69 (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
|
70 `(("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
|
71 ("all" ("ps" "-ef") 2)))) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
72 "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
|
73 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
|
74 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
|
75 COMMAND is a list (COMMAND-NAME ARG1 ARG2 ...), |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
76 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
|
77 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
|
78 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
|
79 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
|
80 :group 'proced |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
81 :type '(repeat (group (string :tag "name") |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
82 (cons (string :tag "command") |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
83 (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
|
84 (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
|
85 |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
86 ;; Should we incorporate in NAME if sorting is done in descending order? |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
87 (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
|
88 (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
|
89 '(("%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
|
90 ("%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
|
91 ("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
|
92 ("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
|
93 ("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
|
94 ("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
|
95 ("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
|
96 ("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
|
97 ("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
|
98 ("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
|
99 ("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
|
100 ("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
|
101 ("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
|
102 ("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
|
103 "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
|
104 Each element is a list (NAME OPTION1 OPTION2 ...). |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
105 NAME denotes the sorting scheme and OPTION1, OPTION2, ... are options |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
106 defining the sorting scheme." |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
107 :group 'proced |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
108 :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
|
109 (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
|
110 |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
111 (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
|
112 "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
|
113 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
|
114 :group 'proced |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
115 :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
|
116 (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
|
117 (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
|
118 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
|
119 (make-variable-buffer-local 'proced-sorting-scheme) |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
120 |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
121 (defcustom proced-command (if (zerop (user-real-uid)) "all" "user") |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
122 "Name of process listing. |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
123 Must be the car of an element of `proced-command-alist'." |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
124 :group 'proced |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
125 :type '(string :tag "name")) |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
126 (make-variable-buffer-local 'proced-command) |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
127 |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
128 (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
|
129 "Name of signal function. |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
130 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
|
131 the external command (usually \"kill\")." |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
132 :group 'proced |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
133 :type '(choice (function :tag "function") |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
134 (string :tag "command"))) |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
135 |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
136 (defcustom proced-signal-list |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
137 '(("HUP (1. Hangup)") |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
138 ("INT (2. Terminal interrupt)") |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
139 ("QUIT (3. Terminal quit)") |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
140 ("ABRT (6. Process abort)") |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
141 ("KILL (9. Kill -- cannot be caught or ignored)") |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
142 ("ALRM (14. Alarm Clock)") |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
143 ("TERM (15. Termination)")) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
144 "List of signals, used for minibuffer completion." |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
145 :group 'proced |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
146 :type '(repeat (string :tag "signal"))) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
147 |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
148 (defvar proced-marker-char ?* ; the answer is 42 |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
149 "In proced, the current mark character.") |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
150 |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
151 ;; face and font-lock code taken from dired |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
152 (defgroup proced-faces nil |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
153 "Faces used by Proced." |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
154 :group 'proced |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
155 :group 'faces) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
156 |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
157 (defface proced-header |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
158 '((t (:inherit font-lock-type-face))) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
159 "Face used for proced headers." |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
160 :group 'proced-faces) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
161 (defvar proced-header-face 'proced-header |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
162 "Face name used for proced headers.") |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
163 |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
164 (defface proced-mark |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
165 '((t (:inherit font-lock-constant-face))) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
166 "Face used for proced marks." |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
167 :group 'proced-faces) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
168 (defvar proced-mark-face 'proced-mark |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
169 "Face name used for proced marks.") |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
170 |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
171 (defface proced-marked |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
172 '((t (:inherit font-lock-warning-face))) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
173 "Face used for marked processes." |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
174 :group 'proced-faces) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
175 (defvar proced-marked-face 'proced-marked |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
176 "Face name used for marked processes.") |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
177 |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
178 (defvar proced-re-mark "^[^ \n]" |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
179 "Regexp matching a marked line. |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
180 Important: the match ends just after the marker.") |
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 (defvar proced-header-regexp "\\`.*$" |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
183 "Regexp matching a header line.") |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
184 |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
185 (defvar proced-procname-column nil |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
186 "Proced command column. |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
187 Initialized based on `proced-procname-column-regexp'.") |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
188 (make-variable-buffer-local 'proced-procname-column) |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
189 |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
190 (defvar proced-font-lock-keywords |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
191 (list |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
192 ;; |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
193 ;; Process listing headers. |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
194 (list proced-header-regexp '(0 proced-header-face)) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
195 ;; |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
196 ;; Proced marks. |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
197 (list proced-re-mark '(0 proced-mark-face)) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
198 ;; |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
199 ;; Marked files. |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
200 (list (concat "^[" (char-to-string proced-marker-char) "]") |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
201 '(".+" (proced-move-to-procname) nil (0 proced-marked-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 (defvar proced-mode-map |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
204 (let ((km (make-sparse-keymap))) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
205 (define-key km " " 'next-line) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
206 (define-key km "n" 'next-line) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
207 (define-key km "p" 'previous-line) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
208 (define-key km "\C-?" 'previous-line) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
209 (define-key km "h" 'describe-mode) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
210 (define-key km "?" 'proced-help) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
211 (define-key km "d" 'proced-mark) ; Dired compatibility |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
212 (define-key km "m" 'proced-mark) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
213 (define-key km "M" 'proced-mark-all) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
214 (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
|
215 (define-key km "\177" 'proced-unmark-backward) |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
216 (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
|
217 (define-key km "t" 'proced-toggle-marks) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
218 (define-key km "h" 'proced-hide-processes) |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
219 (define-key km "x" 'proced-send-signal) ; Dired compatibility |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
220 (define-key km "k" 'proced-send-signal) ; kill processes |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
221 (define-key km "l" 'proced-listing-type) |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
222 (define-key km "g" 'revert-buffer) ; Dired compatibility |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
223 (define-key km "q" 'quit-window) |
94621
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
224 (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
|
225 (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
|
226 (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
|
227 (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
|
228 (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
|
229 (define-key km "st" 'proced-sort-time) |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
230 (define-key km [remap undo] 'proced-undo) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
231 (define-key km [remap advertised-undo] 'proced-undo) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
232 km) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
233 "Keymap for proced commands") |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
234 |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
235 (easy-menu-define |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
236 proced-menu proced-mode-map "Proced Menu" |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
237 '("Proced" |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
238 ["Mark" proced-mark t] |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
239 ["Unmark" proced-unmark t] |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
240 ["Mark All" proced-mark-all t] |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
241 ["Unmark All" proced-unmark-all t] |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
242 ["Toggle Marks" proced-unmark-all t] |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
243 "--" |
94621
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
244 ["Sort" proced-sort t] |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
245 ["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
|
246 ["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
|
247 ["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
|
248 ["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
|
249 ["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
|
250 "--" |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
251 ["Hide Marked Processes" proced-hide-processes t] |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
252 "--" |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
253 ["Revert" revert-buffer t] |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
254 ["Send signal" proced-send-signal t] |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
255 ["Change listing" proced-listing-type t])) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
256 |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
257 (defconst proced-help-string |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
258 "(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
|
259 "Help string for proced.") |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
260 |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
261 (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
|
262 "Return regexp matching `proced-marker-char'." |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
263 (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
|
264 |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
265 (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
|
266 "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
|
267 (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
|
268 |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
269 (defun proced-move-to-procname () |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
270 "Move to the beginning of the process name on the current line. |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
271 Return the position of the beginning of the process name, or nil if none found." |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
272 (beginning-of-line) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
273 (if proced-procname-column |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
274 (forward-char proced-procname-column) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
275 (forward-char 2))) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
276 |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
277 (defsubst proced-skip-regexp () |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
278 "Regexp to skip in process listing." |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
279 (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
|
280 proced-command-alist))) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
281 "\\s-+\\S-+"))) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
282 |
94108
7ab68bf3a905
(proced-mode): Redefine as just the major-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94066
diff
changeset
|
283 (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
|
284 "Mode for displaying UNIX system processes and sending signals to them. |
7ab68bf3a905
(proced-mode): Redefine as just the major-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94066
diff
changeset
|
285 Type \\[proced-mark-process] to mark a process for later commands. |
7ab68bf3a905
(proced-mode): Redefine as just the major-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94066
diff
changeset
|
286 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
|
287 |
7ab68bf3a905
(proced-mode): Redefine as just the major-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94066
diff
changeset
|
288 \\{proced-mode-map}" |
7ab68bf3a905
(proced-mode): Redefine as just the major-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94066
diff
changeset
|
289 (abbrev-mode 0) |
7ab68bf3a905
(proced-mode): Redefine as just the major-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94066
diff
changeset
|
290 (auto-fill-mode 0) |
7ab68bf3a905
(proced-mode): Redefine as just the major-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94066
diff
changeset
|
291 (setq buffer-read-only t |
7ab68bf3a905
(proced-mode): Redefine as just the major-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94066
diff
changeset
|
292 truncate-lines t) |
7ab68bf3a905
(proced-mode): Redefine as just the major-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94066
diff
changeset
|
293 (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
|
294 (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
|
295 '(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
|
296 |
7ab68bf3a905
(proced-mode): Redefine as just the major-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94066
diff
changeset
|
297 ;; 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
|
298 (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
|
299 |
7ab68bf3a905
(proced-mode): Redefine as just the major-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94066
diff
changeset
|
300 ;;;###autoload |
7ab68bf3a905
(proced-mode): Redefine as just the major-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94066
diff
changeset
|
301 (defun proced (&optional arg) |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
302 "Mode for displaying UNIX system processes and sending signals to them. |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
303 Type \\[proced-mark-process] to mark a process for later commands. |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
304 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
|
305 |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
306 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
|
307 information will be displayed but not selected. |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
308 |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
309 \\{proced-mode-map}" |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
310 (interactive "P") |
94621
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
311 (let ((buffer (get-buffer-create "*Process Info*")) new) |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
312 (set-buffer buffer) |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
313 (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
|
314 (if new (proced-mode)) |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
315 |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
316 (if (or new arg) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
317 (proced-update)) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
318 |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
319 (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
|
320 (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
|
321 (pop-to-buffer buffer) |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
322 (message (substitute-command-keys |
94108
7ab68bf3a905
(proced-mode): Redefine as just the major-mode.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
94066
diff
changeset
|
323 "type \\[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
|
324 |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
325 (defun proced-mark (&optional count) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
326 "Mark the current (or next COUNT) processes." |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
327 (interactive "p") |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
328 (proced-do-mark t count)) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
329 |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
330 (defun proced-unmark (&optional count) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
331 "Unmark the current (or next COUNT) processes." |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
332 (interactive "p") |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
333 (proced-do-mark nil count)) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
334 |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
335 (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
|
336 "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
|
337 ;; 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
|
338 ;; 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
|
339 (interactive "p") |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
340 (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
|
341 |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
342 (defun proced-do-mark (mark &optional count) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
343 "Mark the current (or next ARG) processes using MARK." |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
344 (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
|
345 (let ((backward (< count 0)) |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
346 (line (line-number-at-pos)) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
347 buffer-read-only) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
348 ;; do nothing in the first line |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
349 (unless (= line 1) |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
350 (setq count (1+ (if (<= 0 count) count |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
351 (min (- line 2) (abs count))))) |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
352 (beginning-of-line) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
353 (while (not (or (zerop (setq count (1- count))) (eobp))) |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
354 (proced-insert-mark mark backward)) |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
355 (proced-move-to-procname)))) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
356 |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
357 (defun proced-mark-all () |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
358 "Mark all processes." |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
359 (interactive) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
360 (proced-do-mark-all t)) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
361 |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
362 (defun proced-unmark-all () |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
363 "Unmark all processes." |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
364 (interactive) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
365 (proced-do-mark-all nil)) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
366 |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
367 (defun proced-do-mark-all (mark) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
368 "Mark all processes using MARK." |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
369 (let (buffer-read-only) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
370 (save-excursion |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
371 (goto-line 2) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
372 (while (not (eobp)) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
373 (proced-insert-mark mark))))) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
374 |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
375 (defun proced-toggle-marks () |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
376 "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
|
377 (interactive) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
378 (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
|
379 buffer-read-only) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
380 (save-excursion |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
381 (goto-line 2) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
382 (while (not (eobp)) |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
383 (cond ((looking-at mark-re) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
384 (proced-insert-mark nil)) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
385 ((looking-at " ") |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
386 (proced-insert-mark t)) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
387 (t |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
388 (forward-line 1))))))) |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
389 |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
390 (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
|
391 "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
|
392 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
|
393 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
|
394 (if backward (forward-line -1)) |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
395 (insert (if mark proced-marker-char ?\s)) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
396 (delete-char 1) |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
397 (unless backward (forward-line))) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
398 |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
399 ;; 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
|
400 ;; 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
|
401 ;; 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
|
402 ;; on the preceding lines. Here we are consistent with `dired-mark'. |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
403 (defun proced-hide-processes (&optional arg quiet) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
404 "Hide marked processes. |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
405 With prefix ARG, hide that many lines starting with the current line. |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
406 \(A negative argument hides backward.) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
407 If QUIET is non-nil suppress status message. |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
408 Returns count of hidden lines." |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
409 (interactive "P") |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
410 (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
|
411 (count 0) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
412 buffer-read-only) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
413 (save-excursion |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
414 (if arg |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
415 ;; Hide ARG lines starting with the current line. |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
416 (let ((line (line-number-at-pos))) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
417 ;; do nothing in the first line |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
418 (unless (= line 1) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
419 (delete-region (line-beginning-position) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
420 (save-excursion |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
421 (if (<= 0 arg) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
422 (setq count (- arg (forward-line arg))) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
423 (setq count (min (- line 2) (abs arg))) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
424 (forward-line (- count))) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
425 (point))))) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
426 ;; Hide marked lines |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
427 (goto-line 2) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
428 (while (and (not (eobp)) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
429 (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
|
430 (delete-region (match-beginning 0) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
431 (save-excursion (forward-line) (point))) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
432 (setq count (1+ count))))) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
433 (unless (zerop count) (proced-move-to-procname)) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
434 (unless quiet |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
435 (proced-success-message "Hid" count)) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
436 count)) |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
437 |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
438 (defun proced-listing-type (command) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
439 "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
|
440 (interactive |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
441 (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
|
442 (setq proced-command command) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
443 (proced-update)) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
444 |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
445 (defun proced-update (&optional quiet) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
446 "Update the `proced' process information. Preserves point and marks." |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
447 ;; 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
|
448 (interactive) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
449 (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
|
450 (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
|
451 (regexp (concat (proced-skip-regexp) "\\s-+\\([0-9]+\\>\\)")) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
452 (old-pos (if (save-excursion |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
453 (beginning-of-line) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
454 (looking-at (concat "^[* ]" regexp))) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
455 (cons (match-string-no-properties 1) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
456 (current-column)))) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
457 buffer-read-only plist) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
458 (goto-char (point-min)) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
459 ;; remember marked processes (whatever the mark was) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
460 (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
|
461 (push (cons (match-string-no-properties 2) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
462 (match-string-no-properties 1)) plist)) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
463 ;; generate new listing |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
464 (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
|
465 (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
|
466 (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
|
467 proced-sorting-schemes-alist)))) |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
468 (goto-char (point-min)) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
469 (while (not (eobp)) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
470 (insert " ") |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
471 (forward-line)) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
472 ;; (delete-trailing-whitespace) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
473 (goto-char (point-min)) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
474 (while (re-search-forward "[ \t\r]+$" nil t) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
475 (delete-region (match-beginning 0) (match-end 0))) |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
476 (set-buffer-modified-p nil) |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
477 ;; set `proced-procname-column' |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
478 (goto-char (point-min)) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
479 (and proced-procname-column-regexp |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
480 (re-search-forward proced-procname-column-regexp nil t) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
481 (setq proced-procname-column (1- (match-beginning 0)))) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
482 ;; restore process marks |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
483 (if plist |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
484 (save-excursion |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
485 (goto-line 2) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
486 (let (mark) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
487 (while (re-search-forward (concat "^" regexp) nil t) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
488 (if (setq mark (assoc (match-string-no-properties 1) plist)) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
489 (save-excursion |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
490 (beginning-of-line) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
491 (insert (cdr mark)) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
492 (delete-char 1))))))) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
493 ;; restore buffer position (if possible) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
494 (goto-line 2) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
495 (if (and old-pos |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
496 (re-search-forward |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
497 (concat "^[* ]" (proced-skip-regexp) "\\s-+" (car old-pos) "\\>") |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
498 nil t)) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
499 (progn |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
500 (beginning-of-line) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
501 (forward-char (cdr old-pos))) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
502 (proced-move-to-procname)) |
94621
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
503 ;; update modeline |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
504 (setq mode-name (if 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
|
505 (concat "Proced by " 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
|
506 "Proced")) |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
507 (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
|
508 ;; done |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
509 (or quiet (input-pending-p) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
510 (message "Updating process information...done.")))) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
511 |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
512 (defun proced-revert (&rest args) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
513 "Analog of `revert-buffer'." |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
514 (proced-update)) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
515 |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
516 ;; I do not want to reinvent the wheel. Should we rename `dired-pop-to-buffer' |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
517 ;; and move it to simple.el so that proced and ibuffer can easily use it, too? |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
518 (autoload 'dired-pop-to-buffer "dired") |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
519 |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
520 (defun proced-send-signal (&optional signal) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
521 "Send a SIGNAL to the marked processes. |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
522 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
|
523 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
|
524 (interactive) |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
525 (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
|
526 (proced-skip-regexp) "\\s-+\\([0-9]+\\>\\).*$")) |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
527 plist) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
528 ;; collect marked processes |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
529 (save-excursion |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
530 (goto-char (point-min)) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
531 (while (re-search-forward regexp nil t) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
532 (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
|
533 ;; 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
|
534 ;; 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
|
535 ;; and the command name? |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
536 (substring (match-string-no-properties 0) 2)) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
537 plist))) |
94621
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
538 (setq plist (nreverse plist)) |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
539 (if (not plist) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
540 (message "No processes marked") |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
541 (unless signal |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
542 ;; Display marked processes (code taken from `dired-mark-pop-up'). |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
543 (let ((bufname " *Marked Processes*") |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
544 (header (save-excursion |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
545 (goto-char (+ 2 (point-min))) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
546 (buffer-substring-no-properties |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
547 (point) (line-end-position))))) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
548 (with-current-buffer (get-buffer-create bufname) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
549 (setq truncate-lines t) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
550 (erase-buffer) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
551 (insert header "\n") |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
552 (dolist (proc plist) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
553 (insert (cdr proc) "\n")) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
554 (save-window-excursion |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
555 (dired-pop-to-buffer bufname) ; all we need |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
556 (let* ((completion-ignore-case t) |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
557 (pnum (if (= 1 (length plist)) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
558 "1 process" |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
559 (format "%d processes" (length plist)))) |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
560 ;; The following is an ugly hack. Is there a better way |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
561 ;; to help people like me to remember the signals and |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
562 ;; their meanings? |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
563 (tmp (completing-read (concat "Send signal [" pnum |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
564 "] (default TERM): ") |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
565 proced-signal-list |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
566 nil nil nil nil "TERM"))) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
567 (setq signal (if (string-match "^\\(\\S-+\\)\\s-" tmp) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
568 (match-string 1 tmp) tmp)))))) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
569 ;; send signal |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
570 (let ((count 0) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
571 err-list) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
572 (if (functionp proced-signal-function) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
573 ;; use built-in `signal-process' |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
574 (let ((signal (if (stringp signal) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
575 (if (string-match "\\`[0-9]+\\'" signal) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
576 (string-to-number signal) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
577 (make-symbol signal)) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
578 signal))) ; number |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
579 (dolist (process plist) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
580 (if (zerop (funcall |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
581 proced-signal-function |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
582 (string-to-number (car process)) signal)) |
94066
f446992a6a91
(proced-send-signal): Fix error recognition.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94063
diff
changeset
|
583 (setq count (1+ count)) |
f446992a6a91
(proced-send-signal): Fix error recognition.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94063
diff
changeset
|
584 (push (cdr process) err-list)))) |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
585 ;; use external system call |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
586 (let ((signal (concat "-" (if (numberp signal) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
587 (number-to-string signal) signal)))) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
588 (dolist (process plist) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
589 (if (zerop (call-process |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
590 proced-signal-function nil 0 nil |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
591 signal (car process))) |
94066
f446992a6a91
(proced-send-signal): Fix error recognition.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94063
diff
changeset
|
592 (setq count (1+ count)) |
f446992a6a91
(proced-send-signal): Fix error recognition.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94063
diff
changeset
|
593 (push (cdr process) err-list))))) |
94063
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
594 (if err-list |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
595 ;; FIXME: that's not enough to display the errors. |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
596 (message "%s: %s" signal err-list) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
597 (proced-success-message "Sent signal to" count))) |
ab8c45d22418
(proced-command-alist): Remove sort column.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93248
diff
changeset
|
598 ;; final clean-up |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
599 (run-hooks 'proced-after-send-signal-hook))))) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
600 |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
601 (defun proced-help () |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
602 "Provide help for the `proced' user." |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
603 (interactive) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
604 (if (eq last-command 'proced-help) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
605 (describe-mode) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
606 (message proced-help-string))) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
607 |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
608 (defun proced-undo () |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
609 "Undo in a proced buffer. |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
610 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
|
611 buffer. You can use it to recover marks." |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
612 (interactive) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
613 (let (buffer-read-only) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
614 (undo)) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
615 (message "Change in proced buffer undone. |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
616 Killed processes cannot be recovered by Emacs.")) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
617 |
94621
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
618 ;;; Sorting |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
619 (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
|
620 "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
|
621 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
|
622 (interactive |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
623 (list (let* ((completion-ignore-case t) |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
624 (scheme (completing-read "Sorting type: " |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
625 proced-sorting-schemes-alist nil t))) |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
626 (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
|
627 (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
|
628 (progn |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
629 (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
|
630 (proced-update)) |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
631 (error "Proced sorting scheme %s undefined" scheme))) |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
632 |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
633 (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
|
634 "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
|
635 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
|
636 (or (not scheme) |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
637 (assoc scheme 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
|
638 |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
639 (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
|
640 "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
|
641 (interactive) |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
642 (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
|
643 |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
644 (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
|
645 "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
|
646 (interactive) |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
647 (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
|
648 |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
649 (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
|
650 "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
|
651 (interactive) |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
652 (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
|
653 |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
654 (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
|
655 "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
|
656 (interactive) |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
657 (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
|
658 |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
659 (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
|
660 "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
|
661 (interactive) |
97585dd63d91
(proced-command-alist): Fix system-type values. Fix defcustom.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
94109
diff
changeset
|
662 (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
|
663 |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
664 (provide 'proced) |
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
665 |
93248
072dbbf778d2
Add arch-tag.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
93213
diff
changeset
|
666 ;; arch-tag: a6e312ad-9032-45aa-972d-31a8cfc545af |
93212
134b2dc25692
proced.el: New file.
Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
parents:
diff
changeset
|
667 ;;; proced.el ends here. |