-;;; mh-comp --- mh-e functions for composing messages
-;; Time-stamp: <95/08/19 17:48:59 gildea>
+;;; mh-comp.el --- mh-e functions for composing messages
+;; Time-stamp: <2001-12-20 18:55:07 pavel>
-;; Copyright (C) 1993, 1995, 1997 Free Software Foundation, Inc.
+;; Copyright (C) 1993,1995,1997,2000 Free Software Foundation, Inc.
-;; This file is part of mh-e, part of GNU Emacs.
+;; Maintainer: Bill Wohler <wohler@newt.com>
+;; Keywords: mail
+;; Bug-reports: include `M-x mh-version' output in any correspondence
+
+;; This file is part of GNU Emacs.
;; GNU Emacs is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;;; Change Log:
-;; $Id: mh-comp.el,v 1.14 1999/03/01 03:47:07 kwzh Exp rms $
+;; $Id: mh-comp.el,v 1.22 2001/07/15 19:53:53 pj Exp $
;;; Code:
(defcustom mh-compose-letter-function nil
"Invoked when setting up a letter draft.
It is passed three arguments: TO recipients, SUBJECT, and CC recipients."
- :type 'function
+ :type '(choice (const nil) function)
:group 'mh-compose)
(defcustom mh-before-send-letter-hook nil
Users should use `\\[mh-smail]' to compose mail."
(mh-find-path)
(let ((mh-error-if-no-draft t))
- (mh-send to "" subject)))
+ (mh-send (or to "") "" (or subject ""))))
(defun mh-edit-again (msg)
(setq components
(expand-file-name mh-comp-formfile mh-lib)))
components)
+ ((file-exists-p
+ (setq components
+ (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\""
components)))))
(defun mh-read-draft (use initial-contents delete-contents-file)
;; Read draft file into a draft buffer and make that buffer the current one.
;; USE is a message used for prompting about the intended use of the message.
- ;; INITIAL-CONTENTS is filename that is read into an empty buffer, or NIL
+ ;; INITIAL-CONTENTS is filename that is read into an empty buffer, or nil
;; if buffer should not be modified. Delete the initial-contents file if
;; DELETE-CONTENTS-FILE flag is set.
;; Returns the draft folder's name.
(if (y-or-n-p
(format "A draft exists. Use for %s? " use))
(if mh-error-if-no-draft
- (error "A prior draft exists."))
+ (error "A prior draft exists"))
t)))
(erase-buffer)
(insert-file-contents initial-contents)
(defun mh-goto-header-field (field)
;; Move to FIELD in the message header.
;; Move to the end of the FIELD name, which should end in a colon.
- ;; Returns T if found, NIL if not.
+ ;; Returns t if found, nil if not.
(goto-char (point-min))
(let ((case-fold-search t)
(headers-end (save-excursion
(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.
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))
(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 ()
(run-hooks 'mh-yank-hooks))
(t
(or (bolp) (forward-line 1))
- (let ((zmacs-regions nil)) ;so "(mark)" works in XEmacs
- (while (< (point) (mark))
- (insert mh-ins-string)
- (forward-line 1))))))
+ (while (< (point) (mark))
+ (insert mh-ins-string)
+ (forward-line 1)))))
(defun mh-fully-kill-draft ()
(autoload 'mh-revert-mhn-edit "mh-mime"
"Undoes the effect of \\[mh-edit-mhn] by reverting to the backup file.
Optional non-nil argument means don't ask for confirmation." t)
+
+;;; mh-comp.el ends here