changeset 94108:7ab68bf3a905

(proced-mode): Redefine as just the major-mode. (proced): Separate it from proced-mode.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Wed, 16 Apr 2008 03:07:49 +0000
parents 5d2bbe3fd618
children 6457a4cc8690
files lisp/ChangeLog lisp/proced.el
diffstat 2 files changed, 24 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Wed Apr 16 03:00:53 2008 +0000
+++ b/lisp/ChangeLog	Wed Apr 16 03:07:49 2008 +0000
@@ -1,5 +1,8 @@
 2008-04-16  Stefan Monnier  <monnier@iro.umontreal.ca>
 
+	* proced.el (proced-mode): Redefine as just the major-mode.
+	(proced): Separate it from proced-mode.
+
 	* vc.el: Rename vc-status to vc-dir and the vc-status var to vc-ewoc.
 
 2008-04-15  Stefan Monnier  <monnier@iro.umontreal.ca>
--- a/lisp/proced.el	Wed Apr 16 03:00:53 2008 +0000
+++ b/lisp/proced.el	Wed Apr 16 03:07:49 2008 +0000
@@ -227,7 +227,25 @@
                                               proced-command-alist)))
                             "\\s-+\\S-+")))
 
-(defun proced-mode (&optional arg)
+(define-derived-mode proced-mode nil "Proced"
+  "Mode for displaying UNIX system processes and sending signals to them.
+Type \\[proced-mark-process] to mark a process for later commands.
+Type \\[proced-send-signal] to send signals to marked processes.
+
+\\{proced-mode-map}"
+  (abbrev-mode 0)
+  (auto-fill-mode 0)
+  (setq buffer-read-only t
+        truncate-lines t)
+  (set (make-local-variable 'revert-buffer-function) 'proced-revert)
+  (set (make-local-variable 'font-lock-defaults)
+       '(proced-font-lock-keywords t nil nil beginning-of-line)))
+
+;; Proced mode is suitable only for specially formatted data.
+(put 'proced-mode 'mode-class 'special)
+
+;;;###autoload
+(defun proced (&optional arg)
   "Mode for displaying UNIX system processes and sending signals to them.
 Type \\[proced-mark-process] to mark a process for later commands.
 Type \\[proced-send-signal] to send signals to marked processes.
@@ -240,18 +258,7 @@
   (let ((proced-buffer (get-buffer-create "*Process Info*")) new)
     (set-buffer proced-buffer)
     (setq new (zerop (buffer-size)))
-    (when new
-      (kill-all-local-variables)
-      (use-local-map proced-mode-map)
-      (abbrev-mode 0)
-      (auto-fill-mode 0)
-      (setq buffer-read-only t
-            truncate-lines t
-            major-mode 'proced-mode
-            mode-name "Proced")
-      (set (make-local-variable 'revert-buffer-function) 'proced-revert)
-      (set (make-local-variable 'font-lock-defaults)
-           '(proced-font-lock-keywords t nil nil beginning-of-line)))
+    (when new (proced-mode))
 
     (if (or new arg)
         (proced-update))
@@ -260,14 +267,8 @@
 	(display-buffer proced-buffer)
       (pop-to-buffer proced-buffer)
       (message (substitute-command-keys
-                "type \\[quit-window] to quit, \\[proced-help] for help")))
-    (if new (run-mode-hooks 'proced-mode-hook))))
+                "type \\[quit-window] to quit, \\[proced-help] for help")))))
 
-;; Proced mode is suitable only for specially formatted data.
-(put 'proced-mode 'mode-class 'special)
-
-;;;###autoload
-(defalias 'proced 'proced-mode)
 
 (defun proced-mark (&optional count)
   "Mark the current (or next COUNT) processes."