From ec54e7a421075e0b973d72dbf0ab099a328dbe8a Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Thu, 11 Nov 2010 17:24:03 -0500 Subject: * lisp/gnus/smime.el (smime-mode): Use define-derived-mode. (smime-mode-map): Move initialization into declaration. (gnus-run-mode-hooks): Don't autoload. --- lisp/gnus/smime.el | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) (limited to 'lisp/gnus/smime.el') diff --git a/lisp/gnus/smime.el b/lisp/gnus/smime.el index b8ee4c19924..5363a40c727 100644 --- a/lisp/gnus/smime.el +++ b/lisp/gnus/smime.el @@ -649,20 +649,18 @@ A string or a list of strings is returned." (defvar smime-buffer "*SMIME*") -(defvar smime-mode-map nil) -(put 'smime-mode 'mode-class 'special) - -(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)) +(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)) -(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 @@ All normal editing commands are switched off. 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: ") -- cgit v1.2.1