]> code.delx.au - gnu-emacs/blobdiff - lisp/mh-e/mh-comp.el
(desktop-load-file): Do nothing when FUNCTION is nil.
[gnu-emacs] / lisp / mh-e / mh-comp.el
index cde52c650436c3d25b48ad357ca3212b89184362..a7af192ec4060f8adc65fb1c08765e8e39871838 100644 (file)
@@ -1,7 +1,7 @@
 ;;; mh-comp.el --- MH-E functions for composing messages
 
-;; Copyright (C) 1993, 95, 1997,
-;;  2000, 01, 02, 03, 2004 Free Software Foundation, Inc.
+;; Copyright (C) 1993, 1995, 1997,
+;;  2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
 
 ;; Author: Bill Wohler <wohler@newt.com>
 ;; Maintainer: Bill Wohler <wohler@newt.com>
@@ -22,8 +22,8 @@
 
 ;; You should have received a copy of the GNU General Public License
 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
 
 ;;; Commentary:
 
@@ -53,7 +53,6 @@
 (defvar mh-identity-menu)
 
 ;;; Autoloads
-(autoload 'Info-goto-node "info")
 (autoload 'mail-mode-fill-paragraph "sendmail")
 (autoload 'mm-handle-displayed-p "mm-decode")
 
@@ -491,8 +490,10 @@ to reply to:
    cc/all  sender and all recipients.
 If optional prefix argument INCLUDEP provided, then include the message
 in the reply using filter `mhl.reply' in your MH directory.
-If the file named by `mh-repl-formfile' exists, it is used as a skeleton
-for the reply.
+If the file named by `mh-repl-formfile' exists, it is used as a skeleton for
+the reply. If REPLY-TO is cc or all and you're using either the nmh or GNU
+mailutils variants and the file names by `mh-repl-group-formfile' exists, it
+is used instead.
 
 See also `mh-send'."
   (interactive (list
@@ -622,8 +623,8 @@ CONFIG is the window configuration before sending mail."
                                                )))
                       components)
                      (t
-                      (error (format "Can't find components file \"%s\""
-                                     components)))))
+                      (error "Can't find components file \"%s\""
+                             components))))
                   nil)))
       (mh-insert-fields "To:" to "Subject:" subject "Cc:" cc)
       (goto-char (point-max))
@@ -978,11 +979,13 @@ When a message is composed, the hooks `text-mode-hook' and
            (setq data-begin (match-end 0))
            (setq field (match-string 1)))
          (setq data-begin (max point data-begin))
-         (if (and field (mh-letter-skipped-header-field-p field))
-             (set-match-data nil)
-           (set-match-data (list data-begin data-end data-begin data-end)))
          (goto-char (if (equal point data-end) (1+ data-end) data-end))
-         t)))
+         (cond ((and field (mh-letter-skipped-header-field-p field))
+                (set-match-data nil)
+                nil)
+               (t (set-match-data
+                   (list data-begin data-end data-begin data-end))
+                  t)))))
 
 (defun mh-letter-header-end ()
   "Find the end of the message header.
@@ -1242,8 +1245,12 @@ Return t if fields added; otherwise return nil."
                           (value (cdar entry-list)))
                       (cond
                        ((equal ":identity" field)
-                        (when (and (not mh-identity-local)
-                                   (assoc value mh-identity-list))
+                        (when ;;(and (not mh-identity-local)
+                            ;; Bug 1204506.  But do we need to be able
+                            ;;  to set an identity manually that won't be
+                            ;;  overridden by mh-insert-auto-fields?
+                                   (assoc value mh-identity-list)
+                                   ;;)
                           (mh-insert-identity value)))
                        (t
                         (mh-modify-header-field field value
@@ -1423,10 +1430,10 @@ not indent and do not delete headers.  Leaves the mark before the letter
 and point after it."
   (interactive
    (list (mh-prompt-for-folder "Message from" mh-sent-from-folder nil)
-         (read-input (format "Message number%s: "
+         (read-input (concat "Message number"
                              (if (numberp mh-sent-from-msg)
-                                 (format " [%d]" mh-sent-from-msg)
-                               "")))
+                                 (format " (default %d): " mh-sent-from-msg)
+                               "")))
          current-prefix-arg))
   (save-restriction
     (narrow-to-region (point) (point))
@@ -1630,15 +1637,22 @@ This is useful in breaking up paragraphs in replies."
 (defun mh-complete-word (word choices begin end)
   "Complete WORD at from CHOICES.
 Any match found replaces the text from BEGIN to END."
-  (let ((completion (try-completion word choices)))
+  (let ((completion (try-completion word choices))
+        (completions-buffer "*Completions*"))
     (cond ((eq completion t)
+           (ignore-errors
+             (kill-buffer completions-buffer))
            (message "Completed: %s" word))
           ((null completion)
+           (ignore-errors
+             (kill-buffer completions-buffer))
            (message "No completion for `%s'" word))
           ((stringp completion)
            (if (equal word completion)
-               (with-output-to-temp-buffer "*Completions*"
+               (with-output-to-temp-buffer completions-buffer
                  (display-completion-list (all-completions word choices)))
+             (ignore-errors
+               (kill-buffer completions-buffer))
              (delete-region begin end)
              (insert completion))))))
 
@@ -1966,8 +1980,6 @@ Otherwise return the empty string."
 
 ;; "C-c /" prefix is used in mh-letter-mode by pgp.el and mailcrypt.el.
 
-;;;###autoload(add-to-list 'auto-mode-alist '("/drafts/[0-9]+\\'" . mh-letter-mode))
-
 (provide 'mh-comp)
 
 ;;; Local Variables: