# HG changeset patch # User Stephen Gildea # Date 1188051178 0 # Node ID af7dc745740289dc6cc77955604b3838312c7c7f # Parent fccd8136f3d6c9c0a9a36864087e65f60fbee880 add mh-annotate-msg-hook diff -r fccd8136f3d6 -r af7dc7457402 lisp/mh-e/ChangeLog --- a/lisp/mh-e/ChangeLog Sat Aug 25 14:09:24 2007 +0000 +++ b/lisp/mh-e/ChangeLog Sat Aug 25 14:12:58 2007 +0000 @@ -1,3 +1,10 @@ +2007-08-25 Stephen Gildea + + * 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 * mh-folder.el (mh-folder-message-menu, mh-folder-mode-map): Add diff -r fccd8136f3d6 -r af7dc7457402 lisp/mh-e/mh-comp.el --- a/lisp/mh-e/mh-comp.el Sat Aug 25 14:09:24 2007 +0000 +++ b/lisp/mh-e/mh-comp.el Sat Aug 25 14:12:58 2007 +0000 @@ -136,6 +136,10 @@ (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) @@ -975,18 +979,23 @@ (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." diff -r fccd8136f3d6 -r af7dc7457402 lisp/mh-e/mh-e.el --- a/lisp/mh-e/mh-e.el Sat Aug 25 14:09:24 2007 +0000 +++ b/lisp/mh-e/mh-e.el Sat Aug 25 14:12:58 2007 +0000 @@ -3032,6 +3032,15 @@ :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-execute-commands] before performing outstanding refile and delete requests.