aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoland Winkler2009-04-20 20:42:45 +0000
committerRoland Winkler2009-04-20 20:42:45 +0000
commitf67cf06438f78b6e20be4020fe9faf3c3545c412 (patch)
treee1ab80f02913fac0d8893a65a38282ca59a18bd4
parent1dbc941a599ebcdc779992453207e1f61f450bd6 (diff)
downloademacs-f67cf06438f78b6e20be4020fe9faf3c3545c412.tar.gz
emacs-f67cf06438f78b6e20be4020fe9faf3c3545c412.zip
(proced-sort): Declare it buffer-local.
(proced-send-signal): Handle non-nil signals.
-rw-r--r--lisp/ChangeLog5
-rw-r--r--lisp/proced.el106
2 files changed, 58 insertions, 53 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 3ecb79ab29c..0406754fabc 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
12009-04-20 Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
2
3 * proced.el (proced-sort): Declare it buffer-local.
4 (proced-send-signal): Handle non-nil signals.
5
12009-04-18 Jason Rumney <jasonr@gnu.org> 62009-04-18 Jason Rumney <jasonr@gnu.org>
2 7
3 * facemenu.el (list-colors-duplicates): w32-default-color-map is 8 * facemenu.el (list-colors-duplicates): w32-default-color-map is
diff --git a/lisp/proced.el b/lisp/proced.el
index 38163b17e8b..f529ac72c2c 100644
--- a/lisp/proced.el
+++ b/lisp/proced.el
@@ -317,7 +317,7 @@ of `proced-grammar-alist'."
317 :group 'proced 317 :group 'proced
318 :type '(choice (symbol :tag "Sort Scheme") 318 :type '(choice (symbol :tag "Sort Scheme")
319 (repeat :tag "Key List" (symbol :tag "Key")))) 319 (repeat :tag "Key List" (symbol :tag "Key"))))
320(make-variable-buffer-local 'proced-format) 320(make-variable-buffer-local 'proced-sort)
321 321
322(defcustom proced-descend t 322(defcustom proced-descend t
323 "Non-nil if proced listing is sorted in descending order." 323 "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 proced-signal-list 1737 proced-signal-list
1738 nil nil nil nil "TERM"))) 1738 nil nil nil nil "TERM")))
1739 (setq signal (if (string-match "^\\(\\S-+\\)\\s-" tmp) 1739 (setq signal (if (string-match "^\\(\\S-+\\)\\s-" tmp)
1740 (match-string 1 tmp) tmp)))))) 1740 (match-string 1 tmp) tmp)))))))
1741 ;; send signal 1741 ;; send signal
1742 (let ((count 0) 1742 (let ((count 0)
1743 failures) 1743 failures)
1744 ;; Why not always use `signal-process'? See 1744 ;; Why not always use `signal-process'? See
1745 ;; http://lists.gnu.org/archive/html/emacs-devel/2008-03/msg02955.html 1745 ;; http://lists.gnu.org/archive/html/emacs-devel/2008-03/msg02955.html
1746 (if (functionp proced-signal-function) 1746 (if (functionp proced-signal-function)
1747 ;; use built-in `signal-process' 1747 ;; use built-in `signal-process'
1748 (let ((signal (if (stringp signal) 1748 (let ((signal (if (stringp signal)
1749 (if (string-match "\\`[0-9]+\\'" signal) 1749 (if (string-match "\\`[0-9]+\\'" signal)
1750 (string-to-number signal) 1750 (string-to-number signal)
1751 (make-symbol signal)) 1751 (make-symbol signal))
1752 signal))) ; number 1752 signal))) ; number
1753 (dolist (process process-alist)
1754 (condition-case err
1755 (if (zerop (funcall
1756 proced-signal-function (car process) signal))
1757 (setq count (1+ count))
1758 (proced-log "%s\n" (cdr process))
1759 (push (cdr process) failures))
1760 (error ; catch errors from failed signals
1761 (proced-log "%s\n" err)
1762 (proced-log "%s\n" (cdr process))
1763 (push (cdr process) failures)))))
1764 ;; use external system call
1765 (let ((signal (concat "-" (if (numberp signal)
1766 (number-to-string signal) signal))))
1767 (dolist (process process-alist) 1753 (dolist (process process-alist)
1768 (with-temp-buffer 1754 (condition-case err
1769 (condition-case err 1755 (if (zerop (funcall
1770 (if (zerop (call-process 1756 proced-signal-function (car process) signal))
1771 proced-signal-function nil t nil 1757 (setq count (1+ count))
1772 signal (number-to-string (car process)))) 1758 (proced-log "%s\n" (cdr process))
1773 (setq count (1+ count)) 1759 (push (cdr process) failures))
1774 (proced-log (current-buffer)) 1760 (error ; catch errors from failed signals
1775 (proced-log "%s\n" (cdr process)) 1761 (proced-log "%s\n" err)
1776 (push (cdr process) failures)) 1762 (proced-log "%s\n" (cdr process))
1777 (error ; catch errors from failed signals 1763 (push (cdr process) failures)))))
1778 (proced-log (current-buffer)) 1764 ;; use external system call
1779 (proced-log "%s\n" (cdr process)) 1765 (let ((signal (concat "-" (if (numberp signal)
1780 (push (cdr process) failures))))))) 1766 (number-to-string signal) signal))))
1781 (if failures 1767 (dolist (process process-alist)
1782 ;; Proced error message are not always very precise. 1768 (with-temp-buffer
1783 ;; Can we issue a useful one-line summary in the 1769 (condition-case err
1784 ;; message area (using FAILURES) if only one signal failed? 1770 (if (zerop (call-process
1785 (proced-log-summary 1771 proced-signal-function nil t nil
1786 signal 1772 signal (number-to-string (car process))))
1787 (format "%d of %d signal%s failed" 1773 (setq count (1+ count))
1788 (length failures) (length process-alist) 1774 (proced-log (current-buffer))
1789 (if (= 1 (length process-alist)) "" "s"))) 1775 (proced-log "%s\n" (cdr process))
1790 (proced-success-message "Sent signal to" count))) 1776 (push (cdr process) failures))
1791 ;; final clean-up 1777 (error ; catch errors from failed signals
1792 (run-hooks 'proced-after-send-signal-hook)))) 1778 (proced-log (current-buffer))
1779 (proced-log "%s\n" (cdr process))
1780 (push (cdr process) failures)))))))
1781 (if failures
1782 ;; Proced error message are not always very precise.
1783 ;; Can we issue a useful one-line summary in the
1784 ;; message area (using FAILURES) if only one signal failed?
1785 (proced-log-summary
1786 signal
1787 (format "%d of %d signal%s failed"
1788 (length failures) (length process-alist)
1789 (if (= 1 (length process-alist)) "" "s")))
1790 (proced-success-message "Sent signal to" count)))
1791 ;; final clean-up
1792 (run-hooks 'proced-after-send-signal-hook)))
1793 1793
1794;; similar to `dired-why' 1794;; similar to `dired-why'
1795(defun proced-why () 1795(defun proced-why ()