[PATCH 2/2] emacs: Add notmuch-show-insert-msg-hook

Subject:[PATCH 2/2] emacs: Add notmuch-show-insert-msg-hook

Date:Fri, 8 Jan 2021 18:40:04 +0000

To:notmuch@notmuchmail.org

Cc:David Edmondson

From:David Edmondson


Add a hook called after inserting each message into the buffer showing
messages.
---
 emacs/notmuch-show.el | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 222c9dae..292677bc 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -111,6 +111,12 @@ visible for any given message."
   :group 'notmuch-show
   :group 'notmuch-hooks)
 
+(defcustom notmuch-show-insert-msg-hook nil
+  "Functions called after inserting a message."
+  :type 'hook
+  :group 'notmuch-show
+  :group 'notmuch-hooks)
+
 (defcustom notmuch-show-max-text-part-size 100000
   "Maximum size of a text part to be shown by default in characters.
 
@@ -1104,7 +1110,9 @@ is t, hide the part initially and show the button."
     ;; Message visibility depends on whether it matched the search
     ;; criteria.
     (notmuch-show-message-visible msg (and (plist-get msg :match)
-					   (not (plist-get msg :excluded))))))
+					   (not (plist-get msg :excluded))))
+
+    (run-hooks 'notmuch-show-insert-msg-hook)))
 
 (defun notmuch-show-toggle-process-crypto ()
   "Toggle the processing of cryptographic MIME parts."
-- 
2.29.2
_______________________________________________
notmuch mailing list -- notmuch@notmuchmail.org
To unsubscribe send an email to notmuch-leave@notmuchmail.org

Thread: