diff lisp/mail/mh-comp.el @ 29420:25fb2df6c428

(mh-send-sub): Check mh-etc is bound before using it. (mh-letter-mode): Derive from text-mode. This implicitly means that it now calls kill-all-local-variables. Also remove the Emacs-18 compatibility code.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Mon, 05 Jun 2000 07:15:34 +0000
parents 192cbf5dbea2
children c4366892a814
line wrap: on
line diff
--- a/lisp/mail/mh-comp.el	Mon Jun 05 06:37:11 2000 +0000
+++ b/lisp/mail/mh-comp.el	Mon Jun 05 07:15:34 2000 +0000
@@ -26,7 +26,7 @@
 
 ;;; Change Log:
 
-;; $Id: mh-comp.el,v 1.16 1999/11/10 10:46:01 gerd Exp $
+;; $Id: mh-comp.el,v 1.17 2000/04/27 18:56:42 gerd Exp $
 
 ;;; Code:
 
@@ -517,7 +517,9 @@
 		      components)
 		     ((file-exists-p
 		       (setq components
-			     (expand-file-name mh-comp-formfile mh-etc)))
+			     (expand-file-name mh-comp-formfile
+					       ;; What is this mh-etc ??  -sm
+					       (and (boundp 'mh-etc) mh-etc))))
 		      components)
 		     (t
 		      (error (format "Can't find components file \"%s\""
@@ -691,7 +693,7 @@
 (put 'mh-letter-mode 'mode-class 'special)
 
 ;;;###autoload
-(defun mh-letter-mode ()
+(define-derived-mode mh-letter-mode text-mode "MH-Letter"
   "Mode for composing letters in mh-e.\\<mh-letter-mode-map>
 When you have finished composing, type \\[mh-send-letter] to send the message
 using the MH mail handling system.
@@ -720,8 +722,6 @@
     File to be inserted into message by \\[mh-insert-signature].
 
 This command runs the normal hooks `text-mode-hook' and `mh-letter-mode-hook'."
-
-  (interactive)
   (or mh-user-path (mh-find-path))
   (make-local-variable 'paragraph-start)
   (setq paragraph-start (concat "^[ \t]*[-_][-_][-_]+$\\|" paragraph-start))
@@ -736,19 +736,10 @@
   (make-local-variable 'mh-sent-from-msg)
   (make-local-variable 'mail-header-separator)
   (setq mail-header-separator "--------") ;for Hyperbole
-  (use-local-map mh-letter-mode-map)
-  (setq major-mode 'mh-letter-mode)
-  (mh-set-mode-name "MH-Letter")
-  (set-syntax-table mh-letter-mode-syntax-table)
-  (run-hooks 'text-mode-hook)
   ;; if text-mode-hook turned on auto-fill, tune it for messages
-  (cond ((and (boundp 'auto-fill-hook) auto-fill-hook) ;emacs 18
-	 (make-local-variable 'auto-fill-hook)
-	 (setq auto-fill-hook 'mh-auto-fill-for-letter)))
-  (cond ((and (boundp 'auto-fill-function) auto-fill-function) ;emacs 19
-	 (make-local-variable 'auto-fill-function)
-	 (setq auto-fill-function 'mh-auto-fill-for-letter)))
-  (run-hooks 'mh-letter-mode-hook))
+  (when auto-fill-function
+    (make-local-variable 'auto-fill-function)
+    (setq auto-fill-function 'mh-auto-fill-for-letter)))
 
 
 (defun mh-auto-fill-for-letter ()