Commit f67cf064 authored by Roland Winkler's avatar Roland Winkler
Browse files

(proced-sort): Declare it buffer-local.

(proced-send-signal): Handle non-nil signals.
parent 1dbc941a
2009-04-20 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
* proced.el (proced-sort): Declare it buffer-local.
(proced-send-signal): Handle non-nil signals.
2009-04-18 Jason Rumney <jasonr@gnu.org> 2009-04-18 Jason Rumney <jasonr@gnu.org>
   
* facemenu.el (list-colors-duplicates): w32-default-color-map is * facemenu.el (list-colors-duplicates): w32-default-color-map is
......
...@@ -317,7 +317,7 @@ of `proced-grammar-alist'." ...@@ -317,7 +317,7 @@ of `proced-grammar-alist'."
:group 'proced :group 'proced
:type '(choice (symbol :tag "Sort Scheme") :type '(choice (symbol :tag "Sort Scheme")
(repeat :tag "Key List" (symbol :tag "Key")))) (repeat :tag "Key List" (symbol :tag "Key"))))
(make-variable-buffer-local 'proced-format) (make-variable-buffer-local 'proced-sort)
(defcustom proced-descend t (defcustom proced-descend t
"Non-nil if proced listing is sorted in descending order." "Non-nil if proced listing is sorted in descending order."
...@@ -1737,59 +1737,59 @@ After sending the signal, this command runs the normal hook ...@@ -1737,59 +1737,59 @@ After sending the signal, this command runs the normal hook
proced-signal-list proced-signal-list
nil nil nil nil "TERM"))) nil nil nil nil "TERM")))
(setq signal (if (string-match "^\\(\\S-+\\)\\s-" tmp) (setq signal (if (string-match "^\\(\\S-+\\)\\s-" tmp)
(match-string 1 tmp) tmp)))))) (match-string 1 tmp) tmp)))))))
;; send signal ;; send signal
(let ((count 0) (let ((count 0)
failures) failures)
;; Why not always use `signal-process'? See ;; Why not always use `signal-process'? See
;; http://lists.gnu.org/archive/html/emacs-devel/2008-03/msg02955.html ;; http://lists.gnu.org/archive/html/emacs-devel/2008-03/msg02955.html
(if (functionp proced-signal-function) (if (functionp proced-signal-function)
;; use built-in `signal-process' ;; use built-in `signal-process'
(let ((signal (if (stringp signal) (let ((signal (if (stringp signal)
(if (string-match "\\`[0-9]+\\'" signal) (if (string-match "\\`[0-9]+\\'" signal)
(string-to-number signal) (string-to-number signal)
(make-symbol signal)) (make-symbol signal))
signal))) ; number signal))) ; number
(dolist (process process-alist)
(condition-case err
(if (zerop (funcall
proced-signal-function (car process) signal))
(setq count (1+ count))
(proced-log "%s\n" (cdr process))
(push (cdr process) failures))
(error ; catch errors from failed signals
(proced-log "%s\n" err)
(proced-log "%s\n" (cdr process))
(push (cdr process) failures)))))
;; use external system call
(let ((signal (concat "-" (if (numberp signal)
(number-to-string signal) signal))))
(dolist (process process-alist) (dolist (process process-alist)
(with-temp-buffer (condition-case err
(condition-case err (if (zerop (funcall
(if (zerop (call-process proced-signal-function (car process) signal))
proced-signal-function nil t nil (setq count (1+ count))
signal (number-to-string (car process)))) (proced-log "%s\n" (cdr process))
(setq count (1+ count)) (push (cdr process) failures))
(proced-log (current-buffer)) (error ; catch errors from failed signals
(proced-log "%s\n" (cdr process)) (proced-log "%s\n" err)
(push (cdr process) failures)) (proced-log "%s\n" (cdr process))
(error ; catch errors from failed signals (push (cdr process) failures)))))
(proced-log (current-buffer)) ;; use external system call
(proced-log "%s\n" (cdr process)) (let ((signal (concat "-" (if (numberp signal)
(push (cdr process) failures))))))) (number-to-string signal) signal))))
(if failures (dolist (process process-alist)
;; Proced error message are not always very precise. (with-temp-buffer
;; Can we issue a useful one-line summary in the (condition-case err
;; message area (using FAILURES) if only one signal failed? (if (zerop (call-process
(proced-log-summary proced-signal-function nil t nil
signal signal (number-to-string (car process))))
(format "%d of %d signal%s failed" (setq count (1+ count))
(length failures) (length process-alist) (proced-log (current-buffer))
(if (= 1 (length process-alist)) "" "s"))) (proced-log "%s\n" (cdr process))
(proced-success-message "Sent signal to" count))) (push (cdr process) failures))
;; final clean-up (error ; catch errors from failed signals
(run-hooks 'proced-after-send-signal-hook)))) (proced-log (current-buffer))
(proced-log "%s\n" (cdr process))
(push (cdr process) failures)))))))
(if failures
;; Proced error message are not always very precise.
;; Can we issue a useful one-line summary in the
;; message area (using FAILURES) if only one signal failed?
(proced-log-summary
signal
(format "%d of %d signal%s failed"
(length failures) (length process-alist)
(if (= 1 (length process-alist)) "" "s")))
(proced-success-message "Sent signal to" count)))
;; final clean-up
(run-hooks 'proced-after-send-signal-hook)))
;; similar to `dired-why' ;; similar to `dired-why'
(defun proced-why () (defun proced-why ()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment