]> code.delx.au - gnu-emacs/blobdiff - lisp/proced.el
Simplify url handling in rcirc-mode
[gnu-emacs] / lisp / proced.el
index 39ce00326a77cb7b319601d3aa1900f7745e1dc7..94ea579ebd84617f2bdd3318452363c8a7923591 100644 (file)
@@ -1,8 +1,8 @@
 ;;; proced.el --- operate on system processes like dired
 
-;; Copyright (C) 2008, 2009 Free Software Foundation, Inc.
+;; Copyright (C) 2008-2011 Free Software Foundation, Inc.
 
-;; Author: Roland Winkler <Roland.Winkler@physik.uni-erlangen.de>
+;; Author: Roland Winkler <winkler@gnu.org>
 ;; Keywords: Processes, Unix
 
 ;; This file is part of GNU Emacs.
@@ -265,8 +265,8 @@ It can also be a list of keys appearing in `proced-grammar-alist'."
 ;; FIXME: is there a better name for filter `user' that does not coincide
 ;; with an attribute key?
 (defcustom proced-filter-alist
-  `((user (user . ,(concat "\\`" (user-real-login-name) "\\'")))
-    (user-running (user . ,(concat "\\`" (user-real-login-name) "\\'"))
+  `((user (user . ,(concat "\\`" (regexp-quote (user-real-login-name)) "\\'")))
+    (user-running (user . ,(concat "\\`" (regexp-quote (user-real-login-name)) "\\'"))
                   (state . "\\`[Rr]\\'"))
     (all)
     (all-running (state . "\\`[Rr]\\'"))
@@ -459,7 +459,7 @@ Important: the match ends just after the marker.")
     (define-key km [down] 'next-line)
     (define-key km [up] 'previous-line)
     ;; marking
-    (define-key km "d" 'proced-mark-alt) ; Dired compatibility ("delete")
+    (define-key km "d" 'proced-mark) ; Dired compatibility ("delete")
     (define-key km "m" 'proced-mark)
     (put 'proced-mark :advertised-binding "m")
     (define-key km "u" 'proced-unmark)
@@ -682,9 +682,9 @@ See `proced-mode' for a description of features available in Proced buffers."
         (progn
           (display-buffer buffer)
           (with-current-buffer buffer
-            (run-hooks 'proced-post-display-hook)))
+            (proced-update t)))
       (pop-to-buffer buffer)
-      (run-hooks 'proced-post-display-hook)
+      (proced-update t)
       (message
        (substitute-command-keys
         "Type \\<proced-mode-map>\\[quit-window] to quit, \\[proced-help] for help")))))
@@ -717,10 +717,6 @@ The time interval for updates is specified via `proced-auto-update-interval'."
   (interactive "p")
   (proced-do-mark t count))
 
-;; So we can preferentially advertise the "m" binding in the mode help,
-;; rather than the "d" one.
-(defalias 'proced-mark-alt 'proced-mark)
-
 (defun proced-unmark (&optional count)
   "Unmark the current (or next COUNT) processes."
   (interactive "p")
@@ -1680,7 +1676,7 @@ After updating a displayed Proced buffer run the normal hook
         (message (if revert "Updating process information...done."
                    "Updating process display...done.")))))
 
-(defun proced-revert (&rest args)
+(defun proced-revert (&rest _args)
   "Reevaluate the process listing based on the currently running processes.
 Preserves point and marks."
   (proced-update t))
@@ -1715,7 +1711,8 @@ After sending the signal, this command runs the normal hook
                          (line-end-position))))))
     (unless signal
       ;; Display marked processes (code taken from `dired-mark-pop-up').
-      (let ((bufname  "*Marked Processes*")
+      (let ((bufname  " *Marked Processes*") ; use leading space in buffer name
+                                       ; to make this buffer ephemeral
             (header-line (substring-no-properties proced-header-line)))
         (with-current-buffer (get-buffer-create bufname)
           (setq truncate-lines t
@@ -1727,7 +1724,9 @@ After sending the signal, this command runs the normal hook
             (buffer-disable-undo)
             (setq buffer-read-only t)
             (dolist (process process-alist)
-              (insert "  " (cdr process) "\n")))
+              (insert "  " (cdr process) "\n"))
+            (delete-char -1)
+            (goto-char (point-min)))
           (save-window-excursion
             ;; Analogous to `dired-pop-to-buffer'
             ;; Don't split window horizontally.  (Bug#1806)
@@ -1738,8 +1737,9 @@ After sending the signal, this command runs the normal hook
                    (pnum (if (= 1 (length process-alist))
                              "1 process"
                            (format "%d processes" (length process-alist))))
-                   (completion-annotate-function
-                    (lambda (s) (cdr (assoc s proced-signal-list)))))
+                   (completion-extra-properties
+                    '(:annotation-function
+                      (lambda (s) (cdr (assoc s proced-signal-list))))))
               (setq signal
                     (completing-read (concat "Send signal [" pnum
                                              "] (default TERM): ")
@@ -1773,7 +1773,7 @@ After sending the signal, this command runs the normal hook
                                       (number-to-string signal) signal))))
           (dolist (process process-alist)
             (with-temp-buffer
-              (condition-case err
+              (condition-case nil
                   (if (zerop (call-process
                               proced-signal-function nil t nil
                               signal (number-to-string (car process))))
@@ -1873,5 +1873,4 @@ Killed processes cannot be recovered by Emacs."))
 
 (provide 'proced)
 
-;; arch-tag: a6e312ad-9032-45aa-972d-31a8cfc545af
 ;;; proced.el ends here