annotate lisp/modes/view-process-mode.el @ 183:e121b013d1f0 r20-3b18

Import from CVS: tag r20-3b18
author cvs
date Mon, 13 Aug 2007 09:54:23 +0200
parents 5a88923fcbfe
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1 ;;; view-process-mode.el --- Display current running processes
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3 ;; Copyright (C) 1994, 1995, 1996 Heiko Muenkel
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
4
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
5 ;; Author: Heiko Muenkel <muenkel@tnt.uni-hannover.de>
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
6 ;; Keywords: processes
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
7
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
8 ;; This file is part of XEmacs.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
9
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
10 ;; XEmacs is free software; you can redistribute it and/or modify it
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
11 ;; under the terms of the GNU General Public License as published by
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
12 ;; the Free Software Foundation; either version 2, or (at your
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
13 ;; option) any later version.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
14
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
15 ;; XEmacs is distributed in the hope that it will be useful, but
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
16 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
18 ;; General Public License for more details.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
19
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
21 ;; along with XEmacs; See the file COPYING. if not, write to the Free
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
22 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
23 ;; 02111-1307, USA.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
24
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
25 ;;; Synched up with: Emacs 20.1
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
26
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
27 ;;; Commentary:
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
28
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
29 ;; DollarId: view-process-mode.el,v 1.113 1996/08/17 15:12:01 muenkel Exp $
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
30 ;; This file defines the the view-process-mode, a mode for displaying
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
31 ;; the current processes with ps on UNIX systems. There are also
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
32 ;; commands to sort and filter the output and to send signals to the
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
33 ;; processes.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
34
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
35 ;; You can display the processes with the command `view-processes'.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
36 ;; If you are familar with the UNIX ps command and its switches,
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
37 ;; then you can also use the command `View-process-status' or
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
38 ;; it's short cut `ps', which are asking for the command
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
39 ;; switches. You can also run the commands on a remote system
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
40 ;; via rsh. For that you must give a prefix arg to the
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
41 ;; commands. This leads to a question for the remote host name.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
42
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
43 ;; You need also the files: adapt.el
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
44 ;; view-process-system-specific.el
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
45 ;; view-process-xemacs.el
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
46 ;; view-process-emacs-19.el
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
47 ;;
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
48 ;; Installation:
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
49 ;;
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
50 ;; Put this file and the file adapt.el
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
51 ;; in one of your your load-path directories and
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
52 ;; the following line in your ~/.emacs (without leading ;;;):
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
53 ;; (autoload 'ps "view-process-mode"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
54 ;; "Prints a list with processes in the buffer `View-process-buffer-name'.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
55 ;; COMMAND-SWITCHES is a string with the command switches (ie: -aux).
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
56 ;; IF the optional argument REMOTE-HOST is given, then the command will
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
57 ;; be executed on the REMOTE-HOST. If an prefix arg is given, then the
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
58 ;; function asks for the name of the remote host."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
59 ;; t)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
60 ;;
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
61 ;; In the FSF Emacs 19 you should (but must not) put the following
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
62 ;; line in your ~/.emacs:
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
63 ;;; (transient-mark-mode nil)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
64
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
65 ;;; Code:
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
66
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
67 (provide 'view-process-mode)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
68 (require 'view-process-system-specific)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
69
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
70 (defconst View-process-package-version "2.4")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
71
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
72 (defconst View-process-package-name "hm--view-process")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
73
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
74 (defconst View-process-package-maintainer "muenkel@tnt.uni-hannover.de")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
75
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
76 (defun View-process-xemacs-p ()
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
77 "Returns non nil if the editor is the XEmacs or lemacs."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
78 (or (string-match "Lucid" emacs-version)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
79 (string-match "XEmacs" emacs-version)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
80
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
81 (defun View-process-lemacs-p ()
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
82 "Returns non nil if the editor is the lemacs."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
83 (string-match "Lucid" emacs-version))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
84
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
85 (if (not (View-process-xemacs-p))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
86 (require 'view-process-adapt)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
87 )
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
88
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
89 (defvar View-process-status-command "ps"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
90 "*Command which reports process status (ps).
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
91 The variable is buffer local.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
92
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
93 (make-variable-buffer-local 'View-process-status-command)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
94
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
95 (defvar View-process-status-command-switches-bsd "-auxw"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
96 "*Switches for the command `view-processes' on BSD systems.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
97 Switches which suppresses the header line are not allowed here.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
98
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
99 (defvar View-process-status-command-switches-system-v "-edaf"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
100 "*Switches for the command `view-processes' on System V systems.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
101 Switches which suppresses the header line are not allowed here.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
102
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
103 (defvar View-process-status-last-command-switches nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
104 "Switches of the last `View-process-status-command'.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
105 The variable is buffer local.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
106
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
107 (make-variable-buffer-local 'View-process-status-last-command-switches)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
108
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
109 (defvar View-process-signal-command "kill"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
110 "*Command which sends a signal to a process (kill).
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
111 The variable is buffer local.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
112
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
113 (make-variable-buffer-local 'View-process-signal-command)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
114
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
115 (defvar View-process-renice-command "renice"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
116 "*Command which alter priority of running processes.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
117
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
118 (make-variable-buffer-local 'View-process-renice-command)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
119
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
120 (defvar View-process-default-nice-value "4"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
121 "*Default nice value for altering the priority of running processes.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
122
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
123 (defvar View-process-rsh-command "rsh"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
124 "*Remote shell command (rsh).
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
125 The variable is buffer local.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
126
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
127 (make-variable-buffer-local 'View-process-rsh-command)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
128
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
129 (defvar View-process-uname-command "uname"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
130 "*The uname command (It returns the system name).
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
131 The variable is buffer local.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
132
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
133 (make-variable-buffer-local 'View-process-uname-command)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
134
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
135 (defvar View-process-uname-switches "-sr"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
136 "*Switches for uname, so that it returns the sysname and the release.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
137
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
138 (defvar View-process-test-command "test"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
139 "*The test command.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
140
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
141 (make-variable-buffer-local 'View-process-test-command)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
142
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
143 (defvar View-process-test-switches "-x"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
144 "*Switches for test, to test if an executable exists.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
145
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
146 (defvar View-process-uptime-command "uptime"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
147 "*The uptime command.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
148 No idea at the moment, if this exists on all systems.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
149 It should return some informations over the system.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
150
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
151 (make-variable-buffer-local 'View-process-uptime-command)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
152
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
153 (defvar View-process-buffer-name "*ps*"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
154 "Name of the output buffer for the 'View-process-mode'.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
155 The variable is buffer local.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
156
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
157 (make-variable-buffer-local 'View-process-buffer-name)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
158
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
159 (defvar View-process-mode-hook nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
160 "*This hook is run after reading in the processes.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
161
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
162 (defvar View-process-motion-help t
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
163 "*If non nil, then help messages are displayed during mouse motion.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
164 The variable is buffer local.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
165
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
166 (make-variable-buffer-local 'View-process-motion-help)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
167
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
168 (defvar View-process-display-with-2-windows t
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
169 "*Determines the display type of the `View-process-mode'.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
170 If it is non nil, then 2 windows are used instead of one window.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
171 In the second window are the header lines displayed.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
172
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
173 (defvar View-process-hide-header t
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
174 "*The header lines in the view processes buffer are hide, if this is t.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
175
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
176 (make-variable-buffer-local 'View-process-hide-header)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
177
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
178 (defvar View-process-truncate-lines t
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
179 "*Truncates the liens in the view process buffer if t.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
180
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
181 (make-variable-buffer-local 'View-process-truncate-lines)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
182
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
183 (defvar View-process-display-short-key-descriptions t
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
184 "*Controls, whether short key descriptions are displayed or not.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
185
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
186 (defvar View-process-display-uptime t
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
187 "*Controls, whether the uptime is displayed or not.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
188
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
189 (defvar View-process-use-font-lock t
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
190 "*Determines, if the `font-lock-mode' should be used or not.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
191
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
192 (defvar View-process-ps-header-window-offset 2
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
193 "Offset for the size of the ps header window.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
194
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
195 (defvar View-process-ps-header-window-size 0
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
196 "Internal variable. The size of the window with the *ps header* buffer.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
197
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
198 (make-variable-buffer-local 'View-process-ps-header-window-size)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
199
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
200 (defvar View-process-stop-motion-help nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
201 "Internal variable. Stops motion help temporarily.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
202
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
203 (defvar View-process-deleted-lines nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
204 "Internal variable. A list with lines, which are deleted by a filter.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
205
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
206 (make-variable-buffer-local 'View-process-deleted-lines)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
207
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
208 (defvar View-process-header-buffer-name "*ps header*"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
209 "Name of the view process header buffer.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
210
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
211 (make-variable-buffer-local 'View-process-header-buffer-name)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
212
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
213 (defvar View-process-header-mode-name "psheader"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
214 "Name of the `view process header mode'.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
215
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
216 (defvar View-process-header-mode-hook nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
217 "*This hook is run after building the header buffer.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
218
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
219 (defvar View-process-header-mode-line-off t
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
220 "t means do not display modeline in view-process-header-mode.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
221 This does only work in the XEmacs 19.12 or higher.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
222
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
223 (defvar View-process-header-line-detection-list '("PID" "COMMAND" "COMD" "CMD")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
224 "*The header line is detected with the help of this list.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
225 At least one of these words must be in a header line. Otherwise
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
226 an error is signaled. YOu must only change this list, if your ps
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
227 prodices header lines with strings, that are not in this list.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
228
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
229 (defvar View-process-header-line-background "yellow"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
230 "*Background color of the header line.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
231
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
232 (defvar View-process-header-line-foreground "blue"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
233 "*Foreground color of the header line.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
234
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
235 (defvar View-process-header-line-font (face-font 'bold)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
236 "*Font of the header line")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
237
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
238 (defvar View-process-header-line-underline-p t
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
239 "*T, if the header line should be underlined.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
240
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
241 (defvar View-process-no-mark ?_
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
242 "*A character with specifies, that a line isn't marked.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
243
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
244 (defvar View-process-signaled-line-background nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
245 "*Background color of the line with a signaled or reniced process.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
246
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
247 (defvar View-process-signaled-line-foreground "grey80"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
248 "*Foreground color of the line with a signaled or reniced process.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
249
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
250 (defvar View-process-signaled-line-font (face-font 'italic)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
251 "*Font of the line with a signaled or reniced process.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
252
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
253 (defvar View-process-signaled-line-underline-p nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
254 "*T, if the \"signaled line\" should be underlined.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
255
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
256 (defvar View-process-signaled-line-mark ?s
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
257 "*A character, which is used as a mark for \"signaled lines\".")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
258
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
259 (defvar View-process-signal-line-background nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
260 "*Background color of the line with the process which should be signaled.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
261
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
262 (defvar View-process-signal-line-foreground "red"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
263 "*Foreground color of the line with the process which should be signaled.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
264
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
265 (defvar View-process-signal-line-font (face-font 'bold)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
266 "*Font of the line with the process which should be signaled.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
267
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
268 (defvar View-process-signal-line-underline-p nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
269 "*T, if the \"signal line\" should be underlined.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
270
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
271 (defvar View-process-signal-line-mark ?K
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
272 "*A character, which is used as a mark for \"signal lines\".")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
273
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
274 (defvar View-process-renice-line-background nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
275 "*Background color of the line with the process which should be reniced.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
276
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
277 (defvar View-process-renice-line-foreground "red"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
278 "*Foreground color of the line with the process which should be reniced.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
279
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
280 (defvar View-process-renice-line-font (face-font 'bold)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
281 "*Font of the line with the process which should be reniced.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
282
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
283 (defvar View-process-renice-line-underline-p nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
284 "*T, if the \"renice line\" should be underlined.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
285
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
286 (defvar View-process-renice-line-mark ?N
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
287 "*A character, which is used as a mark for \"renice lines\".")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
288
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
289 (defvar View-process-child-line-background nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
290 "*Background color of a line with a child process.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
291
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
292 (defvar View-process-child-line-foreground "darkviolet"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
293 "*Foreground color of a line with a child process.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
294
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
295 (defvar View-process-child-line-font (face-font 'italic)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
296 "*Font color of a line with a child process.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
297
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
298 (defvar View-process-child-line-underline-p nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
299 "*T, if the \"line with a child process\" should be underlined.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
300
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
301 (defvar View-process-child-line-mark ?C
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
302 "*A character, which is used as a mark for child processes.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
303
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
304 (defvar View-process-parent-line-background "LightBlue"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
305 "*Background color of a line with a parent process.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
306
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
307 (defvar View-process-parent-line-foreground "darkviolet"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
308 "*Foreground color of a line with a parent process.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
309
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
310 (defvar View-process-parent-line-font (face-font 'bold)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
311 "*Font color of a line with a parent process.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
312
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
313 (defvar View-process-parent-line-underline-p t
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
314 "*T, if the \"line with a parent\" should be underlined.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
315
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
316 (defvar View-process-parent-line-mark ?P
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
317 "*A character, which is used as a mark for parent processes.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
318
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
319 (defvar View-process-single-line-background nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
320 "*Background color of a line with a single line mark.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
321
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
322 (defvar View-process-single-line-foreground "darkblue"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
323 "*Foreground color of a line with a single line mark.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
324
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
325 (defvar View-process-single-line-font (face-font 'bold)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
326 "*Font color of a line with a single line mark.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
327
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
328 (defvar View-process-single-line-underline-p t
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
329 "*T, if the \"line with a single line mark\" should be underlined.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
330
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
331 (defvar View-process-single-line-mark ?*
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
332 "*A character, which is used as a single line mark.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
333
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
334 (defvar View-process-font-lock-keywords
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
335 (list
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
336 (cons (concat "^"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
337 (char-to-string View-process-child-line-mark)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
338 " .*")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
339 'View-process-child-line-face)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
340 (cons (concat "^"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
341 (char-to-string View-process-parent-line-mark)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
342 " .*")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
343 'View-process-parent-line-face)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
344 (cons (concat "^\\"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
345 (char-to-string View-process-single-line-mark)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
346 " .*")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
347 'View-process-single-line-face)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
348 (cons (concat "^"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
349 (char-to-string View-process-signaled-line-mark)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
350 " .*")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
351 'View-process-signaled-line-face)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
352 (cons (concat "^"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
353 (char-to-string View-process-signal-line-mark)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
354 " .*")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
355 'View-process-signal-line-face)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
356 (cons (concat "^"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
357 (char-to-string View-process-renice-line-mark)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
358 " .*")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
359 'View-process-renice-line-face)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
360 )
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
361 "The font lock keywords for the `View-process-mode'."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
362 )
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
363
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
364 (defvar View-process-pid-mark-alist nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
365 "Internal variable. An alist with marks and pids.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
366
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
367 (make-variable-buffer-local 'View-process-pid-mark-alist)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
368
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
369 (defvar View-process-last-pid-mark-alist nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
370 "Internal variable. An alist withthe last marks and pids.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
371
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
372 (make-variable-buffer-local 'View-process-last-pid-mark-alist)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
373
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
374 (defvar View-process-sorter-and-filter nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
375 "*A list, which specifies sorter and filter commands.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
376 These commands will be run over the ps output, every time after
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
377 ps has create a new output.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
378 The list consists of sublists, whereby every sublist specifies a
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
379 command. The first element of each list is a keyword, which
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
380 determines a command.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
381 The following keywords are allowed:
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
382 sort - Sort the output by an output field
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
383 filter - Filter the output by an output field, delete non matching l.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
384 exclude-filter - Filter the output by an output field, delete matching lines
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
385 grep - Filter the output by the whole line, delete non matching l.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
386 exclude-grep - Filter the output by the whole line, delete matching lines
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
387 reverse - Reverse the order of the output lines.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
388
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
389 The cdr of each sublist depends on the keyword. The following shows
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
390 the syntax of the different sublist types:
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
391 (sort <fieldname>)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
392 (filter <fieldname> <regexp>)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
393 (exclude-filter <fieldname> <regexp>)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
394 (grep <regexp>)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
395 (exclude-grep <regexp>)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
396 (reverse)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
397
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
398 Where <fieldname> is a string with determines the name of an output field
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
399 and <regexp> is a string with an regular expression. The output field names
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
400 are derived from the header line of the ps output.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
401
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
402 (defvar View-process-actual-sorter-and-filter nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
403 "Internal variable. It holds the actual sorter and filter commands.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
404 Don't change it!")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
405
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
406 (make-variable-buffer-local 'View-process-actual-sorter-and-filter)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
407
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
408 (defvar View-process-itimer-value 5
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
409 "*Value of the view process itimer.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
410
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
411 (defvar View-process-system-type nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
412 "Internal variable. Type of the system, on which the ps command is called.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
413 The variable is buffer local.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
414
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
415 (make-variable-buffer-local 'View-process-system-type)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
416
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
417 (defvar View-process-remote-host nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
418 "Internal variable. Name of the remote host or nil.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
419 The variable is buffer local.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
420
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
421 (make-variable-buffer-local 'View-process-remote-host)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
422
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
423 (defvar View-process-header-start nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
424 "Internal variable. Start of the ps output header line.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
425 The variable is buffer local.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
426
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
427 (make-variable-buffer-local 'View-process-header-start)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
428
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
429 (defvar View-process-header-end nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
430 "Internal variable. End of the ps output header line.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
431 The variable is buffer local.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
432
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
433 (make-variable-buffer-local 'View-process-header-end)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
434
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
435 (defvar View-process-output-start nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
436 "Internal variable. Start of the ps output (after the header).
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
437 The variable is buffer local.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
438
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
439 (make-variable-buffer-local 'View-process-output-start)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
440
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
441 (defvar View-process-output-end nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
442 "Internal variable. End of the ps output (after the header).
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
443 The variable is buffer local.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
444
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
445 (make-variable-buffer-local 'View-process-output-end)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
446
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
447 (defvar View-process-old-window-configuration nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
448 "Internal variable. Window configuration before the first ps command.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
449
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
450 (make-variable-buffer-local 'View-process-old-window-configuration)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
451
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
452 (defvar View-process-max-fields nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
453 "Internal variable. Number of output fields.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
454 The variable is buffer local.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
455
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
456 (make-variable-buffer-local 'View-process-max-fields)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
457
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
458 (defvar View-process-field-names nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
459 "Internal variable. An alist with the fieldnames and fieldnumbers.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
460 The variable is buffer local.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
461
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
462 (make-variable-buffer-local 'View-process-max-fields)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
463
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
464 (defvar View-process-field-blanks-already-replaced nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
465 "Internal variable. It is t, if blanks in fields are already replaced.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
466
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
467 (make-variable-buffer-local 'View-process-field-blanks-already-replaced)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
468
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
469 (defvar View-process-kill-signals nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
470 "An alist with the possible signals for the kill command.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
471 Don't change it by hand!
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
472 The variable is initialised each time after running ps.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
473 The variable is buffer local.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
474
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
475 (make-variable-buffer-local 'View-process-kill-signals)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
476
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
477 (defvar View-process-kill-signals-general
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
478 '(("SIGHUP" "1") ("SIGKILL" "9") ("SIGTERM" "15")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
479 ("1" "1") ("2" "2") ("3" "3") ("4" "4") ("5" "5") ("6" "6") ("7" "7")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
480 ("8" "8") ("9" "9") ("10" "10") ("11" "11") ("12" "12") ("13" "13")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
481 ("14" "14") ("15" "15") ("16" "16") ("17" "17") ("18" "18")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
482 ("19" "19") ("20" "20") ("21" "21") ("22" "22") ("23" "23")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
483 ("24" "24") ("25" "25") ("26" "26") ("27" "27") ("28" "28")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
484 ("29" "29") ("30" "30") ("31" "31"))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
485 "An alist with the possible signals for the kill command.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
486 This list is used, if no system specific list is defined.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
487 It may be that you've other signals on your system. Try to test
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
488 it with \"kill -l\" in a shell.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
489
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
490 (defvar View-process-default-kill-signal "SIGTERM"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
491 "*Default signal for the function `View-process-send-signal-to-process'.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
492 The string must be also in the alist `View-process-kill-signals'!")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
493
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
494 (defvar View-process-pid-field-name "PID"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
495 "*The name of the field with the PID's.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
496 The name must be the same as in the first outputline of the
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
497 command `View-process-status-command' (ps).
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
498 The variable is buffer local.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
499
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
500 (make-variable-buffer-local 'View-process-pid-field-name)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
501
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
502 (defvar View-process-ppid-field-name "PPID"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
503 "*The name of the field with the PPID's.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
504 The name must be the same as in the first outputline of the
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
505 command `View-process-status-command' (ps).
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
506 The variable is buffer local.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
507
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
508 (make-variable-buffer-local 'View-process-ppid-field-name)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
509
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
510 (defvar View-process-host-names-and-system-types nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
511 "A list with the names and the system types of hosts.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
512 Each entry of the list looks like the following:
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
513 (<hostname> (<system-type> <version-number> <bsd-or-system-v>
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
514 <field-name-descriptions>
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
515 <kill-signals>))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
516 Here are some examples:
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
517 (\"daedalus\" (\"sunos\" \"4\" \"bsd\"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
518 View-process-field-name-descriptions-sunos4
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
519 View-process-kill-signals-sunos4))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
520 (\"bach\" (\"linux\" nil \"bsd\"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
521 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
522 View-process-kill-signals-linux
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
523 ))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
524 (\"cesar\" (nil nil \"bsd\"))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
525 The list will be anhanced by the program, each time you run ps on
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
526 a new system. But you can also set this variable by hand in your
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
527 .emacs. If the host name is found in this list, then the system
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
528 type will not be checked again."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
529 )
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
530
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
531 (defvar View-process-status-history nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
532 "A list with the command switch history of the status command (ps).")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
533
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
534 (defvar View-process-remote-host-history nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
535 "A list with the remote host history.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
536
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
537 (defvar View-process-field-name-history nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
538 "A list with the field name history.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
539
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
540 (defvar View-process-filter-history nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
541 "A list with the filter history.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
542
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
543 (defvar View-process-signal-history nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
544 "A list with the signal history.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
545
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
546 (defvar View-process-field-name-descriptions nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
547 "Help list with the descriptions of ps fields.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
548 Don't change it by hand!
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
549 The variable is initialised each time after running ps.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
550 The variable is buffer local.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
551
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
552 (make-variable-buffer-local 'View-process-field-name-descriptions)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
553
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
554 (defvar View-process-field-name-descriptions-general
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
555 '(
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
556 ("m" "Mark column of the View Processes Mode.") ; not a real field name
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
557 ("ADDR" "The memory address of the process. ")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
558 ("%CPU" "CPU usage in percentage.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
559 ("%MEM" "Real Memory usage in percentage.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
560 ("COMMAND" "Command Name.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
561 ("F" ("Status= "
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
562 ("0" "0=not in main memory.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
563 ("1" "1=in main memory.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
564 ("2" "2=system process.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
565 ("4" "4=blocked in the main memory.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
566 ("10" "10=swapped out.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
567 ("20" "20=controlled by another one.")))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
568 ("NI" "UNIX nice value, a positive value means less CPU time.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
569 ("PAGEIN" "Number of major page faults.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
570 ("PGID" "Process group id. ")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
571 ("PID" "The process id.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
572 ("PPID" "The process id of the parent process.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
573 ("PRI" "Priority, a big value is a small priority.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
574 ("RSS" "Real (resident set) size, KBytes of program in memory.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
575 ("SHARE" "Shared memory")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
576 ("SID" "ID of the session to which the process belongs. ")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
577 ("SIZE" "Virtual image size, size of text+data+stack (in KByte ?).")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
578 ("START" "Start time.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
579 ("STAT" ("Status. "
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
580 ("R" "R=runnable. ")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
581 ("S" "S=sleeping. ")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
582 ("D" "D=un-interruptible sleep (eg disk or NFS I/O). ")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
583 ("T" "T=stopped or traced. ")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
584 ("Z" "Z=zombie (terminated). ")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
585 ("W" "W=waiting on an event. ")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
586 ("I" "I=intermediate status. ")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
587 ("N" "N=started with nice. ")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
588 ))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
589 ("SWAP" "Kilobytes (with -p pages) on swap device.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
590 ("TIME" "Elapsed process time.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
591 ("TPGID" "Process group id of the associated terminal. ")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
592 ("TRS" "Text resident size.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
593 ("TT" ("Dialog station. " ("?" "?=No dialog station")))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
594 ("TTY" ("Dialog station. " ("?" "?=No dialog station")))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
595 ("UID" "User Id.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
596 ("USER" "Owner of the process.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
597 ("WCHAN" "Name of the kernel function where the process is sleeping.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
598 )
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
599 "Help list with the descriptions of ps fields.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
600 This is a general list, which should be true for many systems.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
601 This list will only be used, if there is no entry in a special
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
602 list for the system.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
603
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
604 (defvar View-process-insert-blank-alist
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
605 '(("SZ" behind-predecessor 0)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
606 ("SIZE" behind-predecessor 0)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
607 ("RSS" behind-predecessor 0)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
608 ("START" behind 1))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
609 "Determines places in the output, where a blank should be inserted.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
610 It is an alist and each sublist has the following structure:
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
611 (field-name position-descriptor offset)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
612 The field-name is a string with the name of the field.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
613 The position-descriptor determines a position. It has one of the
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
614 following values:
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
615 `in-front' => insert in front of the field.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
616 `in-front-successor' => insert in front of the successor of the field.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
617 `behind' => insert behind of the field.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
618 `behind-predecessor' => insert behind the predecessor of the field.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
619 The offset is an integer , which specifies an offset.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
620
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
621 (defvar View-process-mode-syntax-table nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
622 "Syntax table for the `View-process-mode'.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
623
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
624 (if (not View-process-mode-syntax-table)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
625 (let ((i 0))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
626 (setq View-process-mode-syntax-table (make-syntax-table))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
627 (setq i ?!)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
628 (while (<= i ?#)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
629 (modify-syntax-entry i "w" View-process-mode-syntax-table)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
630 (setq i (1+ i)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
631 (modify-syntax-entry ?, "w" View-process-mode-syntax-table)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
632 (modify-syntax-entry ?. "w" View-process-mode-syntax-table)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
633 (setq i ?:)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
634 (while (<= i ?\;)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
635 (modify-syntax-entry i "w" View-process-mode-syntax-table)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
636 (setq i (1+ i)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
637 (setq i ??)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
638 (while (<= i ?@)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
639 (modify-syntax-entry i "w" View-process-mode-syntax-table)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
640 (setq i (1+ i)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
641 (modify-syntax-entry ?\\ "w" View-process-mode-syntax-table)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
642 (modify-syntax-entry ?^ "w" View-process-mode-syntax-table)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
643 (modify-syntax-entry ?` "w" View-process-mode-syntax-table)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
644 (modify-syntax-entry ?' "w" View-process-mode-syntax-table)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
645 (modify-syntax-entry ?~ "w" View-process-mode-syntax-table)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
646 (modify-syntax-entry ?¡ "w" View-process-mode-syntax-table)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
647 ))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
648
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
649 (defvar View-process-digit-bindings-send-signal nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
650 "The digits 1 to 9 will be bind to send signal commands, if t.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
651
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
652 (defvar View-process-mode-mark-map nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
653 "Local subkeymap for View-process-mode buffers.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
654
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
655 (if View-process-mode-mark-map
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
656 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
657 (setq View-process-mode-mark-map (make-keymap))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
658 (define-key View-process-mode-mark-map "m" 'View-process-mark-current-line)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
659 (define-key View-process-mode-mark-map "u" 'View-process-unmark-current-line)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
660 (define-key View-process-mode-mark-map "U" 'View-process-unmark-all)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
661 (define-key View-process-mode-mark-map "c"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
662 'View-process-mark-childs-in-current-line)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
663 (define-key View-process-mode-mark-map "l" 'View-process-reset-last-marks)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
664 )
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
665
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
666 (defvar View-process-mode-i-map nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
667 "Local subkeymap for View-process-mode buffers.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
668
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
669 (if View-process-mode-i-map
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
670 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
671 (setq View-process-mode-i-map (make-keymap))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
672 (define-key View-process-mode-i-map "s" 'View-process-start-itimer)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
673 (define-key View-process-mode-i-map "d" 'View-process-delete-itimer)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
674 )
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
675
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
676 (defvar View-process-mode-comma-map nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
677 "Local subkeymap for View-process-mode buffers.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
678
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
679 (if View-process-mode-comma-map
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
680 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
681 (setq View-process-mode-comma-map (make-keymap))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
682 (define-key View-process-mode-comma-map "k"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
683 'View-process-send-signal-to-processes-with-mark)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
684 (define-key View-process-mode-comma-map "a"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
685 'View-process-renice-processes-with-mark))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
686
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
687 (defvar View-process-mode-period-map nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
688 "Local subkeymap for View-process-mode buffers.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
689
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
690 (if View-process-mode-period-map
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
691 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
692 (setq View-process-mode-period-map (make-keymap))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
693 (define-key View-process-mode-period-map "f"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
694 'View-process-filter-region-by-current-field)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
695 (define-key View-process-mode-period-map "l"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
696 'View-process-filter-region)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
697 (define-key View-process-mode-period-map "s"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
698 'View-process-sort-region-by-current-field)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
699 (define-key View-process-mode-period-map "r"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
700 'View-process-reverse-region)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
701 (define-key View-process-mode-period-map "k"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
702 'View-process-send-signal-to-processes-in-region)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
703 (define-key View-process-mode-period-map "a"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
704 'View-process-renice-processes-in-region)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
705 (define-key View-process-mode-period-map "v"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
706 'View-process-status))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
707
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
708
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
709 (defvar View-process-mode-map nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
710 "Local keymap for View-process-mode buffers.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
711
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
712 (if View-process-mode-map
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
713 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
714 (setq View-process-mode-map (make-keymap))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
715 (define-key View-process-mode-map "q" 'View-process-quit)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
716 (define-key View-process-mode-map "V" 'View-process-display-version)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
717 (define-key View-process-mode-map " " 'scroll-up)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
718 (define-key View-process-mode-map "b" 'scroll-down)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
719 (define-key View-process-mode-map "t" 'View-process-toggle-truncate-lines)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
720 (define-key View-process-mode-map "u" 'View-process-status-update)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
721 (define-key View-process-mode-map "U"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
722 'View-process-remove-all-filter-and-sorter)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
723 (define-key View-process-mode-map "g" 'revert-buffer)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
724 ; (define-key View-process-mode-map "v" 'View-process-status)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
725 (define-key View-process-mode-map "v" 'view-processes)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
726 (define-key View-process-mode-map "f"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
727 'View-process-filter-by-current-field-g)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
728 (define-key View-process-mode-map "F"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
729 'View-process-filter-output-by-current-field)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
730 (define-key View-process-mode-map "l"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
731 'View-process-filter-g)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
732 (define-key View-process-mode-map "L"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
733 'View-process-filter-output)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
734 (define-key View-process-mode-map "s"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
735 'View-process-sort-by-current-field-g)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
736 (define-key View-process-mode-map "S"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
737 'View-process-sort-output-by-current-field)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
738 (define-key View-process-mode-map "r"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
739 'View-process-reverse-g)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
740 (define-key View-process-mode-map "R"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
741 'View-process-reverse-output)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
742 (define-key View-process-mode-map "k"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
743 'View-process-send-signal-to-processes-g)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
744 (define-key View-process-mode-map "K"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
745 'View-process-send-signal-to-process-in-line)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
746 (define-key View-process-mode-map "a"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
747 'View-process-renice-processes-g)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
748 (define-key View-process-mode-map "A"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
749 'View-process-renice-process-in-line)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
750 ; (define-key View-process-mode-map "k"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
751 ; 'View-process-send-signal-to-process)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
752 (define-key View-process-mode-map "?"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
753 'View-process-which-field-name)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
754 (define-key View-process-mode-map "h"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
755 'View-process-show-field-names)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
756 (define-key View-process-mode-map "e"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
757 'View-process-display-emacs-pid)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
758 (define-key View-process-mode-map "w" 'View-process-show-pid-and-command)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
759 (define-key View-process-mode-map "n" 'View-process-next-field)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
760 (define-key View-process-mode-map "p" 'View-process-previous-field)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
761 (define-key View-process-mode-map "<" 'View-process-output-start)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
762 (define-key View-process-mode-map ">" 'View-process-output-end)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
763 (define-key View-process-mode-map [return]
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
764 'View-process-goto-first-field-next-line)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
765 (define-key View-process-mode-map "M" 'View-process-submit-bug-report)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
766 (define-key View-process-mode-map "m" View-process-mode-mark-map)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
767 (define-key View-process-mode-map "." View-process-mode-period-map)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
768 (define-key View-process-mode-map "," View-process-mode-comma-map)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
769 (define-key View-process-mode-map "i" View-process-mode-i-map)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
770 )
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
771
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
772 (defvar View-process-pulldown-menu-name "Processes"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
773 "Name of the pulldown menu in the `View-process-mode'.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
774
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
775 (defvar View-process-pulldown-menu nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
776 "Pulldown menu list for the `View-process-mode'.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
777
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
778 (defvar View-process-region-menu nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
779 "Menu list for the `View-process-mode', used if a region is active.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
780
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
781 (defvar View-process-marked-menu nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
782 "Menu list for the `View-process-mode', used if marked lines exists.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
783 Not used, if a region is active.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
784
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
785 (defvar View-process-non-region-menu nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
786 "Menu list for the `View-process-mode', used if a region is not active.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
787
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
788 (defvar View-process-mode-name "Processes"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
789 "Name of the `view process mode'.")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
790
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
791 (defun View-process-make-field-postition-alist-1 ()
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
792 "Internal function of View-process-make-field-postition-alist."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
793 (if (>= (point) View-process-header-end)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
794 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
795 (let (start end)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
796 (skip-chars-forward " ")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
797 (setq start (current-column))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
798 (skip-chars-forward "^ ")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
799 (setq end (current-column))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
800 (cons (list start end)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
801 (View-process-make-field-postition-alist-1))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
802 )
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
803
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
804 (defun View-process-make-field-postition-alist ()
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
805 "Returns an alist with the start and end positions of each field.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
806 The list looks like ((start1 end1) (start2 end2) ...)."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
807 (save-restriction
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
808 (widen)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
809 (goto-char View-process-header-start)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
810 (View-process-make-field-postition-alist-1)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
811
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
812 (defun View-process-overwrite-chars-in-region (begin end char)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
813 "Overwrite region between BEGIN and END with CHAR."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
814 (let ((region-begin (if (< begin end) begin end))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
815 (region-end (if (> end begin) end begin)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
816 (save-excursion
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
817 (goto-char region-begin)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
818 (while (> region-end (point))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
819 (delete-char 1)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
820 (View-process-insert-and-inherit char)))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
821
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
822 (defun View-process-replaces-blanks-in-the-fields-of-this-line
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
823 (field-position-alist)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
824 "Replaces the blanks in the fields of this line with underscores.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
825 FIELD-POSITION-ALIST is an alist with the name and the
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
826 aproximated start and end positions of each field."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
827 (if (cdr field-position-alist) ; don't change the last field
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
828 (let ((field-start (+ (View-process-return-beginning-of-line)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
829 (car (car field-position-alist))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
830 (field-end (+ (View-process-return-beginning-of-line)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
831 (car (cdr (car field-position-alist)))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
832 (next-field-start (+ (View-process-return-beginning-of-line)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
833 (car (car
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
834 (cdr field-position-alist))))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
835 (goto-char field-start)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
836 (skip-chars-forward " ")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
837 (if (> (point) field-end)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
838 (progn (goto-char field-start)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
839 (delete-char 1)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
840 (View-process-insert-and-inherit "_"))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
841 (let ((search-result (search-forward-regexp "[ ]+" field-end t))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
842 (match-beginning nil))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
843 (if search-result
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
844 (if (not (= search-result field-end))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
845 (View-process-overwrite-chars-in-region (match-beginning 0)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
846 (match-end 0)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
847 ?_)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
848 (setq match-beginning (match-beginning 0))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
849 (if (and (search-forward-regexp "[^ ]+" next-field-start t)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
850 (not (eq (point) next-field-start)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
851 (View-process-overwrite-chars-in-region
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
852 match-beginning
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
853 (match-beginning 0)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
854 ?_))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
855 ))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
856 (View-process-replaces-blanks-in-the-fields-of-this-line
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
857 (cdr field-position-alist)))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
858
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
859 (defun View-process-replaces-blanks-in-fields ()
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
860 "Replaces the blanks in fields with underscrores."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
861 (save-excursion
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
862 (save-window-excursion
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
863 (let ((field-position-alist (View-process-make-field-postition-alist))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
864 (read-only buffer-read-only))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
865 (setq buffer-read-only nil)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
866 (goto-char View-process-output-start)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
867 (while (< (point) View-process-output-end)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
868 (beginning-of-line)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
869 (View-process-replaces-blanks-in-the-fields-of-this-line
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
870 field-position-alist)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
871 (forward-line))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
872 (setq buffer-read-only read-only)))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
873
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
874 (defun View-process-replaces-blanks-in-fields-if-necessary ()
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
875 "Replaces blanks in fields, if necessary.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
876 For that it checks `View-process-field-blanks-already-replaced'."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
877 (if View-process-field-blanks-already-replaced
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
878 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
879 (View-process-replaces-blanks-in-fields)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
880 (setq View-process-field-blanks-already-replaced t)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
881
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
882 (defun View-process-insert-column-in-region (char
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
883 column
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
884 begin
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
885 end
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
886 &optional overwrite
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
887 not-looking-at)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
888 "Inserts the CHAR at the COLUMN in the region from BEGIN TO END.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
889 The first line must have sufficient columns. No tabs are allowed.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
890 If the optional argument OVERWRITE is non nil, then the CHAR
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
891 overwrites the char in the COLUMN.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
892 The optional argument NOT-LOOKING-AT is nil or a regular expression.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
893 In the second case the insertation will only be done, if NOT-LOOKING-AT
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
894 isn't a string starting at the column."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
895 (save-excursion
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
896 (let ((no-of-lines (count-lines begin end))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
897 (line 1))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
898 (goto-char begin)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
899 (beginning-of-line)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
900 (while (<= line no-of-lines)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
901 (forward-char column)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
902 (if (not (= (current-column) column))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
903 (View-process-insert-and-inherit
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
904 (make-string (- column (current-column)) ? )))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
905 (if overwrite
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
906 (progn
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
907 (delete-char -1)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
908 (View-process-insert-and-inherit char))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
909 (if (or (not not-looking-at)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
910 (not (looking-at not-looking-at)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
911 (progn
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
912 (View-process-insert-and-inherit char)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
913 (forward-char -1)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
914 )))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
915 (forward-line 1)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
916 (setq line (1+ line))))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
917
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
918 (defun View-process-insert-blank-in-column (column
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
919 &optional overwrite
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
920 not-looking-at)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
921 "Inserts a blank in all lines of the ps output in column COLUMN.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
922 If OVERWRITE is non nil, then it overwrites the old column char.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
923 The optional argument NOT-LOOKING-AT is nil or a regular expression.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
924 In the second case the insertation will only be done, if NOT-LOOKING-AT
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
925 isn't a string starting at the column."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
926 (let ((read-only buffer-read-only))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
927 (setq buffer-read-only nil)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
928 (View-process-insert-column-in-region ?
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
929 column
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
930 View-process-header-start
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
931 View-process-output-end
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
932 overwrite
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
933 not-looking-at)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
934 (setq View-process-output-end (point-max))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
935 (setq buffer-read-only read-only)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
936
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
937 ;(defun View-process-insert-blanks-at-line-start ()
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
938 ; "Inserts some blanks at the beginning of each output line.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
939 ;This space is used for the marks."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
940 ; (save-excursion
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
941 ; (goto-char View-process-header-start)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
942 ; (insert "m ")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
943 ; (forward-line)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
944 ; (while (< (point) View-process-output-end)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
945 ; (insert "_ ")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
946 ; (forward-line))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
947
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
948 (defun View-process-insert-blanks-at-line-start ()
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
949 "Inserts some blanks at the beginning of each output line.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
950 This space is used for the marks."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
951 (save-excursion
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
952 (goto-char View-process-output-end)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
953 (forward-line -1)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
954 (while (> (point) View-process-header-start)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
955 (insert "_ ")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
956 (forward-line -1))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
957 (insert "m ")))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
958
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
959 (defun View-process-return-position (field-name position-descriptor)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
960 "Returns a position deppending on the FIELD-NAME and the POSITION-DESCRIPTOR.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
961 The POSITION-DESCRIPTOR must be one of the 4 values: `in-front',
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
962 `in-front-successor', `behind' and `behind-predecessor'.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
963 If the FIELD-NAME isn't in the header-line, then it return nil."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
964 (save-excursion
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
965 (goto-char View-process-header-start)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
966 (beginning-of-line)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
967 (if (search-forward field-name (View-process-return-end-of-line) t)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
968 (cond ((eq position-descriptor 'behind-predecessor)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
969 (goto-char (match-beginning 0))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
970 (skip-chars-backward " ")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
971 (current-column))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
972 ((eq position-descriptor 'behind)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
973 (current-column))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
974 ((eq position-descriptor 'in-front)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
975 (goto-char (match-beginning 0))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
976 (current-column))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
977 ((eq position-descriptor 'in-front-successor)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
978 (skip-chars-forward " ")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
979 (current-column))))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
980
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
981 (defun View-process-split-merged-fields (insert-blank-alist)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
982 "Tries to split merged fields.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
983 At the moment this is done by inserting a blank between fields,
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
984 which are often merged together. The fields are determined by the
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
985 alist INSERT-BLANK-ALIST."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
986 (cond (insert-blank-alist
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
987 (let ((position (View-process-return-position
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
988 (car (car insert-blank-alist))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
989 (car (cdr (car insert-blank-alist))))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
990 (if position
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
991 (View-process-insert-blank-in-column
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
992 (+ position
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
993 (car (cdr (cdr (car insert-blank-alist)))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
994 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
995 "[^ ][^ ]? ")))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
996 (View-process-split-merged-fields (cdr insert-blank-alist)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
997 (t)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
998
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
999 (defun View-process-replace-colons-with-blanks ()
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1000 "Replaces colons with blanks, if a colon is also in the header line.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1001 This fixes the output of the IRIX ps on SGI's."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1002 (save-excursion
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1003 (goto-char View-process-header-start)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1004 (while (search-forward ":" (View-process-return-end-of-line) t)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1005 (View-process-insert-blank-in-column (current-column)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1006 t))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1007
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1008 (defun View-process-mode ()
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1009 "Mode for displaying and killing processes.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1010 The mode has the following keybindings:
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1011 \\{View-process-mode-map}.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1012
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1013 The first column of each outputline will be used to display marked lines.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1014 The following mark signs are possible (one can change them by changing
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1015 the variables in the second column of the following table):
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1016
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1017 Sign Variable Description
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1018 _ View-process-no-mark Process isn't marked
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1019 * View-process-single-line-mark The normal mark.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1020 C View-process-child-line-mark Marked as a child of P (see also P)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1021 K View-process-signal-line-mark Used during signaling
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1022 N View-process-renice-line-mark Used during renicing
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1023 P View-process-parent-line-mark Marked as the parent of P (see also C)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1024 s View-process-signaled-line-mark Process was signaled or reniced.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1025
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1026 The signal and renice commands are working also on marked processes!"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1027 ; (kill-all-local-variables)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1028 (make-local-variable 'revert-buffer-function)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1029 (setq revert-buffer-function 'View-process-revert-buffer)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1030 (View-process-change-display-type View-process-display-with-2-windows)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1031 (use-local-map View-process-mode-map)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1032 (set-syntax-table View-process-mode-syntax-table)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1033 (setq major-mode 'View-process-mode
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1034 mode-name View-process-mode-name)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1035 ; (View-process-replaces-blanks-in-fields)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1036 (setq View-process-deleted-lines nil)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1037 (View-process-call-sorter-and-filter View-process-actual-sorter-and-filter)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1038 (setq truncate-lines View-process-truncate-lines)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1039 (View-process-install-pulldown-menu)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1040 ; (View-process-install-mode-motion)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1041 (View-process-hide-header (and View-process-display-with-2-windows
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1042 View-process-hide-header))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1043 (View-process-install-font-lock)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1044 (View-process-install-mode-motion)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1045 (run-hooks 'View-process-mode-hook)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1046 )
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1047
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1048 (defun View-process-build-field-name-list ()
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1049 "Returns an alist with the field names and the field number.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1050 The list looks like ((\"USER\" 1) (\"PID\" 2) (\"COMMAND\" 3))."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1051 (goto-char View-process-header-start)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1052 (forward-word 1)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1053 (setq View-process-field-names '())
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1054 (let ((i 1))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1055 (while (<= (point) View-process-header-end)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1056 (setq View-process-field-names (cons (list (current-word) i)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1057 View-process-field-names))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1058 (setq i (1+ i))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1059 (forward-word 1))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1060
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1061 (defun View-process-field-name-exists-p (field-name)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1062 "Returns non nil, if the field FIELD_NAME exists."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1063 (assoc field-name View-process-field-names))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1064
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1065 (defun View-process-translate-field-name-to-position (field-name)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1066 "Returns the position of the field with the name FIELD-NAME."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1067 (car (cdr (assoc field-name View-process-field-names)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1068 )
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1069
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1070 (defun View-process-translate-field-position-to-name (position)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1071 "Returns the field name of the field with the position POSITION."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1072 (if (> position View-process-max-fields)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1073 (car (View-process-assoc-2th View-process-max-fields
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1074 View-process-field-names))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1075 (car (View-process-assoc-2th position View-process-field-names))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1076 ))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1077
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1078 (defun View-process-get-system-type-from-host-list (host-name)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1079 "Returns nil, or the system type of the host with the name HOST-NAME."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1080 (car (cdr (assoc host-name View-process-host-names-and-system-types))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1081
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1082 (defun View-process-put-system-type-in-host-list (host-name system-type)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1083 "Puts the HOST-NAME and the SYSTEM-TYPE in a special host list.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1084 The list has the name `View-process-host-names-and-system-types'."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1085 (if (not (member (list host-name system-type)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1086 View-process-host-names-and-system-types))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1087 (setq View-process-host-names-and-system-types
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1088 (cons (list host-name system-type)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1089 View-process-host-names-and-system-types))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1090
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1091 (defun View-process-bsd-or-system-v (&optional remote-host)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1092 "This function determines, if the system is a BSD or a System V.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1093 For that it uses the ps command.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1094 If REMOTE-HOST is non nil, then the system of the REMOTE-HOST will
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1095 be tested."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1096 (if remote-host
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1097 (if (eq 0 (call-process View-process-rsh-command
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1098 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1099 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1100 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1101 remote-host
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1102 (concat View-process-status-command
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1103 " "
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1104 "-dfj")))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1105 "system-v"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1106 "bsd")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1107 (if (eq 0 (call-process View-process-status-command
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1108 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1109 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1110 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1111 "-dfj"))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1112 "system-v"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1113 "bsd")))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1114
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1115 (defun View-process-program-exists-p (program &optional remote-host)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1116 "Returns t, if the PROGRAM exists.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1117 If REMOTE_HOST is non nil, then the program will be searched remote
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1118 on that host."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1119 (if remote-host
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1120 (or (= 0 (call-process View-process-rsh-command
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1121 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1122 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1123 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1124 remote-host
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1125 (concat View-process-test-command
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1126 " "
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1127 View-process-test-switches
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1128 " "
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1129 program)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1130 (= 0 (call-process View-process-rsh-command
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1131 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1132 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1133 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1134 remote-host
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1135 (concat View-process-test-command
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1136 " "
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1137 View-process-test-switches
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1138 " "
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1139 "/bin/"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1140 program)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1141 (= 0 (call-process View-process-rsh-command
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1142 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1143 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1144 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1145 remote-host
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1146 (concat View-process-test-command
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1147 " "
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1148 View-process-test-switches
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1149 " "
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1150 "/usr/bin/"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1151 program))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1152 (or (= 0 (call-process View-process-test-command
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1153 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1154 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1155 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1156 View-process-test-switches
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1157 program))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1158 (= 0 (call-process View-process-test-command
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1159 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1160 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1161 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1162 View-process-test-switches
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1163 (concat "/bin/" program)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1164 (= 0 (call-process View-process-test-command
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1165 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1166 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1167 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1168 View-process-test-switches
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1169 (concat "/usr/bin/" program))))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1170
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1171 (defun View-process-search-system-type-in-system-list-1 (system-type
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1172 system-list)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1173 "Internal function of `View-process-search-system-type-in-system-list'."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1174 (cond ((not system-list) nil)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1175 ((equal system-type (car (car system-list)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1176 (cons (car system-list)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1177 (View-process-search-system-type-in-system-list-1
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1178 system-type
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1179 (cdr system-list))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1180 (t (View-process-search-system-type-in-system-list-1 system-type
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1181 (cdr system-list))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1182 )))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1183
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1184 (defun View-process-search-system-type-in-system-list (system-type system-list)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1185 "Searches the SYSTEM-TYPE in SYSTEM-LIST.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1186 It returns the entry or nil, if the SYSTEM-TYPE isn't in the list.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1187 If more then one entry with the same SYSTEM-TYPE are found, then the
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1188 version number is also checked. If the version number isn't in the
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1189 list, then nil is returned."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1190 (let ((system-type-entries (View-process-search-system-type-in-system-list-1
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1191 (car system-type)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1192 system-list)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1193 (if system-type-entries
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1194 (if (= 1 (length system-type-entries))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1195 (car system-type-entries)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1196 (View-process-assoc-2th (car (cdr system-type)) system-type-entries))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1197 nil)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1198
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1199
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1200 (defun View-process-generalize-system-type (system-type &optional remote-host)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1201 "Generalize the SYSTEM-TYPE.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1202 Determines, if the system is in the `View-process-specific-system-list'
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1203 and if it is a BSD or a System V system. It returns a list which looks
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1204 like the following: (<system-type> <version-no> <bsd-or-system-v>).
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1205 The elements <system-type> and <version-no> are set to nil, if the
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1206 <system-type> isn't in the `View-process-specific-system-list'. In that
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1207 case the third element (<bsd-or-system-v>) is determined with the help
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1208 of the ps output. if REMOTE-HOST is non nil, the the ps command to check
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1209 the system type is run on the remote host REMOTE-HOST."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1210 (let ((new-system-type (View-process-search-system-type-in-system-list
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1211 system-type
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1212 View-process-specific-system-list)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1213 (if new-system-type
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1214 new-system-type
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1215 (list nil nil (View-process-bsd-or-system-v)))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1216
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1217 (defun View-process-get-local-system-type ()
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1218 "Returns the system type of the local host."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1219 (let ((system-type (View-process-get-system-type-from-host-list
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1220 (system-name))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1221 (if (not system-type) ; t, if the host isn't in the list
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1222 (progn
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1223 (if (View-process-program-exists-p View-process-uname-command)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1224 (save-excursion
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1225 (let ((buffer (generate-new-buffer "*system-type*")))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1226 (call-process View-process-uname-command
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1227 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1228 buffer
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1229 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1230 View-process-uname-switches)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1231 (set-buffer buffer)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1232 (forward-line -1)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1233 (setq system-type (downcase (current-word)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1234 (forward-word 2)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1235 (setq system-type
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1236 (list system-type (downcase (current-word))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1237 (kill-buffer buffer)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1238 ;; determine, if the system is in the
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1239 ;; View-process-specific-system-list and if it is
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1240 ;; a BSD or a System V system;
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1241 ;; The system type will be set to nil,
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1242 ;; if it isn't in the list
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1243 (setq system-type (View-process-generalize-system-type
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1244 system-type))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1245 ))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1246 (setq system-type (list nil nil (View-process-bsd-or-system-v))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1247 (View-process-put-system-type-in-host-list (system-name)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1248 system-type)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1249 system-type)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1250 system-type)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1251
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1252 (defun View-process-get-remote-system-type ()
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1253 "Returns the system type of the remote host `View-process-remote-host'."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1254 (let ((system-type (View-process-get-system-type-from-host-list
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1255 View-process-remote-host)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1256 (if system-type ; nil, if the host isn't in the list
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1257 system-type
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1258 (if (View-process-program-exists-p View-process-uname-command
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1259 View-process-remote-host)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1260 (let ((buffer (generate-new-buffer "*system-type*")))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1261 (save-excursion
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1262 (call-process View-process-rsh-command
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1263 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1264 buffer
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1265 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1266 View-process-remote-host
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1267 (concat View-process-uname-command
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1268 " "
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1269 View-process-uname-switches))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1270 (set-buffer buffer)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1271 (forward-line -1)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1272 (setq system-type (downcase (current-word)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1273 (forward-word 2)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1274 (setq system-type
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1275 (list system-type (downcase (current-word))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1276 (kill-buffer buffer)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1277 ;; determine, if the system is in the
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1278 ;; View-process-specific-system-list and if it is
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1279 ;; a BSD or a System V system;
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1280 ;; The system type will be set to nil,
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1281 ;; if it isn't in the list
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1282 (setq system-type (View-process-generalize-system-type
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1283 system-type
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1284 View-process-remote-host))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1285 ))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1286 (setq system-type (list nil nil (View-process-bsd-or-system-v
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1287 View-process-remote-host))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1288 (View-process-put-system-type-in-host-list View-process-remote-host
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1289 system-type)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1290 system-type)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1291
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1292 (defun View-process-get-system-type ()
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1293 "Returns the type of the system on which ps was executed."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1294 (if View-process-remote-host
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1295 (View-process-get-remote-system-type)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1296 (View-process-get-local-system-type)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1297 ))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1298
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1299 (defun View-process-get-kill-signal-list (system-type)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1300 "Returns a kill signal list for the SYSTEM-TYPE."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1301 (if (= 3 (length system-type))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1302 (if (string= "bsd" (nth 2 system-type))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1303 (if View-process-kill-signals-bsd
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1304 View-process-kill-signals-bsd
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1305 View-process-kill-signals-general)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1306 (if View-process-kill-signals-system-v
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1307 View-process-kill-signals-system-v
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1308 View-process-kill-signals-general))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1309 (if (eval (nth 4 system-type))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1310 (eval (nth 4 system-type))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1311 (if (string= "bsd" (nth 2 system-type))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1312 (if View-process-kill-signals-bsd
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1313 View-process-kill-signals-bsd
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1314 View-process-kill-signals-general)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1315 (if View-process-kill-signals-system-v
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1316 View-process-kill-signals-system-v
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1317 View-process-kill-signals-general)))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1318
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1319 (defun View-process-get-field-name-description-list (system-type)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1320 "Returns a field name description list for the SYSTEM-TYPE.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1321 It returns nil, if no system specific list exists."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1322 (if (= 3 (length system-type))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1323 (if (string= "bsd" (nth 2 system-type))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1324 (if View-process-field-name-descriptions-bsd
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1325 View-process-field-name-descriptions-bsd)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1326 (if View-process-field-name-descriptions-system-v
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1327 View-process-field-name-descriptions-system-v))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1328 (if (eval (nth 3 system-type))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1329 (eval (nth 3 system-type))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1330 (if (string= "bsd" (nth 2 system-type))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1331 (if View-process-field-name-descriptions-bsd
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1332 View-process-field-name-descriptions-bsd)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1333 (if View-process-field-name-descriptions-system-v
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1334 View-process-field-name-descriptions-system-v)))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1335
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1336 (defun View-process-init-internal-variables (use-last-sorter-and-filer)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1337 "Init internal variables.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1338 (without `View-process-header-start').
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1339 If USE-LAST-SORTER-AND-FILER is t, then
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1340 'View-process-actual-sorter-and-filter' will not be changed"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1341 ;; don't replace blanks now
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1342 (setq View-process-field-blanks-already-replaced t)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1343
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1344 (goto-char View-process-header-start)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1345 (end-of-line)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1346 (setq View-process-header-end (point))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1347 ;; (newline)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1348 (forward-line)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1349 (setq View-process-output-start (point))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1350 (setq View-process-output-end (point-max))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1351 (goto-char View-process-header-end)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1352 (forward-word -1)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1353 (setq View-process-max-fields (View-process-current-field-number))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1354 (View-process-build-field-name-list)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1355 (setq View-process-system-type (View-process-get-system-type))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1356 (setq View-process-kill-signals (View-process-get-kill-signal-list
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1357 View-process-system-type))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1358 (setq View-process-field-name-descriptions
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1359 (View-process-get-field-name-description-list View-process-system-type)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1360 )
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1361 ;; Replace the blanks the next time if it is necessary
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1362 (setq View-process-field-blanks-already-replaced nil)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1363 (if (not use-last-sorter-and-filer)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1364 (setq View-process-actual-sorter-and-filter
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1365 View-process-sorter-and-filter))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1366
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1367 (if View-process-pid-mark-alist
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1368 (progn
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1369 (setq View-process-last-pid-mark-alist View-process-pid-mark-alist)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1370 (setq View-process-pid-mark-alist nil)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1371 )
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1372
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1373 (defun View-process-insert-short-key-descriptions ()
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1374 "Insert short key descriptions at the current point.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1375 If `View-process-display-short-key-descriptions' is nil, then
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1376 nothing will be inserted."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1377 (if View-process-display-short-key-descriptions
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1378 (let ((local-map (current-local-map)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1379 (use-local-map View-process-mode-map)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1380 (insert
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1381 (substitute-command-keys
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1382 (concat
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1383 " \\[view-processes]: new output "
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1384 "\\[View-process-status]: new output with new options "
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1385 " \\[revert-buffer]: update output \n"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1386 " \\[View-process-filter-by-current-field-g]: field filter "
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1387 "\\[View-process-filter-g]: line filter "
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1388 "\\[View-process-sort-by-current-field-g]: sort "
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1389 "\\[View-process-reverse-g]: reverse "
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1390 "\\[View-process-send-signal-to-processes-g]: send signal "
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1391 "\\[View-process-quit]: quit\n")))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1392 (use-local-map local-map))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1393
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1394 (defun View-process-insert-uptime (&optional remote-host)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1395 "Inserts uptime information at the current point.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1396 if `View-process-display-uptime' is nil, then nothing will be inserted.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1397 If REMOTE-HOST is non nil, then its the name of the remote host."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1398 (if View-process-display-uptime
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1399 (progn
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1400 ; (newline)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1401 (if remote-host
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1402 (call-process View-process-rsh-command
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1403 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1404 t
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1405 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1406 remote-host
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1407 View-process-uptime-command)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1408 (call-process View-process-uptime-command
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1409 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1410 t
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1411 nil)))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1412
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1413 (defun View-process-insert-title-lines (command-switches
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1414 remote-host
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1415 use-last-sorter-and-filter)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1416 "Insert the title lines in the output lines.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1417 REMOTE-HOST is nil or the name of the host on which the
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1418 ps command was executed. USE-LAST-SORTER-AND-FILTER determines, if
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1419 the last sorter and filter (from `View-process-actual-sorter-and-filter')
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1420 are used."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1421 (insert (or remote-host (system-name) "")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1422 ;;(getenv "HOST") (getenv "HOSTNAME") "")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1423 ", "
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1424 (current-time-string)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1425 ", "
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1426 View-process-status-command
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1427 " "
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1428 command-switches
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1429 "\n")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1430 (View-process-insert-uptime remote-host)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1431 (View-process-insert-short-key-descriptions)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1432 (if (or (and use-last-sorter-and-filter
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1433 View-process-actual-sorter-and-filter)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1434 View-process-sorter-and-filter)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1435 (insert
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1436 "This output is filtered! Look at `View-process-sorter-and-filter'.\n"))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1437 (newline 1)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1438 (setq View-process-ps-header-window-size
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1439 (+ View-process-ps-header-window-offset
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1440 (count-lines (point-min) (point))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1441 (if (and (View-process-xemacs-p)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1442 (not (View-process-lemacs-p))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1443 View-process-header-mode-line-off)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1444 -1
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1445 0))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1446
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1447 (defun View-process-search-header-line-1 (header-dectection-list
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1448 no-error-message)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1449 "Internal funtion of `View-process-search-header-line'."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1450 (cond (header-dectection-list
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1451 (goto-char View-process-header-start)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1452 (if (search-forward (car header-dectection-list) nil t)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1453 (setq View-process-header-start
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1454 (View-process-return-beginning-of-line))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1455 (View-process-search-header-line-1 (cdr header-dectection-list)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1456 no-error-message)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1457 (t (setq mode-motion-hook nil) ; otherwise emacs hangs
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1458 (if no-error-message
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1459 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1460 (error (concat "ERROR: No header line detected! "
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1461 "Look at View-process-header-line-detection-list!")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1462 )))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1463
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1464
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1465 (defun View-process-search-header-line (&optional no-error-message)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1466 "Function searches the headerline and sets `View-process-header-start'.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1467 The header line must have at least one of the words of the list
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1468 `View-process-header-line-detection-list'.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1469 If NO-ERROR-MESSAGE is t and no header-line is found, then only
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1470 nil (without an error message) will be returned."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1471 (save-excursion
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1472 (View-process-search-header-line-1 View-process-header-line-detection-list
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1473 no-error-message)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1474 ))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1475
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1476 (defun View-process-save-position ()
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1477 "Saves the current line and column in a cons cell and returns it."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1478 (save-restriction
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1479 (widen)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1480 (if (< View-process-header-start (point-max))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1481 (cons (- (count-lines (or View-process-header-start (point-min))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1482 (point))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1483 (if (= 0 (current-column))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1484 0
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1485 1))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1486 (current-column))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1487 nil)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1488
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1489 (defun View-process-goto-position (position)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1490 "Sets the point to the POSITION.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1491 POSITION is a cons cell with a linenumber and a column."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1492 (if position
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1493 (save-restriction
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1494 (widen)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1495 (goto-char View-process-header-start)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1496 (forward-line (car position))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1497 (move-to-column (cdr position) t)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1498 ; (setq temporary-goal-column (cdr position)) ; doesn't work :-(
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1499 )))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1500
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1501 (defun View-process-status (command-switches
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1502 &optional remote-host
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1503 use-last-sorter-and-filter)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1504 "Prints a list with processes in the buffer `View-process-buffer-name'.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1505 COMMAND-SWITCHES is a string with the command switches (ie: -aux).
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1506 IF the optional argument REMOTE-HOST is given, then the command will
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1507 be executed on the REMOTE-HOST. If an prefix arg is given, then the
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1508 function asks for the name of the remote host.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1509 If USE-LAST-SORTER-AND-FILTER is t, then the last sorter and filter
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1510 commands are used. Otherwise the sorter and filter from the list
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1511 'View-process-sorter-and-filter' are used."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1512 (interactive
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1513 (let ((View-process-stop-motion-help t))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1514 (list
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1515 (read-string "Command switches: "
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1516 (or View-process-status-last-command-switches
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1517 (if (bufferp (get-buffer View-process-buffer-name))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1518 (cdr
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1519 (assoc
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1520 'View-process-status-last-command-switches
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1521 (buffer-local-variables
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1522 (get-buffer View-process-buffer-name)))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1523 (if (string= "bsd" (View-process-bsd-or-system-v))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1524 View-process-status-command-switches-bsd
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1525 View-process-status-command-switches-system-v))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1526 'View-process-status-history)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1527 (if current-prefix-arg
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1528 (setq View-process-remote-host
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1529 (read-string "Remote host name: "
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1530 View-process-remote-host
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1531 'View-process-remote-host-history))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1532 (setq View-process-remote-host nil)))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1533 (View-process-save-old-window-configuration)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1534 (let ((buffer (get-buffer-create View-process-buffer-name))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1535 (position nil))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1536 ; (point-after-ps nil))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1537 (if (window-minibuffer-p (selected-window))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1538 (set-buffer buffer)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1539 (switch-to-buffer buffer))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1540
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1541 ;; set switches for the next view process command
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1542 (setq View-process-status-last-command-switches command-switches)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1543 (if (string= "bsd" (View-process-bsd-or-system-v))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1544 (setq View-process-status-command-switches-bsd command-switches)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1545 (setq View-process-status-command-switches-system-v command-switches))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1546
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1547 (setq buffer-read-only nil)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1548 (if (not (= (point-min) (point-max)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1549 (progn
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1550 (setq position (View-process-save-position))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1551 ; (setq point-after-ps (point-min))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1552 ; (setq point-after-ps (point))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1553 (erase-buffer)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1554 (View-process-insert-title-lines command-switches
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1555 remote-host
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1556 use-last-sorter-and-filter)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1557 (setq View-process-header-start (point))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1558 (if remote-host
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1559 (call-process View-process-rsh-command
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1560 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1561 t
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1562 t
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1563 remote-host
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1564 (concat View-process-status-command
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1565 " "
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1566 command-switches))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1567 (call-process View-process-status-command
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1568 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1569 t
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1570 t
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1571 command-switches))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1572 (View-process-search-header-line)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1573 (setq View-process-output-end (point-max))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1574 (View-process-replace-colons-with-blanks)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1575 (View-process-insert-blanks-at-line-start)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1576 (View-process-split-merged-fields View-process-insert-blank-alist)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1577 (View-process-init-internal-variables use-last-sorter-and-filter)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1578 (View-process-highlight-header-line)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1579 (goto-char View-process-output-start)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1580 (View-process-goto-position position)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1581 ; (goto-char (cond ((> point-after-ps (point-max)) (point-max))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1582 ; ((= point-after-ps (point-min)) View-process-output-start)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1583 ; ((< point-after-ps View-process-output-start)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1584 ; View-process-output-start)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1585 ; (t point-after-ps)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1586 (setq buffer-read-only t)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1587 (let ((View-process-stop-motion-help t))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1588 ; (setq View-process-stop-motion-help t)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1589 (View-process-mode)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1590 ; (setq View-process-stop-motion-help nil)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1591 ; (View-process-redraw) ; only the first time (fixes an Emacs 19 bug)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1592 )
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1593 ))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1594
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1595 (defun View-process-status-update ()
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1596 "Runs the `View-process-status' with the last switches
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1597 and sorter and filter commands."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1598 (interactive)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1599 (if View-process-status-last-command-switches
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1600 (View-process-status View-process-status-last-command-switches
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1601 View-process-remote-host
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1602 t)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1603 (error "ERROR: No view process buffer exists for update!")))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1604
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1605 (defun view-processes (&optional remote-host)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1606 "Prints a list with processes in the buffer `View-process-buffer-name'.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1607 It calls the function `View-process-status' with default switches.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1608 As the default switches on BSD like systems the value of the variable
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1609 `View-process-status-command-switches-bsd' is used.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1610 On System V like systems the value of the variable
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1611 `View-process-status-command-switches-system-v' is used.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1612 IF the optional argument REMOTE-HOST is given, then the command will
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1613 be executed on the REMOTE-HOST. If an prefix arg is given, then the
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1614 function asks for the name of the remote host."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1615 (interactive
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1616 (let ((View-process-stop-motion-help t))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1617 (list (if current-prefix-arg
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1618 (setq View-process-remote-host
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1619 (read-string "Remote host name: "
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1620 View-process-remote-host
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1621 'View-process-remote-host-history))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1622 (setq View-process-remote-host nil)))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1623 (if (string= "bsd" (nth 2 (View-process-get-system-type)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1624 (View-process-status View-process-status-command-switches-bsd
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1625 View-process-remote-host)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1626 (View-process-status View-process-status-command-switches-system-v
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1627 remote-host)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1628
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1629 ;;; itimer functions (to repeat the ps output)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1630
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1631 (defun View-process-status-itimer-function ()
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1632 "Itimer function for updating the ps output."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1633 (save-excursion
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1634 (save-window-excursion
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1635 (View-process-status-update)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1636 ;;(View-process-start-itimer)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1637 )
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1638
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1639
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1640 ;;; help functions
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1641
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1642 (defun View-process-show-pid-and-command-or-field-name ()
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1643 "Displays the pid and the command of the current line or the field name.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1644 If the point is at a blank, then the pid and the command of the current
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1645 line are displayed. Otherwise the name of the field and its description
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1646 are displayed."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1647 (interactive)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1648 (if (looking-at " ")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1649 (View-process-show-pid-and-command)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1650 (View-process-which-field-name)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1651
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1652 (defun View-process-show-pid-and-command ()
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1653 "Displays the pid and the command of the current line.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1654 It assumes, that the command is displayed at the end of the line."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1655 (interactive)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1656 (if (>= (point) View-process-output-start)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1657 (message "PID= %s, %s"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1658 (View-process-get-pid-from-current-line)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1659 (View-process-get-field-value-from-current-line
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1660 View-process-max-fields
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1661 View-process-max-fields))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1662
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1663 (defun View-process-show-field-names ()
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1664 "Displays the name(s) of the ps output field(s).
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1665 If the point is at a blank, then the header line with all field names
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1666 is displayed. Otherwise only the name of the field at the point is
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1667 displayed."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1668 (interactive)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1669 (if (looking-at " ")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1670 (View-process-show-header-line)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1671 (View-process-which-field-name)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1672
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1673 (defun View-process-show-header-line ()
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1674 "Displays the header line in the buffer at the current line."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1675 (interactive)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1676 (save-window-excursion
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1677 (let ((header-line (save-restriction
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1678 (widen)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1679 (concat
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1680 (buffer-substring View-process-header-start
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1681 View-process-header-end)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1682 "\n"))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1683 (momentary-string-display header-line
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1684 (View-process-return-beginning-of-line)))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1685
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1686 (defun View-process-which-field-name ()
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1687 "Displays the name of the field under the point in the echo area."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1688 (interactive)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1689 (if (>= (point) View-process-header-start)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1690 (let ((field-name (View-process-translate-field-position-to-name
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1691 (View-process-current-field-number))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1692 (message
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1693 (View-process-replace-in-string
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1694 "%"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1695 "%%"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1696 (concat field-name
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1697 ": "
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1698 (View-process-get-field-name-description field-name)))))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1699
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1700 (defun View-process-get-field-name-description (field-name)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1701 "Returns a string with a desciption of the ps output field FIELD-NAME."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1702 (let ((description
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1703 (or (car (cdr (assoc field-name
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1704 View-process-field-name-descriptions)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1705 (car (cdr (assoc field-name
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1706 View-process-field-name-descriptions-general))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1707 ))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1708 (if (stringp description)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1709 description
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1710 (concat (car description)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1711 (View-process-get-value-description
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1712 (View-process-get-field-value-from-current-line
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1713 (View-process-translate-field-name-to-position field-name)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1714 View-process-max-fields)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1715 (cdr description))))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1716
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1717 (defun View-process-get-value-description (values value-descriptions)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1718 "Returns a string with the description of the VALUES.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1719 VALUE-DESCRIPTIONS is an alist with the possible values and its
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1720 descriptions."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1721 (cond ((string= values "") "")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1722 ((or (eq (aref values 0) ?_) (eq (aref values 0) ? ))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1723 (View-process-get-value-description (substring values 1)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1724 value-descriptions))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1725 (t (concat
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1726 (car
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1727 (cdr
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1728 (assoc
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1729 (substring values 0 (string-match "[ _]" values))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1730 value-descriptions)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1731 (if (string-match "[ _]" values)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1732 (View-process-get-value-description
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1733 (substring values (string-match "[ _]" values))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1734 value-descriptions)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1735 "")))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1736
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1737
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1738 ;;; sort functions
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1739
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1740 (defun View-process-current-field-number ()
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1741 "Returns the field number of the point.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1742 The functions fails with an error message, if the character under
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1743 the point is a blank."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1744 (View-process-replaces-blanks-in-fields-if-necessary)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1745 (save-excursion
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1746 (if (looking-at " ")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1747 (error "Point is on a blank and not in a field!")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1748 (if (and (eq (point) (point-max))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1749 (eq (current-column) 0))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1750 (error "Point is not in a field!")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1751 (let ((field-point (point))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1752 (i 0))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1753 (beginning-of-line)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1754 (skip-chars-forward " ")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1755 (while (>= field-point (point))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1756 (setq i (1+ i))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1757 (skip-chars-forward "^ ")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1758 (skip-chars-forward " "))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1759 i)))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1760
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1761 (defun View-process-sort-fields-in-region (field
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1762 beg
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1763 end
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1764 &optional sort-function)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1765 "Sort lines in region by the ARGth field of each line.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1766 Fields are separated by whitespace and numbered from 1 up.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1767 With a negative arg, sorts by the ARGth field counted from the right.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1768 BEG and END specify region to sort.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1769 If the optional SORT-FUNCTION is nil, then the region is at first
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1770 sorted with the function `sort-fields' and then with the function
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1771 `sort-float-fields'. Otherwise a sort function like `sort-fields'
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1772 must be specified."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1773 (let ((position (View-process-save-position))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1774 ; (point (point)) ;; that's, because save-excursion
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1775 ; (column (current-column)) ;; doesn't work :-(
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1776 (field-no (if (< field View-process-max-fields)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1777 field
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1778 View-process-max-fields)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1779 (if sort-function
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1780 (eval (list sort-function field-no beg end))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1781 (sort-fields field-no beg end)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1782 (sort-float-fields field-no beg end))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1783 (View-process-goto-position position)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1784 ; (goto-char point)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1785 ; (goto-char (+ point (- column (current-column))))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1786
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1787 (defun View-process-remove-sorter (sorter alist)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1788 "Removes the SORTER entry from the ALIST."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1789 (cond ((not alist) nil)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1790 ((eq sorter (car (car alist))) (cdr alist))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1791 (t (cons (car alist)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1792 (View-process-remove-sorter sorter (cdr alist))))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1793
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1794 (defun View-process-sort-output-by-field (field-name
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1795 &optional dont-remember)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1796 "Sort the ps output by the field FIELD-NAME.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1797 If DONT-REMEMBER is t, then the filter command isn't inserted
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1798 in the `View-process-actual-sorter-and-filter' list."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1799 (interactive
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1800 (let ((View-process-stop-motion-help t))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1801 (list
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1802 (completing-read "Field Name for sorting: "
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1803 View-process-field-names
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1804 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1805 t
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1806 (car View-process-field-name-history)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1807 View-process-field-name-history))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1808 (setq buffer-read-only nil)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1809 (View-process-sort-fields-in-region
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1810 (View-process-translate-field-name-to-position field-name)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1811 View-process-output-start
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1812 View-process-output-end)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1813 (setq buffer-read-only t)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1814 (if (not dont-remember)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1815 (setq View-process-actual-sorter-and-filter
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1816 (append (View-process-remove-sorter
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1817 'reverse
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1818 (View-process-remove-sorter
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1819 'sort
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1820 View-process-actual-sorter-and-filter))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1821 (list (list 'sort field-name))))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1822
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1823 (defun View-process-sort-by-current-field-g ()
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1824 "Sort the ps output by the field under the point.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1825 It is a generic interface to `View-process-sort-region-by-current-field'
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1826 and `View-process-sort-output-by-current-field'.The first will be called
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1827 if a region is active and the other one if not.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1828 With a prefix arg, it uses the NTH field instead of the current one."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1829 (interactive)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1830 (if (View-process-region-active-p)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1831 (call-interactively 'View-process-sort-region-by-current-field)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1832 (call-interactively 'View-process-sort-output-by-current-field)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1833
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1834 (defun View-process-sort-output-by-current-field (&optional nth dont-remember)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1835 "Sort the whole ps output by the field under the point.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1836 With a prefix arg, it uses the NTH field instead of the current one.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1837 If DONT-REMEMBER is t, then the filter command isn't inserted
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1838 in the `View-process-actual-sorter-and-filter' list."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1839 (interactive "P")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1840 (let ((field-number (if nth
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1841 (if (and (>= nth 1) (<= nth View-process-max-fields))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1842 nth
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1843 (error "ERROR: Wrong field number!"))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1844 (View-process-current-field-number))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1845 (setq buffer-read-only nil)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1846 (View-process-sort-fields-in-region field-number
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1847 View-process-output-start
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1848 View-process-output-end)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1849 (setq buffer-read-only t)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1850 (if (not dont-remember)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1851 (setq View-process-actual-sorter-and-filter
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1852 (append (View-process-remove-sorter
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1853 'reverse
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1854 (View-process-remove-sorter
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1855 'sort
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1856 View-process-actual-sorter-and-filter))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1857 (list
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1858 (list 'sort
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1859 (View-process-translate-field-position-to-name
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1860 field-number))))))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1861
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1862 (defun View-process-sort-region-by-current-field (&optional nth)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1863 "Sort the region by the field under the point.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1864 With a prefix arg, it uses the NTH field instead of the current one."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1865 (interactive "P")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1866 (let ((field-number (if nth
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1867 (if (and (>= nth 1) (<= nth View-process-max-fields))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1868 nth
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1869 (error "ERROR: Wrong field number!"))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1870 (View-process-current-field-number))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1871 (setq buffer-read-only nil)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1872 (View-process-sort-fields-in-region
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1873 field-number
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1874 (save-excursion
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1875 (goto-char (region-beginning))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1876 (View-process-return-beginning-of-line))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1877 (save-excursion
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1878 (goto-char (region-end))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1879 (View-process-return-end-of-line)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1880 (setq buffer-read-only t)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1881
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1882 (defun View-process-reverse-output (&optional dont-remember)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1883 "Reverses the whole output lines.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1884 If DONT-REMEMBER is t, then the filter command isn't inserted
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1885 in the `View-process-actual-sorter-and-filter' list."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1886 (interactive)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1887 (setq buffer-read-only nil)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1888 (let ((position (View-process-save-position)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1889 ; (line (count-lines (point-min) (point)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1890 ; (column (current-column)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1891 (reverse-region View-process-output-start View-process-output-end)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1892 (View-process-goto-position position))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1893 ; (goto-line line)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1894 ; (beginning-of-line)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1895 ; (forward-char column))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1896 (setq buffer-read-only t)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1897 (if (not dont-remember)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1898 (setq View-process-actual-sorter-and-filter
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1899 (if (assq 'reverse View-process-actual-sorter-and-filter)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1900 (View-process-remove-sorter
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1901 'reverse
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1902 View-process-actual-sorter-and-filter)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1903 (append View-process-actual-sorter-and-filter
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1904 (list (list 'reverse)))))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1905
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1906 (defun View-process-reverse-region ()
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1907 "Reverses the output lines in the region."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1908 (interactive)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1909 (setq buffer-read-only nil)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1910 (let ((region-beginning (if (< (region-beginning) (region-end))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1911 (region-beginning)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1912 (region-end)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1913 (region-end (if (> (region-end) (region-beginning))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1914 (region-end)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1915 (region-beginning)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1916 (position (View-process-save-position)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1917 ; (line (count-lines (point-min) (point)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1918 ; (column (current-column)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1919 (reverse-region (if (< region-beginning View-process-output-start)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1920 View-process-output-start
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1921 (goto-char region-beginning)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1922 (View-process-return-beginning-of-line))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1923 (if (> region-end View-process-output-end)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1924 View-process-output-end
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1925 (goto-char region-end)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1926 (View-process-return-end-of-line)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1927 (View-process-goto-position position))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1928 ; (goto-line line)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1929 ; (beginning-of-line)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1930 ; (forward-char column))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1931 (setq buffer-read-only t))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1932
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1933 (defun View-process-reverse-g ()
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1934 "Reverses the output lines.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1935 It is a generic interface to `View-process-reverse-region'
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1936 and `View-process-reverse-output'. The first will be called
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1937 if a region is active and the other one if not."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1938 (interactive)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1939 (if (View-process-region-active-p)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1940 (call-interactively 'View-process-reverse-region)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1941 (call-interactively 'View-process-reverse-output)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1942
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1943 ;;; filter functions
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1944
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1945 (defun View-process-delete-region (start end)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1946 "Stores deleted lines in `View-process-deleted-lines'."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1947 (setq View-process-deleted-lines
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1948 (cons (buffer-substring start end)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1949 View-process-deleted-lines))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1950 (delete-region start end))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1951
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1952 (defun View-process-remove-all-filter-and-sorter ()
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1953 "Undeletes all filtered lines from `View-process-deleted-lines'.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1954 It removes also all filter and sorter from the list
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1955 `View-process-actual-sorter-and-filter'."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1956 (interactive)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1957 (let ((buffer-read-only))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1958 (goto-char View-process-output-end)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1959 (mapcar '(lambda (line)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1960 (insert line))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1961 View-process-deleted-lines)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1962 (setq View-process-output-end (point))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1963 (setq View-process-actual-sorter-and-filter nil)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1964 (goto-char View-process-output-start)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1965
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1966 (defun View-process-filter-fields-in-region (regexp
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1967 field-no
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1968 beg
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1969 end
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1970 &optional exclude)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1971 "Filters a region with a REGEXP in the field FIELD-NO.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1972 The region start is at BEG and the end at END. If FIELD-NO
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1973 is nil, then the whole line is used. All lines which passes
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1974 not the filter are deleted in the buffer, if EXCLUDE is nil.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1975 Otherwise only these lines are not deleted."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1976 (save-restriction
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1977 (widen)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1978 (let ((region-start (if (< beg end) beg end))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1979 (region-end (if (> beg end) beg end)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1980 (if (< region-start View-process-output-start)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1981 (setq region-start View-process-output-start))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1982 (goto-char region-end)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1983 (if field-no
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1984 (while (>= (point) region-start)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1985 (if (string-match regexp
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1986 (View-process-get-field-value-from-current-line
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1987 field-no
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1988 View-process-max-fields))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1989 (if exclude
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1990 (View-process-delete-region
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1991 (1- (View-process-return-beginning-of-line))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1992 (View-process-return-end-of-line))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1993 (forward-line -1))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1994 (if exclude
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1995 (forward-line -1)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1996 (View-process-delete-region
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1997 (1- (View-process-return-beginning-of-line))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1998 (View-process-return-end-of-line)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
1999 ))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2000 (beginning-of-line)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2001 (while (>= (point) region-start)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2002 (if (search-forward-regexp regexp
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2003 (View-process-return-end-of-line) t)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2004 (if exclude
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2005 (progn
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2006 (View-process-delete-region
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2007 (1- (View-process-return-beginning-of-line))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2008 (View-process-return-end-of-line))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2009 (beginning-of-line))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2010 (forward-line -1))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2011 (if exclude
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2012 (forward-line -1)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2013 (View-process-delete-region
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2014 (1- (View-process-return-beginning-of-line))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2015 (View-process-return-end-of-line))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2016 (beginning-of-line))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2017 )))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2018 (goto-char region-start))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2019 (setq View-process-output-end (point-max))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2020 (if (> View-process-output-start View-process-output-end)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2021 (progn
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2022 (newline)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2023 (setq View-process-output-end View-process-output-start)))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2024
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2025 (defun View-process-filter-output-by-field (field-name
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2026 regexp
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2027 &optional exclude
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2028 dont-remember)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2029 "Filter the whole output by the field FIELD-NAME with REGEXP.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2030 The matching lines are deleted, if EXCLUDE is t. The non matching
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2031 lines are deleted, if EXCLUDE is nil. If you call this function
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2032 interactive, then you can give a prefix arg to set EXCLUDE to non nil.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2033 If DONT-REMEMBER is t, then the filter command isn't inserted
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2034 in the `View-process-actual-sorter-and-filter' list."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2035 (interactive
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2036 (let ((View-process-stop-motion-help t))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2037 (list
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2038 (completing-read "Field Name for filtering: "
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2039 View-process-field-names
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2040 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2041 t
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2042 (car View-process-field-name-history)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2043 View-process-field-name-history)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2044 (read-string "Regexp for filtering the output in the field: "
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2045 (car View-process-filter-history)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2046 View-process-filter-history)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2047 current-prefix-arg
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2048 )))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2049 (setq buffer-read-only nil)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2050 (View-process-filter-fields-in-region
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2051 regexp
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2052 (View-process-translate-field-name-to-position field-name)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2053 View-process-output-start
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2054 View-process-output-end
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2055 exclude)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2056 (setq buffer-read-only t)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2057 (if (not dont-remember)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2058 (setq View-process-actual-sorter-and-filter
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2059 (append View-process-actual-sorter-and-filter
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2060 (list (list (if exclude 'exclude-filter 'filter)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2061 field-name
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2062 regexp))))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2063
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2064 (defun View-process-filter-output-by-current-field (regexp
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2065 &optional exclude
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2066 dont-remember)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2067 "Filter the whole output by the field under the point with REGEXP.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2068 The matching lines are deleted, if EXCLUDE is t. The non matching
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2069 lines are deleted, if EXCLUDE is nil. If you call this function
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2070 interactive, then you can give a prefix arg to set EXCLUDE to non nil.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2071 If DONT-REMEMBER is t, then the filter command isn't inserted
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2072 in the `View-process-actual-sorter-and-filter' list."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2073 ; (interactive "sRegexp for filtering the output in the current field: \nP")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2074 (interactive
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2075 (let* ((View-process-stop-motion-help t)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2076 (regexp (read-string
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2077 "sRegexp for filtering the output in the current field: "))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2078 (exclude current-prefix-arg))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2079 (list regexp exclude)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2080 (let ((current-field-number (View-process-current-field-number)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2081 (setq buffer-read-only nil)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2082 (View-process-filter-fields-in-region regexp
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2083 current-field-number
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2084 View-process-output-start
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2085 View-process-output-end
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2086 exclude)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2087 (setq buffer-read-only t)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2088 (if (not dont-remember)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2089 (setq View-process-actual-sorter-and-filter
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2090 (append View-process-actual-sorter-and-filter
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2091 (list
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2092 (list (if exclude 'exclude-filter 'filter)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2093 (View-process-translate-field-position-to-name
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2094 current-field-number)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2095 regexp)))))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2096
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2097 (defun View-process-filter-region-by-current-field (regexp &optional exclude)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2098 "Filter the region by the field under the point with REGEXP.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2099 The matching lines are deleted, if EXCLUDE is t. The non matching
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2100 lines are deleted, if EXCLUDE is nil. If you call this function
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2101 interactive, then you can give a prefix arg to set EXCLUDE to non nil."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2102 ; (interactive "sRegexp for filtering the region in the current field: \nP")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2103 (interactive
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2104 (let* ((View-process-stop-motion-help t)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2105 (regexp (read-string
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2106 "sRegexp for filtering the region in the current field: "))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2107 (exclude current-prefix-arg))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2108 (list regexp exclude)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2109 (setq buffer-read-only nil)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2110 (View-process-filter-fields-in-region
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2111 regexp
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2112 (View-process-current-field-number)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2113 (save-excursion
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2114 (goto-char (region-beginning))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2115 (View-process-return-beginning-of-line))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2116 (save-excursion
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2117 (goto-char (region-end))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2118 (View-process-return-end-of-line))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2119 exclude)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2120 (setq buffer-read-only t))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2121
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2122 (defun View-process-filter-by-current-field-g (&optional exclude)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2123 "Filter the whole output by the field under the point with an Regexp.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2124 It is a generic interface to `View-process-filter-region-by-current-field'
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2125 and `View-process-filter-output-by-current-field'. The first will be called
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2126 if a region is active and the other one if not.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2127 The matching lines are deleted, if EXCLUDE is t. The non matching
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2128 lines are deleted, if EXCLUDE is nil. If you call this function
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2129 interactive, then you can give a prefix arg to set EXCLUDE to non nil."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2130 (interactive "P")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2131 (setq prefix-arg current-prefix-arg)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2132 (if (View-process-region-active-p)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2133 (call-interactively 'View-process-filter-region-by-current-field)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2134 (call-interactively 'View-process-filter-output-by-current-field)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2135
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2136 (defun View-process-filter-output (regexp &optional exclude dont-remember)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2137 "Filter the whole output with REGEXP.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2138 The matching lines are deleted, if EXCLUDE is t. The non matching
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2139 lines are deleted, if EXCLUDE is nil. If you call this function
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2140 interactive, then you can give a prefix arg to set EXCLUDE to non nil.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2141 If DONT-REMEMBER is t, then the filter command isn't inserted
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2142 in the `View-process-actual-sorter-and-filter' list."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2143 ; (interactive "sRegexp for filtering the output: \nP")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2144 (interactive
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2145 (let* ((View-process-stop-motion-help t)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2146 (regexp (read-string
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2147 "sRegexp for filtering the output: "))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2148 (exclude current-prefix-arg))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2149 (list regexp exclude)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2150 (setq buffer-read-only nil)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2151 (View-process-filter-fields-in-region regexp
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2152 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2153 View-process-output-start
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2154 View-process-output-end
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2155 exclude)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2156 (setq buffer-read-only t)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2157 (if (not dont-remember)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2158 (setq View-process-actual-sorter-and-filter
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2159 (append View-process-actual-sorter-and-filter
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2160 (list (list (if exclude 'exclude-grep 'grep)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2161 regexp))))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2162
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2163 (defun View-process-filter-region (regexp &optional exclude)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2164 "Filter the region with REGEXP.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2165 The matching lines are deleted, if EXCLUDE is t. The non matching
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2166 lines are deleted, if EXCLUDE is nil. If you call this function
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2167 interactive, then you can give a prefix arg to set EXCLUDE to non nil."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2168 ; (interactive "sRegexp for filtering the region: \nP")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2169 (interactive
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2170 (let* ((View-process-stop-motion-help t)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2171 (regexp (read-string
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2172 "sRegexp for filtering the region: "))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2173 (exclude current-prefix-arg))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2174 (list regexp exclude)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2175 (setq buffer-read-only nil)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2176 (View-process-filter-fields-in-region
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2177 regexp
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2178 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2179 (save-excursion
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2180 (goto-char (region-beginning))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2181 (View-process-return-beginning-of-line))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2182 (save-excursion
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2183 (goto-char (region-end))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2184 (View-process-return-end-of-line))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2185 exclude)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2186 (setq buffer-read-only t))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2187
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2188 (defun View-process-filter-g (&optional exclude)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2189 "Filters the output by the field under the point with an Regexp.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2190 It is a generic interface to `View-process-filter-region'
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2191 and `View-process-filter-output'. The first will be called
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2192 if a region is active and the other one if not.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2193 The matching lines are deleted, if EXCLUDE is t. The non matching
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2194 lines are deleted, if EXCLUDE is nil. If you call this function
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2195 interactive, then you can give a prefix arg to set EXCLUDE to non nil."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2196 (interactive "P")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2197 (setq prefix-arg current-prefix-arg)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2198 (if (View-process-region-active-p)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2199 (call-interactively 'View-process-filter-region)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2200 (call-interactively 'View-process-filter-output)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2201
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2202
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2203 ;;; call sorter, filter or grep after running ps
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2204
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2205 (defun View-process-call-sorter-and-filter (sorter-and-filter-list)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2206 "Call sorter, filter or grep after running ps.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2207 The sorter, filter or grep commands and its parameters are called
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2208 from SORTER-AND-FILTER-LIST."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2209 (cond ((not sorter-and-filter-list) t)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2210 ((eq 'grep (car (car sorter-and-filter-list)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2211 (View-process-filter-output (car (cdr (car sorter-and-filter-list)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2212 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2213 t)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2214 (View-process-call-sorter-and-filter (cdr sorter-and-filter-list)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2215 ((eq 'exclude-grep (car (car sorter-and-filter-list)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2216 (View-process-filter-output (car (cdr (car sorter-and-filter-list)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2217 t
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2218 t)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2219 (View-process-call-sorter-and-filter (cdr sorter-and-filter-list)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2220 ((eq 'sort (car (car sorter-and-filter-list)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2221 (if (assoc (car (cdr (car sorter-and-filter-list)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2222 View-process-field-names)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2223 (View-process-sort-output-by-field
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2224 (car (cdr (car sorter-and-filter-list)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2225 t))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2226 (View-process-call-sorter-and-filter (cdr sorter-and-filter-list)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2227 ((eq 'filter (car (car sorter-and-filter-list)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2228 (if (assoc (car (cdr (car sorter-and-filter-list)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2229 View-process-field-names)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2230 (View-process-filter-output-by-field
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2231 (car (cdr (car sorter-and-filter-list)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2232 (car (cdr (cdr (car sorter-and-filter-list))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2233 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2234 t))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2235 (View-process-call-sorter-and-filter (cdr sorter-and-filter-list)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2236 ((eq 'exclude-filter (car (car sorter-and-filter-list)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2237 (if (assoc (car (cdr (car sorter-and-filter-list)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2238 View-process-field-names)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2239 (View-process-filter-output-by-field
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2240 (car (cdr (car sorter-and-filter-list)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2241 (car (cdr (cdr (car sorter-and-filter-list))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2242 t
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2243 t))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2244 (View-process-call-sorter-and-filter (cdr sorter-and-filter-list)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2245 ((eq 'reverse (car (car sorter-and-filter-list)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2246 (View-process-reverse-output t)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2247 (View-process-call-sorter-and-filter (cdr sorter-and-filter-list)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2248 (t (error "Filter/Sorter command not implemented!"))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2249
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2250
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2251 ;;; Child processes
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2252
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2253 (defun View-process-get-child-process-list-1 (pid pid-ppid-alist)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2254 "Internal function of `View-process-get-child-process-list'."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2255 (cond ((car pid-ppid-alist)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2256 (if (not (string= pid (cdr (car pid-ppid-alist))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2257 (View-process-get-child-process-list-1 pid (cdr pid-ppid-alist))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2258 (cons (car (car pid-ppid-alist))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2259 (View-process-get-child-process-list-1 pid
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2260 (cdr pid-ppid-alist))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2261 )))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2262
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2263 (defun View-process-get-child-process-list (pid pid-ppid-alist)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2264 "Returns a list with all direct childs of the processes with the PID.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2265 The list PID-PPID-ALIST is an alist with the pid's as car's
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2266 and ppid's as cdr's.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2267 Example list: (\"0\" \"10\" \"20\")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2268 With \"0\" eq PID as the parent of the direct childs \"10\" and \"20\"."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2269 (cons pid (View-process-get-child-process-list-1 pid pid-ppid-alist)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2270
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2271 (defun View-process-get-child-process-tree (pid)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2272 "Returns a list with all childs and subchilds of the processes with the PID.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2273 Example list: (\"0\" (\"10\") (\"20\" (\"30\" \"40\")))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2274 With \"0\" eq PID as the parent of the direct childs \"10\" and \"20\"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2275 and with \"20\" as the parent of the direct childs \"30\" and \"40\"."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2276 (cons pid
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2277 (mapcar 'View-process-get-child-process-tree
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2278 (cdr (View-process-get-child-process-list
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2279 pid
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2280 (save-excursion
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2281 (View-process-get-pid-ppid-list-from-region
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2282 View-process-output-start
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2283 View-process-output-end)))))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2284
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2285 ;(defun View-process-highlight-process-tree (process-tree)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2286 ; "Highlights all processes in the list process-tree."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2287 ; (cond ((not process-tree))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2288 ; ((listp (car process-tree))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2289 ; (View-process-highlight-process-tree (car process-tree))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2290 ; (View-process-highlight-process-tree (cdr process-tree)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2291 ; ((stringp (car process-tree))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2292 ; (View-process-highlight-line-with-pid (car process-tree)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2293 ; 'View-process-child-line-face
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2294 ; View-process-child-line-mark)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2295 ; (View-process-highlight-process-tree (cdr process-tree)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2296 ; (t (error "Bug in 'View-process-highlight-process-tree' !"))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2297
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2298 ;(defun View-process-highlight-recursive-all-childs (pid)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2299 ; "Highlights all childs of the process with the PID."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2300 ; (interactive "sParent PID: ")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2301 ; (if (not
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2302 ; (View-process-field-name-exists-p View-process-ppid-field-name))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2303 ; (error "ERROR: No field `%s' in the output. Try `M-x ps -j' to get it."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2304 ; View-process-ppid-field-name)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2305 ; (View-process-highlight-line-with-pid pid
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2306 ; 'View-process-parent-line-face
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2307 ; View-process-parent-line-mark)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2308 ; (View-process-highlight-process-tree
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2309 ; (cdr (View-process-get-child-process-tree pid)))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2310
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2311 ;(defun View-process-highlight-recursive-all-childs-in-line ()
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2312 ; "Highlights all the child processes of the process in the current line."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2313 ; (interactive)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2314 ; (View-process-highlight-recursive-all-childs
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2315 ; (View-process-get-pid-from-current-line)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2316
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2317 ;;; kill processes
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2318
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2319 (defun View-process-send-signal-to-processes-with-mark (signal)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2320 "Sends a SIGNAL to all processes, which are marked."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2321 (interactive
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2322 (let* ((View-process-stop-motion-help t)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2323 (signal (completing-read "Signal: "
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2324 View-process-kill-signals
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2325 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2326 t
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2327 View-process-default-kill-signal
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2328 View-process-signal-history)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2329 (list signal)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2330 (if View-process-pid-mark-alist
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2331 (View-process-call-function-on-pid-and-mark-list
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2332 'View-process-send-signal-to-process-in-line
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2333 View-process-pid-mark-alist
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2334 t
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2335 signal)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2336 (error "ERROR: There is no marked process!.")))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2337
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2338 (defun View-process-send-signal-to-processes-in-region (signal)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2339 "Sends a SIGNAL to all processes in the current region."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2340 (interactive
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2341 (let* ((View-process-stop-motion-help t)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2342 (signal (completing-read "Signal: "
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2343 View-process-kill-signals
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2344 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2345 t
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2346 View-process-default-kill-signal
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2347 View-process-signal-history)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2348 (list signal)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2349 (let ((region-start (if (> (region-beginning) View-process-output-start)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2350 (region-beginning)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2351 View-process-output-start))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2352 (region-end (if (< (region-end) View-process-output-end)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2353 (region-end)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2354 View-process-output-end)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2355 (save-excursion
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2356 (goto-char region-start)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2357 (beginning-of-line)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2358 (let ((pid-list (View-process-get-pid-list-from-region (point)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2359 region-end)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2360 (View-process-send-signal-to-processes-in-pid-list signal
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2361 pid-list
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2362 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2363 t)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2364 ))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2365
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2366 (defun View-process-send-signal-to-processes-in-pid-list (signal
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2367 pid-list
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2368 &optional
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2369 dont-ask
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2370 dont-update)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2371 "Sends a SIGNAL to all processes with a pid in PID-LIST.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2372 If DONT-ASK is non nil, then no confirmation question will be asked.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2373 If DONT-UPDATE is non nil, then the command `View-process-status-update'
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2374 will not be run after sending a signal."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2375 (if (not pid-list)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2376 t
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2377 (View-process-send-signal-to-process signal
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2378 (car pid-list)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2379 dont-ask
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2380 dont-update)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2381 (View-process-send-signal-to-processes-in-pid-list signal
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2382 (cdr pid-list)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2383 dont-ask
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2384 dont-update)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2385
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2386 (defun View-process-send-signal-to-process-in-line (signal)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2387 "Sends a SIGNAL to the process in the current line."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2388 (interactive
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2389 (let* ((View-process-stop-motion-help t)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2390 (signal (completing-read "Signal: "
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2391 View-process-kill-signals
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2392 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2393 t
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2394 View-process-default-kill-signal
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2395 View-process-signal-history)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2396 (list signal)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2397 (if (and (>= (point) View-process-output-start)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2398 (< (point) View-process-output-end))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2399 (View-process-send-signal-to-process
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2400 signal
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2401 (View-process-get-pid-from-current-line)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2402 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2403 t)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2404
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2405 (defun View-process-send-key-as-signal-to-processes ()
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2406 "Converts the key which invokes this command to a signal.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2407 After that it sends this signal to the process in the current line,
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2408 or, if an active region exists, to all processes in the region.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2409 For this function only numbers could be used as keys."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2410 (interactive)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2411 (let ((signal (View-process-return-current-command-key-as-string)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2412 (if (not (= 0 (string-to-int signal)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2413 (if (View-process-region-active-p)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2414 (View-process-send-signal-to-processes-in-region signal)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2415 (View-process-send-signal-to-process-in-line signal))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2416 (error "ERROR: This command must be bind to and call by an integer!")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2417 )))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2418
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2419 (defun View-process-send-signal-to-processes-g ()
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2420 "Sends a signal to processes.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2421 It is a generic interface to `View-process-send-signal-to-processes-in-region'
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2422 and `View-process-send-signal-to-process-in-line'. The first will be called
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2423 if a region is active and the other one if not. If the region isn't
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2424 active, but marks are set, then the function is called on every
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2425 marked process."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2426 (interactive)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2427 (cond ((View-process-region-active-p)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2428 (call-interactively 'View-process-send-signal-to-processes-in-region))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2429 (View-process-pid-mark-alist
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2430 (call-interactively 'View-process-send-signal-to-processes-with-mark))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2431 (t
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2432 (call-interactively 'View-process-send-signal-to-process-in-line))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2433
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2434 (defun View-process-send-signal-to-process (signal
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2435 pid
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2436 &optional
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2437 dont-ask
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2438 dont-update)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2439 "Sends the SIGNAL to the process with the PID.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2440 If DONT-ASK is non nil, then no confirmation question will be asked.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2441 If DONT-UPDATE is non nil, then the command `View-process-status-update'
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2442 will not be run after sending the signal."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2443 (interactive
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2444 (let* ((View-process-stop-motion-help t)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2445 (signal (completing-read "Signal: "
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2446 View-process-kill-signals
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2447 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2448 t
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2449 View-process-default-kill-signal
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2450 View-process-signal-history))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2451 (pid (int-to-string (read-number "Process Id (PID): "))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2452 (list signal pid)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2453 (if (and (eq (string-to-int pid) (emacs-pid))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2454 (or (not View-process-remote-host)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2455 (string= View-process-remote-host (getenv "HOSTNAME"))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2456 (error "Hey, are you a murderer? You've just tried to kill me!")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2457 (let (
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2458 ; (signal-line-extent
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2459 ; (View-process-highlight-line-with-pid
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2460 ; pid
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2461 ; 'View-process-signal-line-face
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2462 ; View-process-signal-line-mark))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2463 (signal-number (car (cdr (assoc signal View-process-kill-signals)))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2464 (View-process-mark-line-with-pid pid View-process-signal-line-mark)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2465 (if (or dont-ask
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2466 (if (string= signal-number signal)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2467 (y-or-n-p (format
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2468 "Do you realy want to send signal %s to PID %s "
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2469 signal
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2470 pid))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2471 (y-or-n-p
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2472 (format "Do you realy want to send signal %s (%s) to PID %s "
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2473 signal
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2474 signal-number
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2475 pid))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2476 (progn
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2477 (if View-process-remote-host
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2478 (call-process View-process-rsh-command
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2479 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2480 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2481 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2482 View-process-remote-host
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2483 (concat View-process-signal-command
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2484 " -"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2485 signal-number
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2486 " "
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2487 pid))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2488 (call-process View-process-signal-command
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2489 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2490 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2491 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2492 (concat "-" signal-number)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2493 pid))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2494 (if (not dont-update)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2495 (View-process-status-update)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2496 (View-process-mark-line-with-pid pid
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2497 View-process-signaled-line-mark)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2498 ))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2499 ; (View-process-delete-extent signal-line-extent)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2500 (if (View-process-goto-line-with-pid pid)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2501 (View-process-unmark-current-line))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2502 ))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2503
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2504
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2505 ;;; renice processes
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2506
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2507 (defun View-process-read-nice-value ()
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2508 "Reads and returns a valid nice value."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2509 (let ((nice-value nil)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2510 (min-value (if (string= (user-real-login-name) "root") -20 1))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2511 (prompt "Add nice value [%d ... 20]: "))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2512 (while (not nice-value)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2513 (setq nice-value (read-string (format prompt min-value)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2514 View-process-default-nice-value))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2515 (if (and (string= (int-to-string (string-to-int nice-value))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2516 nice-value)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2517 (>= (string-to-int nice-value) min-value)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2518 (<= (string-to-int nice-value) 20)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2519 (not (= (string-to-int nice-value) 0)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2520 (if (> (string-to-int nice-value) 0)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2521 (setq nice-value
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2522 (concat "+" (int-to-string (string-to-int nice-value)))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2523 (setq nice-value nil)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2524 (setq prompt
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2525 "Wrong Format! Try again. Add nice value [%d ... 20]: ")))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2526 nice-value))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2527
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2528 (defun View-process-renice-process (nice-value
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2529 pid
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2530 &optional
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2531 dont-ask
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2532 dont-update)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2533 "Alter priority of the process with the PID.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2534 NICE-VALUE is the value, which will be added to the old nice value.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2535 If DONT-ASK is non nil, then no confirmation question will be asked.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2536 If DONT-UPDATE is non nil, then the command `View-process-status-update'
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2537 will not be run after renicing."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2538 (interactive
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2539 (let* ((View-process-stop-motion-help t)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2540 (nice-value (View-process-read-nice-value))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2541 (pid (int-to-string (read-number "Process Id (PID): "))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2542 (list nice-value pid)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2543 ; (let ((signal-line-extent
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2544 ; (View-process-highlight-line-with-pid
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2545 ; pid
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2546 ; 'View-process-signal-line-face
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2547 ; View-process-renice-line-mark)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2548 (View-process-mark-line-with-pid pid View-process-renice-line-mark)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2549 (if (or dont-ask
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2550 (y-or-n-p (format
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2551 "Do you realy want to renice PID %s with %s "
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2552 pid
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2553 nice-value)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2554 (progn
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2555 (if View-process-remote-host
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2556 (call-process View-process-rsh-command
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2557 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2558 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2559 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2560 View-process-remote-host
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2561 (concat View-process-renice-command
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2562 " "
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2563 nice-value
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2564 " "
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2565 pid))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2566 (call-process View-process-renice-command
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2567 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2568 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2569 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2570 nice-value
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2571 pid))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2572 (if (not dont-update)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2573 (View-process-status-update)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2574 (View-process-mark-line-with-pid pid View-process-signaled-line-mark)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2575 ))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2576 ; (View-process-delete-extent signal-line-extent)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2577 (if (View-process-goto-line-with-pid pid)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2578 (View-process-unmark-current-line))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2579
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2580 (defun View-process-renice-processes-with-mark (nice-value)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2581 "Alter priority of all processes, which are marked.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2582 NICE-VALUE is the value, which will be added to the old nice value."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2583 (interactive
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2584 (let* ((View-process-stop-motion-help t)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2585 (nice-value (View-process-read-nice-value)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2586 (list nice-value)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2587 (if View-process-pid-mark-alist
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2588 (View-process-call-function-on-pid-and-mark-list
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2589 'View-process-renice-process-in-line
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2590 View-process-pid-mark-alist
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2591 t
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2592 nice-value)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2593 (error "ERROR: There is no marked process!.")))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2594
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2595 (defun View-process-renice-processes-in-region (nice-value)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2596 "Alter priority of all processes in the current region.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2597 NICE-VALUE is the value, which will be added to the old nice value."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2598 (interactive
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2599 (let* ((View-process-stop-motion-help t)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2600 (nice-value (View-process-read-nice-value)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2601 (list nice-value)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2602 (let ((region-start (if (> (region-beginning) View-process-output-start)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2603 (region-beginning)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2604 View-process-output-start))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2605 (region-end (if (< (region-end) View-process-output-end)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2606 (region-end)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2607 View-process-output-end)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2608 (save-excursion
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2609 (goto-char region-start)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2610 (beginning-of-line)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2611 (let ((pid-list (View-process-get-pid-list-from-region (point)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2612 region-end)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2613 (View-process-renice-processes-in-pid-list nice-value pid-list nil t)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2614 ))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2615
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2616 (defun View-process-renice-processes-in-pid-list (nice-value
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2617 pid-list
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2618 &optional
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2619 dont-ask
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2620 dont-update)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2621 "Alter priority all processes with a pid in PID-LIST.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2622 NICE-VALUE is the value, which will be added to the old nice value.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2623 If DONT-ASK is non nil, then no confirmation question will be asked.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2624 If DONT-UPDATE is non nil, then the command `View-process-status-update'
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2625 will not be run after renicing"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2626 (if (not pid-list)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2627 t
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2628 (View-process-renice-process nice-value
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2629 (car pid-list)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2630 dont-ask
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2631 dont-update)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2632 (View-process-renice-processes-in-pid-list nice-value
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2633 (cdr pid-list)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2634 dont-ask
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2635 dont-update)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2636
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2637 (defun View-process-renice-process-in-line (nice-value)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2638 "Alter priority of to the process in the current line.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2639 NICE-VALUE is the value, which will be added to the old nice value."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2640 (interactive
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2641 (let* ((View-process-stop-motion-help t)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2642 (nice-value (View-process-read-nice-value)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2643 (list nice-value)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2644 (if (and (>= (point) View-process-output-start)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2645 (< (point) View-process-output-end))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2646 (View-process-renice-process
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2647 nice-value
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2648 (View-process-get-pid-from-current-line)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2649 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2650 t)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2651
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2652 (defun View-process-renice-processes-g ()
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2653 "Alter priority of processes.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2654 It is a generic interface to `View-process-renice-processes-in-region'
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2655 and `View-process-renice-process-in-line'. The first will be called
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2656 if a region is active and the other one if not. If the region isn't
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2657 active, but marks are set, then the function is called on every
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2658 marked process."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2659 (interactive)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2660 (cond ((View-process-region-active-p)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2661 (call-interactively 'View-process-renice-processes-in-region))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2662 (View-process-pid-mark-alist
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2663 (call-interactively 'View-process-renice-processes-with-mark))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2664 (t
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2665 (call-interactively 'View-process-renice-process-in-line))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2666
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2667
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2668 ;;; Returning field values
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2669
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2670 (defun View-process-get-pid-from-current-line ()
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2671 "Returns a string with the pid of the process in the current line."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2672 (View-process-get-field-value-from-current-line
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2673 (View-process-translate-field-name-to-position View-process-pid-field-name)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2674 View-process-max-fields)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2675 )
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2676
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2677 (defun View-process-get-ppid-from-current-line ()
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2678 "Returns a string with the ppid of the process in the current line."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2679 (View-process-get-field-value-from-current-line
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2680 (View-process-translate-field-name-to-position View-process-ppid-field-name)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2681 View-process-max-fields)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2682 )
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2683
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2684 (defun View-process-get-pid-list-from-region (begin end)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2685 "Returns a list with all PID's in the region from BEGIN to END."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2686 (goto-char begin)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2687 (if (>= (point) end)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2688 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2689 (cons (View-process-get-pid-from-current-line)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2690 (progn (forward-line)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2691 (View-process-get-pid-list-from-region (point) end)))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2692
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2693 (defun View-process-get-pid-ppid-list-from-region (begin end)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2694 "Returns a list with all PID's ant its PPID's in the region
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2695 from BEGIN to END. END must be greater than BEGIN."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2696 (goto-char begin)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2697 (if (>= (point) end)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2698 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2699 (cons (cons (View-process-get-pid-from-current-line)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2700 (View-process-get-ppid-from-current-line))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2701 (progn (forward-line)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2702 (View-process-get-pid-ppid-list-from-region (point) end)))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2703
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2704 (defun View-process-get-field-value-from-current-line (field-no max-fields)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2705 "Returns the value of the field FIELD-NO from the current line as string.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2706 If the FIELD-NO is >= max-fields, then the rest of the line after the
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2707 start of the field FIELD-NO will be returned."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2708 (save-excursion
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2709 (View-process-jump-to-field field-no max-fields)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2710 (if (>= field-no max-fields)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2711 (buffer-substring (point) (View-process-return-end-of-line))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2712 (current-word)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2713 )
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2714
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2715 (defun View-process-jump-to-field (field-no max-fields)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2716 "Sets the point at the start of field FIELD-NO in the current line.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2717 MAX_FIELDS is used instead of FIELD-NO, if FIELD-NO > MAX_FIELDS."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2718 (View-process-replaces-blanks-in-fields-if-necessary)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2719 (beginning-of-line)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2720 (skip-chars-forward " ")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2721 (if (< field-no 1)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2722 (error "Parameter FIELD-NO must be >= 1"))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2723 (if (> field-no max-fields)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2724 (setq field-no max-fields))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2725 (if (= field-no 1)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2726 (point)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2727 (skip-chars-forward "^ ")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2728 (skip-chars-forward " ")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2729 (View-process-jump-to-field-1 (1- field-no))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2730
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2731 (defun View-process-jump-to-field-1 (field-no)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2732 "Internal function of View-process-jump-to-field"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2733 (if (= field-no 1)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2734 (point)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2735 (skip-chars-forward "^ ")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2736 (skip-chars-forward " ")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2737 (View-process-jump-to-field-1 (1- field-no))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2738
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2739
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2740 (defun View-process-display-emacs-pid ()
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2741 "Sets the point to the line with the emacs process."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2742 (interactive)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2743 (message (format "This emacs has the PID `%d'!" (emacs-pid))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2744
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2745
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2746 ;;; mouse functions
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2747
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2748 (defun View-process-mouse-kill (event)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2749 "Function for kill a process with the mouse."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2750 (interactive "e")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2751 (mouse-set-point event)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2752 (View-process-send-signal-to-process-in-line "SIGTERM"))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2753
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2754
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2755 ;;; Highlighting functions
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2756
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2757 (defun View-process-highlight-current-line (face)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2758 "Highlights the current line with the FACE."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2759 (let ((read-only buffer-read-only))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2760 (setq buffer-read-only nil)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2761 (let ((extent (make-extent (View-process-return-beginning-of-line)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2762 (View-process-return-end-of-line))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2763 (set-extent-face extent face)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2764 (setq buffer-read-only read-only)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2765 extent)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2766 ))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2767
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2768 (defun View-process-goto-line-with-pid (pid)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2769 "Sets the point in the line with the PID.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2770 It returns nil, if there is no line with the PID in the output."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2771 (if (string= pid (View-process-get-pid-from-current-line))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2772 t
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2773 (goto-char View-process-output-start)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2774 (while (and (< (point) View-process-output-end)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2775 (not (string= pid (View-process-get-pid-from-current-line))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2776 (forward-line))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2777 (< (point) View-process-output-end)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2778
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2779 ;(defun View-process-highlight-line-with-pid (pid face mark)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2780 ; "Highlights the line with the PID with the FACE and sets the MARK.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2781 ;It returns the extent of the line."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2782 ; (save-excursion
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2783 ; (View-process-goto-line-with-pid pid)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2784 ; (View-process-set-mark-in-current-line mark)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2785 ; (View-process-save-pid-and-mark pid mark)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2786 ; (View-process-highlight-current-line face)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2787 ; ))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2788
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2789 ;(defun View-process-delete-extent (extent)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2790 ; "Deletes the extent EXTENT."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2791 ; (let ((read-only buffer-read-only))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2792 ; (save-excursion
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2793 ; (goto-char (extent-start-position extent))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2794 ; (View-process-set-mark-in-current-line View-process-no-mark)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2795 ; (setq buffer-read-only nil)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2796 ; (delete-extent extent)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2797 ; (setq buffer-read-only read-only))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2798
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2799 ;;; mark functions
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2800
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2801 (defun View-process-save-pid-and-mark (pid mark)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2802 "Saves the PID and the MARK in a special alist.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2803 The name of the alist is `View-process-pid-mark-alist'."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2804 (if (assoc pid View-process-pid-mark-alist)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2805 (setcdr (assoc pid View-process-pid-mark-alist) (list mark ))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2806 (setq View-process-pid-mark-alist
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2807 (cons (list pid mark) View-process-pid-mark-alist))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2808
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2809 (defun View-process-remove-pid-and-mark-1 (pid pid-mark-alist)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2810 "Internal function of `View-process-remove-pid-and-mark'."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2811 (cond ((not pid-mark-alist)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2812 nil)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2813 ((string= pid (car (car pid-mark-alist)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2814 (View-process-remove-pid-and-mark-1 pid (cdr pid-mark-alist)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2815 (t
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2816 (cons (car pid-mark-alist)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2817 (View-process-remove-pid-and-mark-1 pid (cdr pid-mark-alist)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2818 )))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2819
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2820 (defun View-process-remove-pid-and-mark (pid)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2821 "Removes the PID from the alist `View-process-pid-mark-alist'."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2822 (setq View-process-pid-mark-alist
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2823 (View-process-remove-pid-and-mark-1 pid View-process-pid-mark-alist))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2824 )
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2825
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2826 (defun View-process-set-mark-in-current-line (mark)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2827 "Sets the MARK at the start of the current line."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2828 (let ((buffer-read-only nil))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2829 (save-excursion
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2830 (beginning-of-line)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2831 (delete-char 1)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2832 (insert mark))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2833
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2834 (defun View-process-mark-line-with-pid (pid &optional mark)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2835 "Sets the MARK in the line with the PID.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2836 It uses the 'View-process-single-line-mark', if mark is nil."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2837 ; (interactive "sPID: ")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2838 (interactive (let ((View-process-stop-motion-help t))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2839 (list (read-string "PID: "))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2840 (save-excursion
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2841 (View-process-goto-line-with-pid pid)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2842 (View-process-set-mark-in-current-line (or mark
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2843 View-process-single-line-mark))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2844 (View-process-save-pid-and-mark pid
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2845 (or mark
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2846 View-process-single-line-mark))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2847 ))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2848
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2849 (defun View-process-mark-current-line (&optional mark)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2850 "Sets a mark in the current line.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2851 It uses the 'View-process-single-line-mark' if MARK is nil."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2852 (interactive)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2853 (if (or (< (point) View-process-output-start)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2854 (> (point) View-process-output-end))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2855 (error "ERROR: Not in a process line!")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2856 (View-process-set-mark-in-current-line (or mark
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2857 View-process-single-line-mark))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2858 (View-process-save-pid-and-mark (View-process-get-pid-from-current-line)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2859 (or mark
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2860 View-process-single-line-mark))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2861
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2862
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2863 (defun View-process-unmark-current-line ()
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2864 "Unsets a mark in the current line."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2865 (interactive)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2866 (if (and (>= (point) View-process-output-start)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2867 (<= (point) View-process-output-end))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2868 (progn
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2869 (View-process-remove-pid-and-mark
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2870 (View-process-get-pid-from-current-line))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2871 (View-process-set-mark-in-current-line View-process-no-mark)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2872 )
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2873 (error "ERROR: Not in a process line!")))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2874
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2875 (defun View-process-mark-process-tree (process-tree)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2876 "Marks all processes in the list process-tree."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2877 (cond ((not process-tree))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2878 ((listp (car process-tree))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2879 (View-process-mark-process-tree (car process-tree))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2880 (View-process-mark-process-tree (cdr process-tree)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2881 ((stringp (car process-tree))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2882 (View-process-mark-line-with-pid (car process-tree)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2883 View-process-child-line-mark)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2884 (View-process-mark-process-tree (cdr process-tree)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2885 (t (error "Bug in 'View-process-mark-process-tree' !"))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2886
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2887 (defun View-process-mark-childs (pid)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2888 "Marks all childs of the process with the PID."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2889 ; (interactive "sParent PID: ")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2890 (interactive (let ((View-process-stop-motion-help t))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2891 (list (read-string "Parent PID: "))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2892 (if (not
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2893 (View-process-field-name-exists-p View-process-ppid-field-name))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2894 (error "ERROR: No field `%s' in the output. Try `M-x ps -j' to get it."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2895 View-process-ppid-field-name)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2896 (View-process-mark-line-with-pid pid View-process-parent-line-mark)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2897 (View-process-mark-process-tree
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2898 (cdr (View-process-get-child-process-tree pid)))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2899
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2900 (defun View-process-mark-childs-in-current-line ()
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2901 "Marks all the child processes of the process in the current line."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2902 (interactive)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2903 (View-process-mark-childs
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2904 (View-process-get-pid-from-current-line)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2905
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2906 (defun View-process-call-function-on-pid-and-mark-list (function
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2907 pid-mark-alist
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2908 &optional
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2909 not-interactive
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2910 &rest
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2911 non-interactive-args)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2912 "Calls the FUNCTION on every process in the PID-MARK-ALIST.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2913 FUNCTION must be an interactive function, which works on the
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2914 process in the current line, if INTERACTIVE is nil.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2915 If INTERACTIVE is t, then the function will be called non interactive
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2916 with the NON-INTERACTIVE-ARGS."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2917 (cond ((not pid-mark-alist))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2918 ((View-process-goto-line-with-pid (car (car pid-mark-alist)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2919 (if not-interactive
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2920 (eval (cons function non-interactive-args))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2921 (call-interactively function))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2922 (eval (append (list 'View-process-call-function-on-pid-and-mark-list
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2923 'function
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2924 '(cdr pid-mark-alist)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2925 'not-interactive)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2926 non-interactive-args)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2927 (t
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2928 (eval (append (list 'View-process-call-function-on-pid-and-mark-list
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2929 'function
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2930 '(cdr pid-mark-alist)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2931 'not-interactive)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2932 non-interactive-args)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2933 ))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2934
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2935 (defun View-process-set-marks-from-pid-mark-alist (pid-mark-alist)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2936 "Sets the marks of the PID-MARK-ALIST to the pids of the PID-MARK-ALIST."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2937 (cond ((not pid-mark-alist))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2938 ((View-process-goto-line-with-pid (car (car pid-mark-alist)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2939 (View-process-mark-current-line (car (cdr (car pid-mark-alist))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2940 (View-process-set-marks-from-pid-mark-alist (cdr pid-mark-alist)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2941 (t
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2942 (View-process-set-marks-from-pid-mark-alist (cdr pid-mark-alist)))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2943
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2944 (defun View-process-reset-last-marks ()
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2945 "Resets the last marks."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2946 (interactive)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2947 (View-process-set-marks-from-pid-mark-alist View-process-last-pid-mark-alist)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2948 )
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2949
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2950 (defun View-process-unmark-all ()
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2951 "Unmarks all processes."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2952 (interactive)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2953 (View-process-call-function-on-pid-and-mark-list
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2954 'View-process-unmark-current-line
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2955 View-process-pid-mark-alist
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2956 t))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2957
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2958
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2959 ;;; commands to moving around in a ps buffer
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2960
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2961 (defun View-process-output-start ()
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2962 "Set point to the first field after the output start."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2963 (interactive)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2964 (goto-char View-process-output-start)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2965 (skip-chars-forward " "))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2966
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2967 (defun View-process-output-end ()
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2968 "Set point to the first field before the output end."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2969 (interactive)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2970 (goto-char View-process-output-end)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2971 (skip-chars-backward " ")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2972 (skip-chars-backward "^ "))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2973
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2974 (defun View-process-next-field ()
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2975 "Moves forward one field."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2976 (interactive)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2977 (if (< (point) View-process-output-start)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2978 (View-process-output-start)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2979 (skip-chars-forward " ")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2980 (if (< (point) View-process-output-end)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2981 (if (= View-process-max-fields (View-process-current-field-number))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2982 (progn
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2983 (forward-line)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2984 (skip-chars-forward " ")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2985 (if (>= (point) View-process-output-end)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2986 (progn
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2987 (goto-char View-process-output-start)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2988 (skip-chars-forward " "))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2989 (skip-chars-forward "^ ")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2990 (skip-chars-forward " ")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2991 )
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2992 (goto-char View-process-output-start)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2993 (skip-chars-forward " "))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2994
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2995 (defun View-process-previous-field ()
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2996 "Moves backward one field."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2997 (interactive)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2998 (skip-chars-backward " ")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
2999 (backward-char)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3000 (if (> (point) View-process-output-start)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3001 (if (= View-process-max-fields (View-process-current-field-number))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3002 (View-process-jump-to-field View-process-max-fields
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3003 View-process-max-fields)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3004 (skip-chars-backward "^ \n")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3005 (if (< (point) View-process-output-start)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3006 (progn
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3007 (goto-char View-process-output-end)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3008 (forward-line -1)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3009 (View-process-jump-to-field View-process-max-fields
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3010 View-process-max-fields))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3011 (goto-char View-process-output-end)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3012 (forward-line -1)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3013 (View-process-jump-to-field View-process-max-fields
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3014 View-process-max-fields)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3015
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3016 (defun View-process-goto-first-field-next-line ()
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3017 "Set point to the first field in the next line."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3018 (interactive)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3019 (if (< (point) View-process-output-start)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3020 (View-process-output-start)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3021 (forward-line)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3022 (if (>= (point) View-process-output-end)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3023 (View-process-output-start)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3024 (View-process-jump-to-field 1 View-process-max-fields))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3025
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3026
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3027 ;;; buffer renaming
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3028
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3029 (defun View-process-rename-current-output-buffer (new-buffer-name)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3030 "Renames the ps output buffer to NEW-BUFFER-NAME."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3031 (interactive
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3032 (let ((View-process-stop-motion-help t))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3033 (list
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3034 (read-string "New PS output buffer name: "
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3035 (generate-new-buffer-name
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3036 (concat "*ps-"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3037 (or View-process-remote-host
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3038 (getenv "HOSTNAME"))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3039 "*"))))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3040 (if (not (string= mode-name View-process-mode-name))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3041 (error "ERROR: Not in a View-process-mode buffer!")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3042 (if (get-buffer new-buffer-name)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3043 (error "ERROR: Buffer %s exists!" new-buffer-name)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3044 (rename-buffer new-buffer-name)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3045 (setq View-process-buffer-name new-buffer-name)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3046 (if (or View-process-display-with-2-windows
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3047 (get-buffer View-process-header-buffer-name))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3048 (let ((new-header-buffer-name
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3049 (generate-new-buffer-name
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3050 (concat (substring new-buffer-name 0 -1)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3051 " header*")))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3052 (buffer (current-buffer)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3053 (set-buffer View-process-header-buffer-name)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3054 (rename-buffer new-header-buffer-name)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3055 (set-buffer buffer)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3056 (setq View-process-header-buffer-name new-header-buffer-name))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3057 ))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3058
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3059 ;;; For newer versions of field.el
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3060 (if (not (fboundp 'sort-float-fields))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3061 (defalias 'sort-float-fields 'sort-numeric-fields))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3062
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3063
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3064 ;;; Display Functions
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3065
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3066 (defun View-process-header-mode ()
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3067 "The mode of the buffer with the view process header."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3068 (set-syntax-table View-process-mode-syntax-table)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3069 (setq major-mode 'View-process-header-mode
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3070 mode-name View-process-header-mode-name)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3071 (setq truncate-lines View-process-truncate-lines)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3072 ; (setq buffer-modeline (not View-process-header-mode-line-off))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3073 (view-process-switch-buffer-modeline (not View-process-header-mode-line-off))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3074 (run-hooks 'View-process-header-mode-hook)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3075 )
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3076
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3077 (defun View-process-top-window-p (&optional window)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3078 "Returns t, if the WINDOW is the top one.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3079 If WINDOW is nil, then the current window is tested."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3080 (eq 0 (car (cdr (window-pixel-edges window)))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3081
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3082 (defun View-process-change-display-type (display-with-2-windows)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3083 "If DISPLAY-WITH-2-WINDOWS is non nil, then a 2 windows display is used."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3084 (if display-with-2-windows
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3085 (let ((window-size View-process-ps-header-window-size))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3086 (cond ((eq (count-windows 'NO-MINI) 1)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3087 ;; split window
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3088 (split-window nil window-size)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3089 (select-window (next-window nil 'no-minibuf))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3090 )
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3091 ((= (count-windows 'NO-MINI) 2)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3092 (if (View-process-top-window-p)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3093 (progn
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3094 ;; delete other windows
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3095 (delete-other-windows)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3096 ;; split window
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3097 (split-window nil window-size))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3098 (select-window (next-window nil 'no-minibuf))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3099 ; (shrink-window (- (window-height) window-size))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3100 )
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3101 (select-window (next-window nil 'no-minibuf))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3102 )
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3103 ((> (count-windows 'NO-MINI) 2)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3104 ;; delete other windows
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3105 (delete-other-windows)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3106 ;; split window
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3107 (split-window nil window-size)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3108 (select-window (next-window nil 'no-minibuf))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3109 ))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3110 ;; copy header lines
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3111 (let ((header-lines (buffer-substring (point-min)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3112 View-process-header-end))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3113 (buffer (get-buffer-create View-process-header-buffer-name)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3114 (select-window (next-window nil 'no-minibuf))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3115 ;; load *ps-header* buffer in window
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3116 (set-window-buffer (get-buffer-window (current-buffer)) buffer)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3117 (setq buffer-read-only nil)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3118 (erase-buffer)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3119 ;; insert header lines
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3120 (insert header-lines)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3121 (setq buffer-read-only t)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3122 (goto-char (point-min))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3123 (View-process-header-mode)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3124 (if (not (= (window-height) window-size))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3125 (shrink-window (- (window-height) window-size)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3126 (select-window (next-window nil 'no-minibuf))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3127 ))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3128 (let ((header-buffer (get-buffer View-process-header-buffer-name)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3129 (if header-buffer
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3130 (progn
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3131 (if (get-buffer-window header-buffer)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3132 (delete-window (get-buffer-window header-buffer)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3133 (kill-buffer header-buffer))))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3134
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3135 (defun View-process-toggle-display-with-2-windows (&optional arg)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3136 "Change whether the view process output is displayed with two windows.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3137 With ARG, set `View-process-display-with-2-windows' to t, if ARG is
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3138 positive. ARG is a prefix arg."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3139 (interactive "P")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3140 (if arg
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3141 (if (>= (prefix-numeric-value arg) 0)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3142 (setq View-process-display-with-2-windows t)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3143 (setq View-process-display-with-2-windows nil))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3144 (if View-process-display-with-2-windows
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3145 (setq View-process-display-with-2-windows nil)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3146 (setq View-process-display-with-2-windows t)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3147 (View-process-change-display-type View-process-display-with-2-windows)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3148 (if View-process-display-with-2-windows
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3149 (View-process-toggle-hide-header '(1))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3150 (View-process-toggle-hide-header '(-1))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3151
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3152 (defun View-process-save-old-window-configuration ()
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3153 "Saves the window configuration before the first call of view process."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3154 (if (not View-process-old-window-configuration)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3155 (setq View-process-old-window-configuration
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3156 (current-window-configuration))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3157 ))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3158
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3159 (defun View-process-hide-header (hide-header)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3160 "Hides the header lines in the view processes buffer, if HIDE-HEADER is t."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3161 (if hide-header
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3162 (if (<= View-process-output-start (point-max))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3163 (narrow-to-region View-process-output-start (point-max))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3164 (narrow-to-region (point-max) (point-max)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3165 (widen)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3166
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3167 (defun View-process-toggle-hide-header (&optional arg)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3168 "Change whether the header are hided.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3169 With ARG, set `View-process-hide-header' to t, if ARG is positive.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3170 ARG is a prefix arg."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3171 (interactive "P")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3172 (if arg
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3173 (if (>= (prefix-numeric-value arg) 0)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3174 (setq View-process-hide-header t)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3175 (setq View-process-hide-header nil))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3176 (if View-process-hide-header
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3177 (setq View-process-hide-header nil)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3178 (setq View-process-hide-header t)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3179 (View-process-hide-header View-process-hide-header))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3180
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3181 ;;; Misc. commands
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3182
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3183 (defun View-process-quit ()
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3184 "Kills the *ps* buffer."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3185 (interactive)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3186 (if (y-or-n-p
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3187 "Do you want really want to quit the view process mode? ")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3188 (progn
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3189 (if (get-buffer View-process-buffer-name)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3190 (kill-buffer View-process-buffer-name))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3191 (if (or View-process-display-with-2-windows
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3192 (get-buffer View-process-header-buffer-name))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3193 (kill-buffer View-process-header-buffer-name))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3194 (set-window-configuration View-process-old-window-configuration)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3195 (setq View-process-old-window-configuration nil)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3196 )))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3197
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3198 (defun View-process-submit-bug-report ()
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3199 "Submit via mail a bug report on View-process-mode."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3200 (interactive)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3201 (require 'reporter)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3202 (let ((bsd-or-system-v (View-process-bsd-or-system-v)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3203 (reporter-submit-bug-report
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3204 View-process-package-maintainer
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3205 (concat View-process-package-name " " View-process-package-version)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3206 (list 'emacs-version
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3207 'major-mode
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3208 'View-process-buffer-name
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3209 'View-process-header-buffer-name
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3210 'View-process-sorter-and-filter
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3211 'View-process-actual-sorter-and-filter
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3212 'View-process-display-with-2-windows
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3213 'View-process-hide-header
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3214 'View-process-truncate-lines
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3215 'View-process-motion-help
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3216 'View-process-old-window-configuration
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3217 'View-process-field-names
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3218 'View-process-max-fields
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3219 'View-process-output-start
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3220 'View-process-output-end
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3221 'View-process-header-start
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3222 'View-process-header-end
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3223 'View-process-host-names-and-system-types
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3224 'View-process-remote-host
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3225 'View-process-system-type
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3226 'bsd-or-system-v
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3227 'View-process-rsh-command
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3228 'View-process-signal-command
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3229 'View-process-status-command-switches-bsd
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3230 'View-process-status-command-switches-system-v
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3231 'View-process-status-last-command-switches
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3232 'View-process-status-command
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3233 'View-process-test-command
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3234 'View-process-test-switches
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3235 'View-process-uname-command
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3236 'View-process-uname-switches
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3237 )
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3238 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3239 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3240 (concat
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3241 "If it is possible, you should send this bug report from the buffer\n"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3242 "with the view process mode. Please answer the following questions.\n"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3243 "Which is the name of your system? \n"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3244 "Is your system a BSD Unix? \n"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3245 "Is your system a System V Unix? \n"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3246 "Describe your bug: "
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3247 ))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3248
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3249 (defun View-process-display-version ()
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3250 "Displays the current version of the mode."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3251 (interactive)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3252 (message "View Process Mode, %s, Author: Heiko Münkel."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3253 View-process-package-version))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3254
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3255 (defun View-process-toggle-truncate-lines (&optional arg)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3256 "Change whether the lines in this buffer are truncated.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3257 With ARG, set `truncate-lines' to t, if ARG is positive.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3258 ARG is a prefix arg.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3259 It saves also the state of `truncate-lines' for the next
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3260 view process command in `View-process-truncate-lines'.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3261 It truncates also the lines in the view process header buffer,
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3262 if it is run in a view process mode buffer."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3263 (interactive "P")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3264 (if arg
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3265 (if (>= (prefix-numeric-value arg) 0)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3266 (setq truncate-lines t)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3267 (setq truncate-lines nil))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3268 (if truncate-lines
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3269 (setq truncate-lines nil)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3270 (setq truncate-lines t)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3271 (setq View-process-truncate-lines truncate-lines)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3272 (setq-default View-process-truncate-lines truncate-lines)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3273 (if (and (eq major-mode 'View-process-mode)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3274 (or View-process-display-with-2-windows
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3275 (get-buffer View-process-header-buffer-name)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3276 (let ((buffer (current-buffer))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3277 (truncate truncate-lines))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3278 (set-buffer View-process-header-buffer-name)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3279 (setq truncate-lines truncate)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3280 (set-buffer buffer))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3281
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3282 (defun View-process-return-beginning-of-line ()
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3283 "Returns the beginning of the current line.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3284 The point isn't changed."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3285 (save-excursion
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3286 (beginning-of-line)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3287 (point)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3288
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3289 (defun View-process-return-end-of-line ()
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3290 "Returns the end of the current line.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3291 The point isn't changed."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3292 (save-excursion
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3293 (end-of-line)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3294 (point)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3295
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3296 (defun View-process-assoc-2th (key list)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3297 "Return non-nil if KEY is `equal' to the 2th of an element of LIST.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3298 The value is actually the element of LIST whose 2th is KEY."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3299 (cond ((not list) nil)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3300 ((equal (car (cdr (car list))) key) (car list))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3301 (t (View-process-assoc-2th key (cdr list)))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3302
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3303
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3304 (defun View-process-replace-in-string (from-string
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3305 to-string
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3306 in-string
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3307 &optional start)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3308 "Replace FROM-STRING with TO-STRING in IN-STRING.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3309 The optional argument START set the start position > 0.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3310 FROM-STRING is a regular expression."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3311 (setq start (or start 0))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3312 (let ((start-of-from-string (string-match from-string in-string start)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3313 (if start-of-from-string
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3314 (concat (substring in-string start start-of-from-string)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3315 to-string
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3316 (View-process-replace-in-string from-string
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3317 to-string
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3318 in-string
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3319 (match-end 0)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3320 (substring in-string start))))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3321
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3322
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3323 (defun View-process-toggle-digit-bindings (&optional arg)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3324 "Change whether the digit keys sends signals to the processes.
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3325 With ARG, set `View-process-digit-bindings-send-signal' to t,
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3326 if ARG is positive. ARG is a prefix arg."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3327 (interactive "P")
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3328 (if arg
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3329 (if (>= (prefix-numeric-value arg) 0)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3330 (setq View-process-digit-bindings-send-signal t)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3331 (setq View-process-digit-bindings-send-signal nil))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3332 (if View-process-digit-bindings-send-signal
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3333 (setq View-process-digit-bindings-send-signal nil)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3334 (setq View-process-digit-bindings-send-signal t)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3335 (if View-process-digit-bindings-send-signal
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3336 (progn
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3337 (define-key View-process-mode-map "0"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3338 'undefined)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3339 (define-key View-process-mode-map "1"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3340 'View-process-send-key-as-signal-to-processes)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3341 (define-key View-process-mode-map "2"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3342 'View-process-send-key-as-signal-to-processes)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3343 (define-key View-process-mode-map "3"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3344 'View-process-send-key-as-signal-to-processes)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3345 (define-key View-process-mode-map "4"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3346 'View-process-send-key-as-signal-to-processes)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3347 (define-key View-process-mode-map "5"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3348 'View-process-send-key-as-signal-to-processes)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3349 (define-key View-process-mode-map "6"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3350 'View-process-send-key-as-signal-to-processes)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3351 (define-key View-process-mode-map "7"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3352 'View-process-send-key-as-signal-to-processes)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3353 (define-key View-process-mode-map "8"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3354 'View-process-send-key-as-signal-to-processes)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3355 (define-key View-process-mode-map "9"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3356 'View-process-send-key-as-signal-to-processes)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3357 )
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3358 (define-key View-process-mode-map "0"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3359 'digit-argument)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3360 (define-key View-process-mode-map "1"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3361 'digit-argument)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3362 (define-key View-process-mode-map "2"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3363 'digit-argument)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3364 (define-key View-process-mode-map "3"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3365 'digit-argument)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3366 (define-key View-process-mode-map "4"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3367 'digit-argument)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3368 (define-key View-process-mode-map "5"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3369 'digit-argument)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3370 (define-key View-process-mode-map "6"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3371 'digit-argument)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3372 (define-key View-process-mode-map "7"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3373 'digit-argument)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3374 (define-key View-process-mode-map "8"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3375 'digit-argument)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3376 (define-key View-process-mode-map "9"
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3377 'digit-argument)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3378 ))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3379
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3380 (if View-process-digit-bindings-send-signal
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3381 (View-process-toggle-digit-bindings 1)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3382 (View-process-toggle-digit-bindings -1))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3383
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3384 (defun View-process-revert-buffer (&optional ignore-auto noconfirm)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3385 "Updates the view-process buffer with `View-process-status-update'."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3386 (View-process-status-update))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3387
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3388
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3389 ;;; Emacs version specific stuff
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3390
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3391 (if (View-process-xemacs-p)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3392 (require 'view-process-xemacs)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3393 (require 'view-process-emacs-19))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3394
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3395
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3396 ;;; face setting
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3397
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3398 (if (facep 'View-process-child-line-face)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3399 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3400 (make-face 'View-process-child-line-face)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3401 (if (View-process-search-color View-process-child-line-foreground)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3402 (set-face-foreground 'View-process-child-line-face
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3403 (View-process-search-color
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3404 View-process-child-line-foreground)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3405 (if (View-process-search-color View-process-child-line-background)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3406 (set-face-background 'View-process-child-line-face
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3407 (View-process-search-color
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3408 View-process-child-line-background)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3409 (set-face-font 'View-process-child-line-face
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3410 View-process-child-line-font)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3411 (set-face-underline-p 'View-process-child-line-face
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3412 View-process-child-line-underline-p))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3413
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3414 (if (facep 'View-process-parent-line-face)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3415 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3416 (make-face 'View-process-parent-line-face)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3417 (if (View-process-search-color View-process-parent-line-foreground)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3418 (set-face-foreground 'View-process-parent-line-face
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3419 (View-process-search-color
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3420 View-process-parent-line-foreground)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3421 (if (View-process-search-color View-process-parent-line-background)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3422 (set-face-background 'View-process-parent-line-face
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3423 (View-process-search-color
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3424 View-process-parent-line-background)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3425 (set-face-font 'View-process-parent-line-face
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3426 View-process-parent-line-font)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3427 (set-face-underline-p 'View-process-parent-line-face
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3428 View-process-parent-line-underline-p))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3429
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3430 (if (facep 'View-process-single-line-face)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3431 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3432 (make-face 'View-process-single-line-face)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3433 (if (View-process-search-color View-process-single-line-foreground)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3434 (set-face-foreground 'View-process-single-line-face
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3435 (View-process-search-color
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3436 View-process-single-line-foreground)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3437 (if (View-process-search-color View-process-single-line-background)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3438 (set-face-background 'View-process-single-line-face
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3439 (View-process-search-color
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3440 View-process-single-line-background)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3441 (set-face-font 'View-process-single-line-face
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3442 View-process-single-line-font)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3443 (set-face-underline-p 'View-process-single-line-face
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3444 View-process-single-line-underline-p))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3445
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3446 (if (facep 'View-process-signaled-line-face)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3447 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3448 (make-face 'View-process-signaled-line-face)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3449 (if (View-process-search-color View-process-signaled-line-foreground)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3450 (set-face-foreground 'View-process-signaled-line-face
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3451 (View-process-search-color
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3452 View-process-signaled-line-foreground)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3453 (if (View-process-search-color View-process-signaled-line-background)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3454 (set-face-background 'View-process-signaled-line-face
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3455 (View-process-search-color
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3456 View-process-signaled-line-background)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3457 (set-face-font 'View-process-signaled-line-face
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3458 View-process-signaled-line-font)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3459 (set-face-underline-p 'View-process-signaled-line-face
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3460 View-process-signaled-line-underline-p))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3461
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3462 (if (facep 'View-process-signal-line-face)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3463 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3464 (make-face 'View-process-signal-line-face)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3465 (if (View-process-search-color View-process-signal-line-foreground)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3466 (set-face-foreground 'View-process-signal-line-face
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3467 (View-process-search-color
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3468 View-process-signal-line-foreground)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3469 (if (View-process-search-color View-process-signal-line-background)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3470 (set-face-background 'View-process-signal-line-face
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3471 (View-process-search-color
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3472 View-process-signal-line-background)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3473 (set-face-font 'View-process-signal-line-face
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3474 View-process-signal-line-font)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3475 (set-face-underline-p 'View-process-signal-line-face
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3476 View-process-signal-line-underline-p))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3477
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3478 (if (facep 'View-process-renice-line-face)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3479 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3480 (make-face 'View-process-renice-line-face)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3481 (if (View-process-search-color View-process-renice-line-foreground)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3482 (set-face-foreground 'View-process-renice-line-face
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3483 (View-process-search-color
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3484 View-process-renice-line-foreground)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3485 (if (View-process-search-color View-process-renice-line-background)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3486 (set-face-background 'View-process-renice-line-face
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3487 (View-process-search-color
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3488 View-process-renice-line-background)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3489 (set-face-font 'View-process-renice-line-face
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3490 View-process-renice-line-font)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3491 (set-face-underline-p 'View-process-renice-line-face
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3492 View-process-renice-line-underline-p))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3493
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3494 (if (facep 'View-process-header-line-face)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3495 nil
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3496 (make-face 'View-process-header-line-face)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3497 (if (View-process-search-color View-process-header-line-foreground)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3498 (set-face-foreground 'View-process-header-line-face
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3499 (View-process-search-color
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3500 View-process-header-line-foreground)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3501 (if (View-process-search-color View-process-header-line-background)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3502 (set-face-background 'View-process-header-line-face
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3503 (View-process-search-color
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3504 View-process-header-line-background)))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3505 (set-face-font 'View-process-header-line-face
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3506 View-process-header-line-font)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3507 (set-face-underline-p 'View-process-header-line-face
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3508 View-process-header-line-underline-p))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3509
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3510 (defun View-process-highlight-header-line ()
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3511 "Highlights the headerline with the face `View-process-header-line-face'."
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3512 (let ((extent
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3513 (make-extent View-process-header-start View-process-header-end)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3514 ))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3515 (set-extent-face extent 'View-process-header-line-face)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3516 (set-extent-property extent 'duplicable t))
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3517 )
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3518
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3519 ;;; A short cut for the View-process-status command
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3520
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3521 (defalias 'ps 'View-process-status)
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3522
5a88923fcbfe Import from CVS: tag r20-3b9
cvs
parents:
diff changeset
3523 ;;; view-process-mode.el ends here