]> code.delx.au - gnu-emacs/blobdiff - lisp/mh-e/mh-comp.el
(mh-annotate-msg): Remove trailing whitespace.
[gnu-emacs] / lisp / mh-e / mh-comp.el
index a71de8246c591b7b27c6800f875faded5af9b4e5..ef97796105bd09b9c407346a40a520a12ecb35c4 100644 (file)
@@ -1,7 +1,7 @@
 ;;; mh-comp.el --- MH-E functions for composing and sending messages
 
 ;; Copyright (C) 1993, 1995, 1997,
-;;  2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
+;;  2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
 
 ;; Author: Bill Wohler <wohler@newt.com>
 ;; Maintainer: Bill Wohler <wohler@newt.com>
@@ -136,6 +136,10 @@ Used by the \\[mh-edit-again] and \\[mh-extract-rejected-mail] commands.")
 (defvar mh-annotate-field nil
   "Field name for message annotation.")
 
+(defvar mh-annotate-list nil
+  "Messages annotated, either a sequence name or a list of message numbers.
+This variable can be used by `mh-annotate-msg-hook'.")
+
 (defvar mh-insert-auto-fields-done-local nil
   "Buffer-local variable set when `mh-insert-auto-fields' called successfully.")
 (make-variable-buffer-local 'mh-insert-auto-fields-done-local)
@@ -924,8 +928,8 @@ The versions of MH-E, Emacs, and MH are shown."
     (setq mh-x-mailer-string
           (format "MH-E %s; %s; %sEmacs %s"
                   mh-version mh-variant-in-use
-                  (if mh-xemacs-flag "X" "GNU ")
-                  (cond ((not mh-xemacs-flag)
+                  (if (featurep 'xemacs) "X" "GNU ")
+                  (cond ((not (featurep 'xemacs))
                          (string-match "[0-9]+\\.[0-9]+\\(\\.[0-9]+\\)?"
                                        emacs-version)
                          (match-string 0 emacs-version))
@@ -975,18 +979,23 @@ This should be the last function called when composing the draft."
     (goto-char (point-max))
     (mh-letter-next-header-field)))
 
-(defun mh-annotate-msg (msg buffer note &rest args)
-  "Mark MSG in BUFFER with character NOTE and annotate message with ARGS.
-MSG can be a message number, a list of message numbers, or a
-sequence."
-  (apply 'mh-exec-cmd "anno" buffer
+(defun mh-annotate-msg (msg folder note &rest args)
+  "Mark MSG in FOLDER with character NOTE and annotate message with ARGS.
+MSG can be a message number, a list of message numbers, or a sequence.
+The hook `mh-annotate-msg-hook' is run after annotating; see its
+documentation for variables it can use."
+  (apply 'mh-exec-cmd "anno" folder
          (if (listp msg) (append msg args) (cons msg args)))
   (save-excursion
-    (cond ((get-buffer buffer)          ; Buffer may be deleted
-           (set-buffer buffer)
+    (cond ((get-buffer folder)          ; Buffer may be deleted
+           (set-buffer folder)
            (mh-iterate-on-range nil msg
              (mh-notate nil note
-                        (+ mh-cmd-note mh-scan-field-destination-offset)))))))
+                        (+ mh-cmd-note mh-scan-field-destination-offset))))))
+  (let ((mh-current-folder folder)
+        ;; mh-annotate-list is a sequence name or a list of message numbers
+        (mh-annotate-list (if (numberp msg) (list msg) msg)))
+    (run-hooks 'mh-annotate-msg-hook)))
 
 (defun mh-insert-header-separator ()
   "Insert `mh-mail-header-separator', if absent."