changeset 111500:300c16876a2f

* lisp/gnus/smime.el (smime-mode): Use define-derived-mode. (smime-mode-map): Move initialization into declaration. (gnus-run-mode-hooks): Don't autoload.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Thu, 11 Nov 2010 17:24:03 -0500
parents 60e30155ac96
children 5b30cfe2d392
files lisp/gnus/ChangeLog lisp/gnus/smime.el
diffstat 2 files changed, 16 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/gnus/ChangeLog	Thu Nov 11 16:11:17 2010 -0500
+++ b/lisp/gnus/ChangeLog	Thu Nov 11 17:24:03 2010 -0500
@@ -1,3 +1,9 @@
+2010-11-11  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* smime.el (smime-mode-map): Move initialization into declaration.
+	(gnus-run-mode-hooks): Don't autoload.
+	(smime-mode): Use define-derived-mode.
+
 2010-11-11  Glenn Morris  <rgm@gnu.org>
 
 	* smime.el (from): Restrict declaration to XEmacs.
--- a/lisp/gnus/smime.el	Thu Nov 11 16:11:17 2010 -0500
+++ b/lisp/gnus/smime.el	Thu Nov 11 17:24:03 2010 -0500
@@ -649,20 +649,18 @@
 
 (defvar smime-buffer "*SMIME*")
 
-(defvar smime-mode-map nil)
-(put 'smime-mode 'mode-class 'special)
+(defvar smime-mode-map
+  (let ((map (make-sparse-keymap)))
+    (suppress-keymap map)
+    (define-key map "q" 'smime-exit)
+    (define-key map "f" 'smime-certificate-info)
+    map))
 
-(unless smime-mode-map
-  (setq smime-mode-map (make-sparse-keymap))
-  (suppress-keymap smime-mode-map)
-
-  (define-key smime-mode-map "q" 'smime-exit)
-  (define-key smime-mode-map "f" 'smime-certificate-info))
-
-(autoload 'gnus-run-mode-hooks "gnus-util")
 (autoload 'gnus-completing-read "gnus-util")
 
-(defun smime-mode ()
+(put 'smime-mode 'mode-class 'special)
+(define-derived-mode smime-mode fundamental-mode ;special-mode
+  "SMIME"
   "Major mode for browsing, viewing and fetching certificates.
 
 All normal editing commands are switched off.
@@ -671,16 +669,10 @@
 The following commands are available:
 
 \\{smime-mode-map}"
-  (interactive)
-  (kill-all-local-variables)
-  (setq major-mode 'smime-mode)
-  (setq mode-name "SMIME")
   (setq mode-line-process nil)
-  (use-local-map smime-mode-map)
   (buffer-disable-undo)
   (setq truncate-lines t)
-  (setq buffer-read-only t)
-  (gnus-run-mode-hooks 'smime-mode-hook))
+  (setq buffer-read-only t))
 
 (defun smime-certificate-info (certfile)
   (interactive "fCertificate file: ")