unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH v4 0/6] Add refresh all buffers functionality
@ 2016-10-08 21:01 Ioan-Adrian Ratiu
  2016-10-08 21:01 ` [PATCH v4 1/6] emacs: make the refresh code more consistent Ioan-Adrian Ratiu
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: Ioan-Adrian Ratiu @ 2016-10-08 21:01 UTC (permalink / raw)
  To: notmuch

Changes since v3:
This is a complete rewrite based on Mark's awesome patch to make
all buffer mode's refresh functions non-interactive and consistent
wrt to their arguments (Mark's patch is included in this series).

For a complete example how I use this feature you can look at
https://github.com/10ne1/emacs-config/blob/master/lisp/my-notmuch.el

Ioan-Adrian Ratiu (5):
  emacs: notmuch-search-refresh-view: reuse buffer
  emacs: notmuch-search: add no-display functionality
  emacs: notmuch-show: refresh all windows displaying buffer
  emacs: add no-display arg to generic refresh functions
  emacs: notmuch-lib: add refresh all buffers function

Mark Walters (1):
  emacs: make the refresh code more consistent

 emacs/notmuch-hello.el |  2 +-
 emacs/notmuch-lib.el   | 37 +++++++++++++++++++++++++++----------
 emacs/notmuch-show.el  | 21 ++++++++++++++-------
 emacs/notmuch-tree.el  |  5 ++---
 emacs/notmuch.el       | 21 ++++++++++++++-------
 5 files changed, 58 insertions(+), 28 deletions(-)

-- 
2.10.0

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

* [PATCH v4 1/6] emacs: make the refresh code more consistent
  2016-10-08 21:01 [PATCH v4 0/6] Add refresh all buffers functionality Ioan-Adrian Ratiu
@ 2016-10-08 21:01 ` Ioan-Adrian Ratiu
  2016-10-09 16:19   ` Tomi Ollila
  2016-10-08 21:01 ` [PATCH v4 2/6] emacs: notmuch-search-refresh-view: reuse buffer Ioan-Adrian Ratiu
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 8+ messages in thread
From: Ioan-Adrian Ratiu @ 2016-10-08 21:01 UTC (permalink / raw)
  To: notmuch

From: Mark Walters <markwalters1009@gmail.com>

The current refresh code is a little haphazard with some of the
refresh functions called interactively, and some not. Some of the
refresh functions take arguments and they aren't consistent.

This makes all the functions have the same form.
---
 emacs/notmuch-hello.el |  2 +-
 emacs/notmuch-lib.el   | 22 ++++++++++++----------
 emacs/notmuch-show.el  |  2 +-
 emacs/notmuch-tree.el  |  5 ++---
 emacs/notmuch.el       |  2 +-
 5 files changed, 17 insertions(+), 16 deletions(-)

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index d582bff..97280ca 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -604,7 +604,7 @@ with `notmuch-hello-query-counts'."
 
 (defimage notmuch-hello-logo ((:type png :file "notmuch-logo.png")))
 
-(defun notmuch-hello-update (&optional no-display)
+(defun notmuch-hello-update (&optional ignore no-display)
   "Update the current notmuch view."
   ;; Lazy - rebuild everything.
   (notmuch-hello no-display))
diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
index b2cdace..2d27e56 100644
--- a/emacs/notmuch-lib.el
+++ b/emacs/notmuch-lib.el
@@ -410,23 +410,25 @@ of its command symbol."
       (pop-to-buffer (help-buffer)))))
 
 (defvar notmuch-buffer-refresh-function nil
-  "Function to call to refresh the current buffer.")
+  "Function to call to refresh the current buffer.
+
+It will be called with two arguments: the first is the prefix
+argument when notmuch-refresh-this-buffer is called
+interactively, the second requests that the refresh call not
+display the buffer.")
 (make-variable-buffer-local 'notmuch-buffer-refresh-function)
 
-(defun notmuch-refresh-this-buffer ()
+(defun notmuch-refresh-this-buffer (prefix)
   "Refresh the current buffer."
-  (interactive)
+  (interactive "P")
   (when notmuch-buffer-refresh-function
-    (if (commandp notmuch-buffer-refresh-function)
-	;; Pass prefix argument, etc.
-	(call-interactively notmuch-buffer-refresh-function)
-      (funcall notmuch-buffer-refresh-function))))
+    (funcall notmuch-buffer-refresh-function prefix)))
 
-(defun notmuch-poll-and-refresh-this-buffer ()
+(defun notmuch-poll-and-refresh-this-buffer (prefix)
   "Invoke `notmuch-poll' to import mail, then refresh the current buffer."
-  (interactive)
+  (interactive "P")
   (notmuch-poll)
-  (notmuch-refresh-this-buffer))
+  (notmuch-refresh-this-buffer prefix))
 
 (defun notmuch-prettify-subject (subject)
   ;; This function is used by `notmuch-search-process-filter' which
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index f2487ab..1772d10 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1358,7 +1358,7 @@ This includes:
     ;; Go to the previously open message.
     (notmuch-show-goto-message current)))
 
-(defun notmuch-show-refresh-view (&optional reset-state)
+(defun notmuch-show-refresh-view (&optional reset-state ignore)
   "Refresh the current view.
 
 Refreshes the current view, observing changes in display
diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el
index 1555812..c347712 100644
--- a/emacs/notmuch-tree.el
+++ b/emacs/notmuch-tree.el
@@ -271,7 +271,6 @@ FUNC."
     (define-key map "x" 'notmuch-tree-quit)
     (define-key map "A" 'notmuch-tree-archive-thread)
     (define-key map "a" 'notmuch-tree-archive-message-then-next)
-    (define-key map "=" 'notmuch-tree-refresh-view)
     (define-key map "z" 'notmuch-tree-to-tree)
     (define-key map "n" 'notmuch-tree-next-matching-message)
     (define-key map "p" 'notmuch-tree-prev-matching-message)
@@ -571,9 +570,9 @@ message will be \"unarchived\", i.e. the tag changes in
   (when (window-live-p notmuch-tree-message-window)
     (notmuch-tree-show-message-in)))
 
-(defun notmuch-tree-refresh-view ()
+(defun notmuch-tree-refresh-view (&rest ignore)
   "Refresh view."
-  (interactive)
+  (interactive "P")
   (let ((inhibit-read-only t)
 	(basic-query notmuch-tree-basic-query)
 	(query-context notmuch-tree-query-context)
diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 888672b..ee1bb54 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -982,7 +982,7 @@ the configured default sort order."
 	  (set-process-query-on-exit-flag proc nil))))
     (run-hooks 'notmuch-search-hook)))
 
-(defun notmuch-search-refresh-view ()
+(defun notmuch-search-refresh-view (&rest ignore)
   "Refresh the current view.
 
 Kills the current buffer and runs a new search with the same
-- 
2.10.0

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

* [PATCH v4 2/6] emacs: notmuch-search-refresh-view: reuse buffer
  2016-10-08 21:01 [PATCH v4 0/6] Add refresh all buffers functionality Ioan-Adrian Ratiu
  2016-10-08 21:01 ` [PATCH v4 1/6] emacs: make the refresh code more consistent Ioan-Adrian Ratiu
@ 2016-10-08 21:01 ` Ioan-Adrian Ratiu
  2016-10-08 21:01 ` [PATCH v4 3/6] emacs: notmuch-search: add no-display functionality Ioan-Adrian Ratiu
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Ioan-Adrian Ratiu @ 2016-10-08 21:01 UTC (permalink / raw)
  To: notmuch

There's no reason to completely kill a buffer while refreshing its
search results because the buffer name is constant between refreshes
(based on the search query), only its contents may change and notmuch
search kills all local variables, so it's safe to reuse.

Reusing the same buffer also makes it possible to do things like
refreshing a buffer which is not focused or even not shown in any
window - this will be used in the next commits to add auto-refresh
capabilities to all existing notmuch buffers + a function to call
after syncing mail to refresh everything.

Signed-off-by: Ioan-Adrian Ratiu <adi@adirat.com>
---
 emacs/notmuch.el | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index ee1bb54..17a784d 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -985,7 +985,7 @@ the configured default sort order."
 (defun notmuch-search-refresh-view (&rest ignore)
   "Refresh the current view.
 
-Kills the current buffer and runs a new search with the same
+Erases the current buffer and runs a new search with the same
 query string as the current search. If the current thread is in
 the new search results, then point will be placed on the same
 thread. Otherwise, point will be moved to attempt to be in the
@@ -993,8 +993,10 @@ same relative position within the new buffer."
   (let ((target-line (line-number-at-pos))
 	(oldest-first notmuch-search-oldest-first)
 	(target-thread (notmuch-search-find-thread-id 'bare))
-	(query notmuch-search-query-string))
-    (notmuch-bury-or-kill-this-buffer)
+	(query notmuch-search-query-string)
+	(inhibit-read-only t))
+    (remove-overlays)
+    (erase-buffer)
     (notmuch-search query oldest-first target-thread target-line)
     (goto-char (point-min))))
 
-- 
2.10.0

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

* [PATCH v4 3/6] emacs: notmuch-search: add no-display functionality
  2016-10-08 21:01 [PATCH v4 0/6] Add refresh all buffers functionality Ioan-Adrian Ratiu
  2016-10-08 21:01 ` [PATCH v4 1/6] emacs: make the refresh code more consistent Ioan-Adrian Ratiu
  2016-10-08 21:01 ` [PATCH v4 2/6] emacs: notmuch-search-refresh-view: reuse buffer Ioan-Adrian Ratiu
@ 2016-10-08 21:01 ` Ioan-Adrian Ratiu
  2016-10-08 21:01 ` [PATCH v4 4/6] emacs: notmuch-show: refresh all windows displaying buffer Ioan-Adrian Ratiu
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: Ioan-Adrian Ratiu @ 2016-10-08 21:01 UTC (permalink / raw)
  To: notmuch

If no-display is non-nil when updating a notmuch-search buffer, do not
force bring to foreground in a window said search results buffer.

Signed-off-by: Ioan-Adrian Ratiu <adi@adirat.com>
---
 emacs/notmuch.el | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 17a784d..8d5e20c 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -925,7 +925,7 @@ PROMPT is the string to prompt with."
 
 ;;;###autoload
 (put 'notmuch-search 'notmuch-doc "Search for messages.")
-(defun notmuch-search (&optional query oldest-first target-thread target-line)
+(defun notmuch-search (&optional query oldest-first target-thread target-line no-display)
   "Display threads matching QUERY in a notmuch-search buffer.
 
 If QUERY is nil, it is read interactively from the minibuffer.
@@ -936,6 +936,9 @@ Other optional parameters are used as follows:
                  current if it appears in the search results.
   TARGET-LINE: The line number to move to if the target thread does not
                appear in the search results.
+  NO-DISPLAY: Do not try to foreground the search results buffer. If it is
+              already foregrounded i.e. displayed in a window, this has no
+              effect, meaning the buffer will remain visible.
 
 When called interactively, this will prompt for a query and use
 the configured default sort order."
@@ -949,7 +952,9 @@ the configured default sort order."
 
   (let* ((query (or query (notmuch-read-query "Notmuch search: ")))
 	 (buffer (get-buffer-create (notmuch-search-buffer-title query))))
-    (switch-to-buffer buffer)
+    (if no-display
+	(set-buffer buffer)
+      (switch-to-buffer buffer))
     (notmuch-search-mode)
     ;; Don't track undo information for this buffer
     (set 'buffer-undo-list t)
@@ -982,7 +987,7 @@ the configured default sort order."
 	  (set-process-query-on-exit-flag proc nil))))
     (run-hooks 'notmuch-search-hook)))
 
-(defun notmuch-search-refresh-view (&rest ignore)
+(defun notmuch-search-refresh-view (&optional ignore no-display)
   "Refresh the current view.
 
 Erases the current buffer and runs a new search with the same
@@ -997,7 +1002,7 @@ same relative position within the new buffer."
 	(inhibit-read-only t))
     (remove-overlays)
     (erase-buffer)
-    (notmuch-search query oldest-first target-thread target-line)
+    (notmuch-search query oldest-first target-thread target-line no-display)
     (goto-char (point-min))))
 
 (defun notmuch-search-toggle-order ()
-- 
2.10.0

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

* [PATCH v4 4/6] emacs: notmuch-show: refresh all windows displaying buffer
  2016-10-08 21:01 [PATCH v4 0/6] Add refresh all buffers functionality Ioan-Adrian Ratiu
                   ` (2 preceding siblings ...)
  2016-10-08 21:01 ` [PATCH v4 3/6] emacs: notmuch-search: add no-display functionality Ioan-Adrian Ratiu
@ 2016-10-08 21:01 ` Ioan-Adrian Ratiu
  2016-10-08 21:01 ` [PATCH v4 5/6] emacs: add no-display arg to generic refresh functions Ioan-Adrian Ratiu
  2016-10-08 21:01 ` [PATCH v4 6/6] emacs: notmuch-lib: add refresh all buffers function Ioan-Adrian Ratiu
  5 siblings, 0 replies; 8+ messages in thread
From: Ioan-Adrian Ratiu @ 2016-10-08 21:01 UTC (permalink / raw)
  To: notmuch

This updates all windows displaying a notmuch-show buffer when the
buffer refresh function is called.

Each window displaying a notmuch-show buffer has its own currently
displayed message based on the (point) location. We store the state
of all displayed windows when refreshing a notmuch-show buffer and
re-apply the current shown message (point) for all windows.

Implementation note: Each window has it's own (point) value, besides
the buffer's (point) value. Sometimes these values are identical like
in the case where a single window displays a buffer. When multiple
windows display a buffer, (point) returns each window's specific value.
What we are storing in this changeset is the window values not the
buffer point values. The buffer's point is returned only if no window
is displaying the buffer, a case we do not care about here.

Signed-off-by: Ioan-Adrian Ratiu <adi@adirat.com>
---
 emacs/notmuch-show.el | 19 +++++++++++++------
 1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index 1772d10..bd69751 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1317,8 +1317,13 @@ If no messages match the query return NIL."
 
 This includes:
  - the list of open messages,
- - the current message."
-  (list (notmuch-show-get-message-id) (notmuch-show-get-message-ids-for-open-messages)))
+ - the combination of current message id with/for each visible window."
+  (let* ((win-list (get-buffer-window-list (current-buffer) nil t))
+	 (win-id-combo (mapcar (lambda (win)
+				 (with-selected-window win
+				   (list win (notmuch-show-get-message-id))))
+			       win-list)))
+    (list win-id-combo (notmuch-show-get-message-ids-for-open-messages))))
 
 (defun notmuch-show-get-query ()
   "Return the current query in this show buffer"
@@ -1345,8 +1350,8 @@ This includes:
 This includes:
  - opening the messages previously opened,
  - closing all other messages,
- - moving to the correct current message."
-  (let ((current (car state))
+ - moving to the correct current message in every displayed window."
+  (let ((win-msg-alist (car state))
 	(open (cadr state)))
 
     ;; Open those that were open.
@@ -1355,8 +1360,10 @@ This includes:
 					   (member (notmuch-show-get-message-id) open))
 	  until (not (notmuch-show-goto-message-next)))
 
-    ;; Go to the previously open message.
-    (notmuch-show-goto-message current)))
+    (dolist (win-msg-pair win-msg-alist)
+      (with-selected-window (car win-msg-pair)
+	;; Go to the previously open message in this window
+	(notmuch-show-goto-message (cadr win-msg-pair))))))
 
 (defun notmuch-show-refresh-view (&optional reset-state ignore)
   "Refresh the current view.
-- 
2.10.0

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

* [PATCH v4 5/6] emacs: add no-display arg to generic refresh functions
  2016-10-08 21:01 [PATCH v4 0/6] Add refresh all buffers functionality Ioan-Adrian Ratiu
                   ` (3 preceding siblings ...)
  2016-10-08 21:01 ` [PATCH v4 4/6] emacs: notmuch-show: refresh all windows displaying buffer Ioan-Adrian Ratiu
@ 2016-10-08 21:01 ` Ioan-Adrian Ratiu
  2016-10-08 21:01 ` [PATCH v4 6/6] emacs: notmuch-lib: add refresh all buffers function Ioan-Adrian Ratiu
  5 siblings, 0 replies; 8+ messages in thread
From: Ioan-Adrian Ratiu @ 2016-10-08 21:01 UTC (permalink / raw)
  To: notmuch

As stated in the documentation for notmuch-buffer-refresh-function,
each buffer major mode's refresh function takes two args, but
notmuch-refresh-this-buffer and notmuch-poll-and-refresh-this-buffer
only pass the first arg. Add the second arg because it's very useful
for background refreshing.

Signed-off-by: Ioan-Adrian Ratiu <adi@adirat.com>
---
 emacs/notmuch-lib.el | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
index 2d27e56..e1b5066 100644
--- a/emacs/notmuch-lib.el
+++ b/emacs/notmuch-lib.el
@@ -418,17 +418,17 @@ interactively, the second requests that the refresh call not
 display the buffer.")
 (make-variable-buffer-local 'notmuch-buffer-refresh-function)
 
-(defun notmuch-refresh-this-buffer (prefix)
+(defun notmuch-refresh-this-buffer (prefix no-display)
   "Refresh the current buffer."
   (interactive "P")
   (when notmuch-buffer-refresh-function
-    (funcall notmuch-buffer-refresh-function prefix)))
+    (funcall notmuch-buffer-refresh-function prefix no-display)))
 
-(defun notmuch-poll-and-refresh-this-buffer (prefix)
+(defun notmuch-poll-and-refresh-this-buffer (prefix no-display)
   "Invoke `notmuch-poll' to import mail, then refresh the current buffer."
   (interactive "P")
   (notmuch-poll)
-  (notmuch-refresh-this-buffer prefix))
+  (notmuch-refresh-this-buffer prefix no-display))
 
 (defun notmuch-prettify-subject (subject)
   ;; This function is used by `notmuch-search-process-filter' which
-- 
2.10.0

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

* [PATCH v4 6/6] emacs: notmuch-lib: add refresh all buffers function
  2016-10-08 21:01 [PATCH v4 0/6] Add refresh all buffers functionality Ioan-Adrian Ratiu
                   ` (4 preceding siblings ...)
  2016-10-08 21:01 ` [PATCH v4 5/6] emacs: add no-display arg to generic refresh functions Ioan-Adrian Ratiu
@ 2016-10-08 21:01 ` Ioan-Adrian Ratiu
  5 siblings, 0 replies; 8+ messages in thread
From: Ioan-Adrian Ratiu @ 2016-10-08 21:01 UTC (permalink / raw)
  To: notmuch

notmuch-refresh-all-buffers calls each buffer's major mode specific
refresh function using the generic notmuch-refresh-this-buffer function.

Each buffer-specific refresh function has the same form, taking a prefix
and a no-display arg. Passing the no-display arg is very useful because
it tells the buffer-specific refresh functions to work in the background
and not bring forward the refreshed buffer in a window. This again is very
useful for silent async background updating the emacs display when new
mail is fetched.

Signed-off-by: Ioan-Adrian Ratiu <adi@adirat.com>
---
 emacs/notmuch-lib.el | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
index e1b5066..1162130 100644
--- a/emacs/notmuch-lib.el
+++ b/emacs/notmuch-lib.el
@@ -430,6 +430,21 @@ display the buffer.")
   (notmuch-poll)
   (notmuch-refresh-this-buffer prefix no-display))
 
+(defun notmuch-refresh-all-buffers (&optional no-display)
+  "Invoke `notmuch-refresh-this-buffer' on all notmuch major-mode buffers.
+
+If no-display is non-nil all buffers are silently refreshed, i.e. they are
+not foregrounded to a window if not already displayed. If no-display is nil,
+then each buffer's mode-specific refresh function uses its default behaviour."
+  (dolist (buffer (buffer-list))
+    (let ((buffer-mode (buffer-local-value 'major-mode buffer)))
+      (when (memq buffer-mode '(notmuch-show-mode
+				notmuch-tree-mode
+				notmuch-search-mode
+				notmuch-hello-mode))
+	(with-current-buffer buffer
+	  (notmuch-refresh-this-buffer nil no-display))))))
+
 (defun notmuch-prettify-subject (subject)
   ;; This function is used by `notmuch-search-process-filter' which
   ;; requires that we not disrupt its' matching state.
-- 
2.10.0

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

* Re: [PATCH v4 1/6] emacs: make the refresh code more consistent
  2016-10-08 21:01 ` [PATCH v4 1/6] emacs: make the refresh code more consistent Ioan-Adrian Ratiu
@ 2016-10-09 16:19   ` Tomi Ollila
  0 siblings, 0 replies; 8+ messages in thread
From: Tomi Ollila @ 2016-10-09 16:19 UTC (permalink / raw)
  To: Ioan-Adrian Ratiu, notmuch

On Sun, Oct 09 2016, Ioan-Adrian Ratiu <adi@adirat.com> wrote:

> From: Mark Walters <markwalters1009@gmail.com>
>
> The current refresh code is a little haphazard with some of the
> refresh functions called interactively, and some not. Some of the
> refresh functions take arguments and they aren't consistent.
>
> This makes all the functions have the same form.
> ---
>  emacs/notmuch-hello.el |  2 +-
>  emacs/notmuch-lib.el   | 22 ++++++++++++----------
>  emacs/notmuch-show.el  |  2 +-
>  emacs/notmuch-tree.el  |  5 ++---
>  emacs/notmuch.el       |  2 +-
>  5 files changed, 17 insertions(+), 16 deletions(-)
>
> diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
> index d582bff..97280ca 100644
> --- a/emacs/notmuch-hello.el
> +++ b/emacs/notmuch-hello.el
> @@ -604,7 +604,7 @@ with `notmuch-hello-query-counts'."
>  
>  (defimage notmuch-hello-logo ((:type png :file "notmuch-logo.png")))
>  
> -(defun notmuch-hello-update (&optional no-display)
> +(defun notmuch-hello-update (&optional ignore no-display)

This changes the api but probably it is not dangerous (but if there were
calls (notmuch-hello-update t) from users' own code that would not work
as it used to be (alternative would be (to add) separate function (and noise))

I looked the following patches and those makes the changes here better to
understand (and imo some things nicer).

I can live with these changesets applied (and that one api changed),
provided that Mark who has been more involved looking the previous
changes approve these…

Tomi

>    "Update the current notmuch view."
>    ;; Lazy - rebuild everything.
>    (notmuch-hello no-display))
> diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
> index b2cdace..2d27e56 100644
> --- a/emacs/notmuch-lib.el
> +++ b/emacs/notmuch-lib.el
> @@ -410,23 +410,25 @@ of its command symbol."
>        (pop-to-buffer (help-buffer)))))
>  
>  (defvar notmuch-buffer-refresh-function nil
> -  "Function to call to refresh the current buffer.")
> +  "Function to call to refresh the current buffer.
> +
> +It will be called with two arguments: the first is the prefix
> +argument when notmuch-refresh-this-buffer is called
> +interactively, the second requests that the refresh call not
> +display the buffer.")
>  (make-variable-buffer-local 'notmuch-buffer-refresh-function)
>  
> -(defun notmuch-refresh-this-buffer ()
> +(defun notmuch-refresh-this-buffer (prefix)
>    "Refresh the current buffer."
> -  (interactive)
> +  (interactive "P")
>    (when notmuch-buffer-refresh-function
> -    (if (commandp notmuch-buffer-refresh-function)
> -	;; Pass prefix argument, etc.
> -	(call-interactively notmuch-buffer-refresh-function)
> -      (funcall notmuch-buffer-refresh-function))))
> +    (funcall notmuch-buffer-refresh-function prefix)))
>  
> -(defun notmuch-poll-and-refresh-this-buffer ()
> +(defun notmuch-poll-and-refresh-this-buffer (prefix)
>    "Invoke `notmuch-poll' to import mail, then refresh the current buffer."
> -  (interactive)
> +  (interactive "P")
>    (notmuch-poll)
> -  (notmuch-refresh-this-buffer))
> +  (notmuch-refresh-this-buffer prefix))
>  
>  (defun notmuch-prettify-subject (subject)
>    ;; This function is used by `notmuch-search-process-filter' which
> diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
> index f2487ab..1772d10 100644
> --- a/emacs/notmuch-show.el
> +++ b/emacs/notmuch-show.el
> @@ -1358,7 +1358,7 @@ This includes:
>      ;; Go to the previously open message.
>      (notmuch-show-goto-message current)))
>  
> -(defun notmuch-show-refresh-view (&optional reset-state)
> +(defun notmuch-show-refresh-view (&optional reset-state ignore)
>    "Refresh the current view.
>  
>  Refreshes the current view, observing changes in display
> diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el
> index 1555812..c347712 100644
> --- a/emacs/notmuch-tree.el
> +++ b/emacs/notmuch-tree.el
> @@ -271,7 +271,6 @@ FUNC."
>      (define-key map "x" 'notmuch-tree-quit)
>      (define-key map "A" 'notmuch-tree-archive-thread)
>      (define-key map "a" 'notmuch-tree-archive-message-then-next)
> -    (define-key map "=" 'notmuch-tree-refresh-view)
>      (define-key map "z" 'notmuch-tree-to-tree)
>      (define-key map "n" 'notmuch-tree-next-matching-message)
>      (define-key map "p" 'notmuch-tree-prev-matching-message)
> @@ -571,9 +570,9 @@ message will be \"unarchived\", i.e. the tag changes in
>    (when (window-live-p notmuch-tree-message-window)
>      (notmuch-tree-show-message-in)))
>  
> -(defun notmuch-tree-refresh-view ()
> +(defun notmuch-tree-refresh-view (&rest ignore)
>    "Refresh view."
> -  (interactive)
> +  (interactive "P")
>    (let ((inhibit-read-only t)
>  	(basic-query notmuch-tree-basic-query)
>  	(query-context notmuch-tree-query-context)
> diff --git a/emacs/notmuch.el b/emacs/notmuch.el
> index 888672b..ee1bb54 100644
> --- a/emacs/notmuch.el
> +++ b/emacs/notmuch.el
> @@ -982,7 +982,7 @@ the configured default sort order."
>  	  (set-process-query-on-exit-flag proc nil))))
>      (run-hooks 'notmuch-search-hook)))
>  
> -(defun notmuch-search-refresh-view ()
> +(defun notmuch-search-refresh-view (&rest ignore)
>    "Refresh the current view.
>  
>  Kills the current buffer and runs a new search with the same
> -- 
> 2.10.0
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch

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

end of thread, other threads:[~2016-10-09 16:18 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-08 21:01 [PATCH v4 0/6] Add refresh all buffers functionality Ioan-Adrian Ratiu
2016-10-08 21:01 ` [PATCH v4 1/6] emacs: make the refresh code more consistent Ioan-Adrian Ratiu
2016-10-09 16:19   ` Tomi Ollila
2016-10-08 21:01 ` [PATCH v4 2/6] emacs: notmuch-search-refresh-view: reuse buffer Ioan-Adrian Ratiu
2016-10-08 21:01 ` [PATCH v4 3/6] emacs: notmuch-search: add no-display functionality Ioan-Adrian Ratiu
2016-10-08 21:01 ` [PATCH v4 4/6] emacs: notmuch-show: refresh all windows displaying buffer Ioan-Adrian Ratiu
2016-10-08 21:01 ` [PATCH v4 5/6] emacs: add no-display arg to generic refresh functions Ioan-Adrian Ratiu
2016-10-08 21:01 ` [PATCH v4 6/6] emacs: notmuch-lib: add refresh all buffers function Ioan-Adrian Ratiu

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