+2007-08-25 Stephen Gildea <gildea@stop.mail-abuse.org>
+
+ * mh-e.el (mh-annotate-msg-hook): New variable.
+
+ * mh-comp.el (mh-annotate-msg): Call new mh-annotate-msg-hook.
+ (mh-annotate-list): New variable, for mh-annotate-msg-hook.
+
2007-08-21 Jeffrey C Honig <jch@honig.net>
* mh-folder.el (mh-folder-message-menu, mh-folder-mode-map): Add
(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)
(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."
:group 'mh-alias
:package-version '(MH-E . "8.0"))
+(defcustom-mh mh-annotate-msg-hook nil
+ "Hook run by `mh-annotate-msg' after annotation.
+Variables that are useful in this hook include `mh-current-folder',
+the current folder, and `mh-annotate-list', the messages annotated."
+ :type 'hook
+ :group 'mh-hooks
+ :group 'mh-sending-mail
+ :package-version '(MH-E . "8.1"))
+
(defcustom-mh mh-before-commands-processed-hook nil
"Hook run by \\<mh-folder-mode-map>\\[mh-execute-commands] before performing outstanding refile and delete requests.