unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] emacs: new notmuch-tree-process-exit-functions
@ 2022-08-21  3:06 jao
  2022-08-21 19:50 ` Tomi Ollila
  2022-09-03 11:22 ` David Bremner
  0 siblings, 2 replies; 3+ messages in thread
From: jao @ 2022-08-21  3:06 UTC (permalink / raw)
  To: notmuch; +Cc: jao

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

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] emacs: new notmuch-tree-process-exit-functions
  2022-08-21  3:06 [PATCH] emacs: new notmuch-tree-process-exit-functions jao
@ 2022-08-21 19:50 ` Tomi Ollila
  2022-09-03 11:22 ` David Bremner
  1 sibling, 0 replies; 3+ messages in thread
From: Tomi Ollila @ 2022-08-21 19:50 UTC (permalink / raw)
  To: jao, notmuch; +Cc: jao

On Sun, Aug 21 2022, jao@gnu.org wrote:

> Hook run when the tree insertion process finishes its job.
>
> --

LGTM. I (also would have chosen this name instead of the *sentinel* one)

Tomi


> 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
>
> _______________________________________________
> notmuch mailing list -- notmuch@notmuchmail.org
> To unsubscribe send an email to notmuch-leave@notmuchmail.org

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] emacs: new notmuch-tree-process-exit-functions
  2022-08-21  3:06 [PATCH] emacs: new notmuch-tree-process-exit-functions jao
  2022-08-21 19:50 ` Tomi Ollila
@ 2022-09-03 11:22 ` David Bremner
  1 sibling, 0 replies; 3+ messages in thread
From: David Bremner @ 2022-09-03 11:22 UTC (permalink / raw)
  To: jao, notmuch; +Cc: jao

jao <jao@gnu.org> writes:

> Hook run when the tree insertion process finishes its job.
>

applied to master

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-09-03 11:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-21  3:06 [PATCH] emacs: new notmuch-tree-process-exit-functions jao
2022-08-21 19:50 ` Tomi Ollila
2022-09-03 11:22 ` David Bremner

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).