unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: jao <jao@gnu.org>
To: notmuch@notmuchmail.org
Cc: jao <jao@gnu.org>
Subject: [PATCH] emacs: new notmuch-tree-process-exit-functions
Date: Sun, 21 Aug 2022 04:06:18 +0100	[thread overview]
Message-ID: <20220821030618.2935554-1-jao@gnu.org> (raw)

Hook run when the tree insertion process finishes its job.

--
This patch supersedes <id:20220816214023.1523322-1-jao@gnu.org>, but
changing the new variable name.

Right now, it can be used for silly things like removing or changing
the the "End of search." hardcoded message in the tree buffer.  But
also for more sophisticated things like folding all threads in add-ons
like my outline mode for tree buffers (to be submitted).

Signed-off-by: jao <jao@gnu.org>
---
 emacs/notmuch-tree.el | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el
index f63ac9a5..7ceddee2 100644
--- a/emacs/notmuch-tree.el
+++ b/emacs/notmuch-tree.el
@@ -1084,6 +1084,12 @@ Complete list of currently available key bindings:
   (setq buffer-read-only t)
   (setq truncate-lines t))
 
+(defvar notmuch-tree-process-exit-functions nil
+  "Functions called when the process inserting a tree of results finishes.
+
+Functions in this list are called with one argument, the process
+object, and with the tree results buffer as the current buffer.")
+
 (defun notmuch-tree-process-sentinel (proc _msg)
   "Add a message to let user know when \"notmuch tree\" exits."
   (let ((buffer (process-buffer proc))
@@ -1102,7 +1108,8 @@ Complete list of currently available key bindings:
 		(insert "End of search results.")
 		(unless (= exit-status 0)
 		  (insert (format " (process returned %d)" exit-status)))
-		(insert "\n")))))))))
+		(insert "\n"))))
+	  (run-hook-with-args 'notmuch-tree-process-exit-functions proc))))))
 
 (defun notmuch-tree-process-filter (proc string)
   "Process and filter the output of \"notmuch show\" for tree view."
-- 
2.37.2

             reply	other threads:[~2022-08-21  3:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-21  3:06 jao [this message]
2022-08-21 19:50 ` [PATCH] emacs: new notmuch-tree-process-exit-functions Tomi Ollila
2022-09-03 11:22 ` David Bremner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220821030618.2935554-1-jao@gnu.org \
    --to=jao@gnu.org \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).