unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH v6 0/8] Add refresh all buffers functionality
@ 2016-10-15  7:32 Mark Walters
  2016-10-15  7:32 ` [PATCH v6 1/8] emacs: tree: make refresh use generic binding Mark Walters
                   ` (8 more replies)
  0 siblings, 9 replies; 11+ messages in thread
From: Mark Walters @ 2016-10-15  7:32 UTC (permalink / raw)
  To: notmuch

Version 5 of this set is at
id:1476045223-5238-1-git-send-email-markwalters1009@gmail.com

The changes from the previous version fix Tomi's comments (give an
error if the refresh function is non-interactive rather than failing
silently, and making the refresh-all-buffers function interactive).

I also added a global keybinding of M-= for the refresh all buffers
function. I can see this being useful if you are away from your
computer for some time, you just press M-= and all your already open
buffers are not up to date. 

We could similarly add M-G for poll and refresh all buffers. Do people
have any thoughts on that? It would be a trivial followup patch.

The interdiff is below (except the added interactive in
notmuch-refresh-all-buffers is missing in the interdiff)

Best wishes

Mark



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

Mark Walters (4):
  emacs: tree: make refresh use generic binding
  emacs: make the refresh functions more consistent
  emacs: hello: stop update from forcing the buffer to be displayed
  emacs: add global keybinding M-= for refresh all buffers

 emacs/notmuch-hello.el |  7 ++++---
 emacs/notmuch-lib.el   | 22 ++++++++++++++++++----
 emacs/notmuch-show.el  | 19 +++++++++++++------
 emacs/notmuch-tree.el  |  1 -
 emacs/notmuch.el       | 16 +++++++++++-----
 5 files changed, 46 insertions(+), 19 deletions(-)


diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
index 388abdb..1f0d167 100644
--- a/emacs/notmuch-lib.el
+++ b/emacs/notmuch-lib.el
@@ -151,6 +151,7 @@ For example, if you wanted to remove an \"inbox\" tag and add an
     (define-key map "z" 'notmuch-tree)
     (define-key map "m" 'notmuch-mua-new-mail)
     (define-key map "=" 'notmuch-refresh-this-buffer)
+    (define-key map (kbd "M-=") 'notmuch-refresh-all-buffers)
     (define-key map "G" 'notmuch-poll-and-refresh-this-buffer)
     (define-key map "j" 'notmuch-jump-search)
     map)
@@ -410,21 +411,15 @@ of its command symbol."
       (pop-to-buffer (help-buffer)))))
 
 (defvar notmuch-buffer-refresh-function nil
-  "Function to call to refresh the current buffer.
-
-The function should be interactive.")
+  "Function to call to refresh the current buffer.")
 (make-variable-buffer-local 'notmuch-buffer-refresh-function)
 
 (defun notmuch-refresh-this-buffer ()
   "Refresh the current buffer."
   (interactive)
   (when notmuch-buffer-refresh-function
-    (if (and (commandp notmuch-buffer-refresh-function)
-	     (functionp notmuch-buffer-refresh-function))
-	;; Pass prefix argument, etc.
-	(call-interactively notmuch-buffer-refresh-function)
-      (error "%s is not an interactive function"
-	     notmuch-buffer-refresh-function))))
+    ;; Pass prefix argument, etc.
+    (call-interactively notmuch-buffer-refresh-function)))
 
 (defun notmuch-poll-and-refresh-this-buffer ()
   "Invoke `notmuch-poll' to import mail, then refresh the current buffer."

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

* [PATCH v6 1/8] emacs: tree: make refresh use generic binding
  2016-10-15  7:32 [PATCH v6 0/8] Add refresh all buffers functionality Mark Walters
@ 2016-10-15  7:32 ` Mark Walters
  2016-10-15  7:32 ` [PATCH v6 2/8] emacs: make the refresh functions more consistent Mark Walters
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: Mark Walters @ 2016-10-15  7:32 UTC (permalink / raw)
  To: notmuch

Not using the generic binding is an anomaly from when tree was in
contrib (as pick).
---
 emacs/notmuch-tree.el | 1 -
 1 file changed, 1 deletion(-)

diff --git a/emacs/notmuch-tree.el b/emacs/notmuch-tree.el
index 1555812..d5587a9 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)
-- 
2.1.4

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

* [PATCH v6 2/8] emacs: make the refresh functions more consistent
  2016-10-15  7:32 [PATCH v6 0/8] Add refresh all buffers functionality Mark Walters
  2016-10-15  7:32 ` [PATCH v6 1/8] emacs: tree: make refresh use generic binding Mark Walters
@ 2016-10-15  7:32 ` Mark Walters
  2016-10-15  7:32 ` [PATCH v6 3/8] emacs: hello: stop update from forcing the buffer to be displayed Mark Walters
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: Mark Walters @ 2016-10-15  7:32 UTC (permalink / raw)
  To: notmuch

The different refreshed functions were called differently: some were
called interactively and some were not. Make them all interactive.
---
 emacs/notmuch-hello.el | 1 +
 emacs/notmuch-lib.el   | 6 ++----
 emacs/notmuch.el       | 1 +
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index d582bff..089a19d 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -607,6 +607,7 @@ with `notmuch-hello-query-counts'."
 (defun notmuch-hello-update (&optional no-display)
   "Update the current notmuch view."
   ;; Lazy - rebuild everything.
+  (interactive)
   (notmuch-hello no-display))
 
 (defun notmuch-hello-window-configuration-change ()
diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
index b2cdace..56dd366 100644
--- a/emacs/notmuch-lib.el
+++ b/emacs/notmuch-lib.el
@@ -417,10 +417,8 @@ of its command symbol."
   "Refresh the current buffer."
   (interactive)
   (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))))
+    ;; Pass prefix argument, etc.
+    (call-interactively notmuch-buffer-refresh-function)))
 
 (defun notmuch-poll-and-refresh-this-buffer ()
   "Invoke `notmuch-poll' to import mail, then refresh the current buffer."
diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 6c36ad8..673811c 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -991,6 +991,7 @@ 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
 same relative position within the new buffer."
+  (interactive)
   (let ((target-line (line-number-at-pos))
 	(oldest-first notmuch-search-oldest-first)
 	(target-thread (notmuch-search-find-thread-id 'bare))
-- 
2.1.4

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

* [PATCH v6 3/8] emacs: hello: stop update from forcing the buffer to be displayed
  2016-10-15  7:32 [PATCH v6 0/8] Add refresh all buffers functionality Mark Walters
  2016-10-15  7:32 ` [PATCH v6 1/8] emacs: tree: make refresh use generic binding Mark Walters
  2016-10-15  7:32 ` [PATCH v6 2/8] emacs: make the refresh functions more consistent Mark Walters
@ 2016-10-15  7:32 ` Mark Walters
  2016-10-15  7:32 ` [PATCH v6 4/8] emacs: notmuch-search: add no-display functionality Mark Walters
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: Mark Walters @ 2016-10-15  7:32 UTC (permalink / raw)
  To: notmuch

Make the notmuch-hello refresh function (notmuch-hello-update) not
force the buffer to be displayed. All the callers call it when the
buffer is already displayed so it will only affect non-interactive
callers. Since it is just a trivial wrapper of notmuch-hello anyone
who wants to force the buffer to be displayed should just call
notmuch-hello.
---
 emacs/notmuch-hello.el | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/emacs/notmuch-hello.el b/emacs/notmuch-hello.el
index 089a19d..c858a20 100644
--- a/emacs/notmuch-hello.el
+++ b/emacs/notmuch-hello.el
@@ -604,11 +604,11 @@ with `notmuch-hello-query-counts'."
 
 (defimage notmuch-hello-logo ((:type png :file "notmuch-logo.png")))
 
-(defun notmuch-hello-update (&optional no-display)
-  "Update the current notmuch view."
+(defun notmuch-hello-update ()
+  "Update the notmuch-hello buffer."
   ;; Lazy - rebuild everything.
   (interactive)
-  (notmuch-hello no-display))
+  (notmuch-hello t))
 
 (defun notmuch-hello-window-configuration-change ()
   "Hook function to update the hello buffer when it is switched to."
-- 
2.1.4

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

* [PATCH v6 4/8] emacs: notmuch-search: add no-display functionality
  2016-10-15  7:32 [PATCH v6 0/8] Add refresh all buffers functionality Mark Walters
                   ` (2 preceding siblings ...)
  2016-10-15  7:32 ` [PATCH v6 3/8] emacs: hello: stop update from forcing the buffer to be displayed Mark Walters
@ 2016-10-15  7:32 ` Mark Walters
  2016-10-15  7:32 ` [PATCH v6 5/8] emacs: notmuch-search-refresh-view: reuse buffer Mark Walters
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: Mark Walters @ 2016-10-15  7:32 UTC (permalink / raw)
  To: notmuch

From: Ioan-Adrian Ratiu <adi@adirat.com>

If no-display is non-nil when calling notmuch-search then do not force
the search buffer to be displayed.

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

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 673811c..8f0053c 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -926,7 +926,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.
@@ -937,6 +937,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."
@@ -950,7 +953,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)
-- 
2.1.4

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

* [PATCH v6 5/8] emacs: notmuch-search-refresh-view: reuse buffer
  2016-10-15  7:32 [PATCH v6 0/8] Add refresh all buffers functionality Mark Walters
                   ` (3 preceding siblings ...)
  2016-10-15  7:32 ` [PATCH v6 4/8] emacs: notmuch-search: add no-display functionality Mark Walters
@ 2016-10-15  7:32 ` Mark Walters
  2016-10-15  7:32 ` [PATCH v6 6/8] emacs: notmuch-show: refresh all windows displaying buffer Mark Walters
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: Mark Walters @ 2016-10-15  7:32 UTC (permalink / raw)
  To: notmuch

From: Ioan-Adrian Ratiu <adi@adirat.com>

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 | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/emacs/notmuch.el b/emacs/notmuch.el
index 8f0053c..079a3d1 100644
--- a/emacs/notmuch.el
+++ b/emacs/notmuch.el
@@ -991,7 +991,7 @@ the configured default sort order."
 (defun notmuch-search-refresh-view ()
   "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
@@ -1001,8 +1001,8 @@ same relative position within the new buffer."
 	(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)
-    (notmuch-search query oldest-first target-thread target-line)
+    ;; notmuch-search erases the current buffer.
+    (notmuch-search query oldest-first target-thread target-line t)
     (goto-char (point-min))))
 
 (defun notmuch-search-toggle-order ()
-- 
2.1.4

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

* [PATCH v6 6/8] emacs: notmuch-show: refresh all windows displaying buffer
  2016-10-15  7:32 [PATCH v6 0/8] Add refresh all buffers functionality Mark Walters
                   ` (4 preceding siblings ...)
  2016-10-15  7:32 ` [PATCH v6 5/8] emacs: notmuch-search-refresh-view: reuse buffer Mark Walters
@ 2016-10-15  7:32 ` Mark Walters
  2016-10-15  7:32 ` [PATCH v6 7/8] emacs: notmuch-lib: add refresh all buffers function Mark Walters
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 11+ messages in thread
From: Mark Walters @ 2016-10-15  7:32 UTC (permalink / raw)
  To: notmuch

From: Ioan-Adrian Ratiu <adi@adirat.com>

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 f2487ab..ac7eb77 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)
   "Refresh the current view.
-- 
2.1.4

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

* [PATCH v6 7/8] emacs: notmuch-lib: add refresh all buffers function
  2016-10-15  7:32 [PATCH v6 0/8] Add refresh all buffers functionality Mark Walters
                   ` (5 preceding siblings ...)
  2016-10-15  7:32 ` [PATCH v6 6/8] emacs: notmuch-show: refresh all windows displaying buffer Mark Walters
@ 2016-10-15  7:32 ` Mark Walters
  2016-10-15  7:32 ` [PATCH v6 8/8] emacs: add global keybinding M-= for refresh all buffers Mark Walters
  2016-10-16 16:20 ` [PATCH v6 0/8] Add refresh all buffers functionality Tomi Ollila
  8 siblings, 0 replies; 11+ messages in thread
From: Mark Walters @ 2016-10-15  7:32 UTC (permalink / raw)
  To: notmuch

From: Ioan-Adrian Ratiu <adi@adirat.com>

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

Since the earlier changesets have stopped the refresh functions from
forcing the buffers to be redisplayed this can refresh buffers that
are not currently displayed without disturbing the user.  This 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 56dd366..7cb1169 100644
--- a/emacs/notmuch-lib.el
+++ b/emacs/notmuch-lib.el
@@ -426,6 +426,21 @@ of its command symbol."
   (notmuch-poll)
   (notmuch-refresh-this-buffer))
 
+(defun notmuch-refresh-all-buffers ()
+  "Invoke `notmuch-refresh-this-buffer' on all notmuch major-mode buffers.
+
+The buffers are silently refreshed, i.e. they are not forced to
+be displayed."
+  (interactive)
+  (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))))))
+
 (defun notmuch-prettify-subject (subject)
   ;; This function is used by `notmuch-search-process-filter' which
   ;; requires that we not disrupt its' matching state.
-- 
2.1.4

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

* [PATCH v6 8/8] emacs: add global keybinding M-= for refresh all buffers
  2016-10-15  7:32 [PATCH v6 0/8] Add refresh all buffers functionality Mark Walters
                   ` (6 preceding siblings ...)
  2016-10-15  7:32 ` [PATCH v6 7/8] emacs: notmuch-lib: add refresh all buffers function Mark Walters
@ 2016-10-15  7:32 ` Mark Walters
  2016-10-17 12:17   ` David Bremner
  2016-10-16 16:20 ` [PATCH v6 0/8] Add refresh all buffers functionality Tomi Ollila
  8 siblings, 1 reply; 11+ messages in thread
From: Mark Walters @ 2016-10-15  7:32 UTC (permalink / raw)
  To: notmuch

We can't use c-u = as some of the notmuch-show refresh function
already uses that. This is a global keybinding for a relatively
infrequent function but M-= seems unlikely to cause conflicts.
---
 emacs/notmuch-lib.el | 1 +
 1 file changed, 1 insertion(+)

diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
index 7cb1169..1f0d167 100644
--- a/emacs/notmuch-lib.el
+++ b/emacs/notmuch-lib.el
@@ -151,6 +151,7 @@ For example, if you wanted to remove an \"inbox\" tag and add an
     (define-key map "z" 'notmuch-tree)
     (define-key map "m" 'notmuch-mua-new-mail)
     (define-key map "=" 'notmuch-refresh-this-buffer)
+    (define-key map (kbd "M-=") 'notmuch-refresh-all-buffers)
     (define-key map "G" 'notmuch-poll-and-refresh-this-buffer)
     (define-key map "j" 'notmuch-jump-search)
     map)
-- 
2.1.4

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

* Re: [PATCH v6 0/8] Add refresh all buffers functionality
  2016-10-15  7:32 [PATCH v6 0/8] Add refresh all buffers functionality Mark Walters
                   ` (7 preceding siblings ...)
  2016-10-15  7:32 ` [PATCH v6 8/8] emacs: add global keybinding M-= for refresh all buffers Mark Walters
@ 2016-10-16 16:20 ` Tomi Ollila
  8 siblings, 0 replies; 11+ messages in thread
From: Tomi Ollila @ 2016-10-16 16:20 UTC (permalink / raw)
  To: Mark Walters, notmuch

On Sat, Oct 15 2016, Mark Walters <markwalters1009@gmail.com> wrote:

> Version 5 of this set is at
> id:1476045223-5238-1-git-send-email-markwalters1009@gmail.com
>
> The changes from the previous version fix Tomi's comments (give an
> error if the refresh function is non-interactive rather than failing
> silently, and making the refresh-all-buffers function interactive).
>
> I also added a global keybinding of M-= for the refresh all buffers
> function. I can see this being useful if you are away from your
> computer for some time, you just press M-= and all your already open
> buffers are not up to date. 
>
> We could similarly add M-G for poll and refresh all buffers. Do people
> have any thoughts on that? It would be a trivial followup patch.
>
> The interdiff is below (except the added interactive in
> notmuch-refresh-all-buffers is missing in the interdiff)
>
> Best wishes

looks good to me and seems to work. +1

>
> Mark
>
>
>
> Ioan-Adrian Ratiu (4):
>   emacs: notmuch-search: add no-display functionality
>   emacs: notmuch-search-refresh-view: reuse buffer
>   emacs: notmuch-show: refresh all windows displaying buffer
>   emacs: notmuch-lib: add refresh all buffers function
>
> Mark Walters (4):
>   emacs: tree: make refresh use generic binding
>   emacs: make the refresh functions more consistent
>   emacs: hello: stop update from forcing the buffer to be displayed
>   emacs: add global keybinding M-= for refresh all buffers
>
>  emacs/notmuch-hello.el |  7 ++++---
>  emacs/notmuch-lib.el   | 22 ++++++++++++++++++----
>  emacs/notmuch-show.el  | 19 +++++++++++++------
>  emacs/notmuch-tree.el  |  1 -
>  emacs/notmuch.el       | 16 +++++++++++-----
>  5 files changed, 46 insertions(+), 19 deletions(-)
>
>
> diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
> index 388abdb..1f0d167 100644
> --- a/emacs/notmuch-lib.el
> +++ b/emacs/notmuch-lib.el
> @@ -151,6 +151,7 @@ For example, if you wanted to remove an \"inbox\" tag and add an
>      (define-key map "z" 'notmuch-tree)
>      (define-key map "m" 'notmuch-mua-new-mail)
>      (define-key map "=" 'notmuch-refresh-this-buffer)
> +    (define-key map (kbd "M-=") 'notmuch-refresh-all-buffers)
>      (define-key map "G" 'notmuch-poll-and-refresh-this-buffer)
>      (define-key map "j" 'notmuch-jump-search)
>      map)
> @@ -410,21 +411,15 @@ of its command symbol."
>        (pop-to-buffer (help-buffer)))))
>  
>  (defvar notmuch-buffer-refresh-function nil
> -  "Function to call to refresh the current buffer.
> -
> -The function should be interactive.")
> +  "Function to call to refresh the current buffer.")
>  (make-variable-buffer-local 'notmuch-buffer-refresh-function)
>  
>  (defun notmuch-refresh-this-buffer ()
>    "Refresh the current buffer."
>    (interactive)
>    (when notmuch-buffer-refresh-function
> -    (if (and (commandp notmuch-buffer-refresh-function)
> -	     (functionp notmuch-buffer-refresh-function))
> -	;; Pass prefix argument, etc.
> -	(call-interactively notmuch-buffer-refresh-function)
> -      (error "%s is not an interactive function"
> -	     notmuch-buffer-refresh-function))))
> +    ;; Pass prefix argument, etc.
> +    (call-interactively notmuch-buffer-refresh-function)))
>  
>  (defun notmuch-poll-and-refresh-this-buffer ()
>    "Invoke `notmuch-poll' to import mail, then refresh the current buffer."
>
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> https://notmuchmail.org/mailman/listinfo/notmuch

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

* Re: [PATCH v6 8/8] emacs: add global keybinding M-= for refresh all buffers
  2016-10-15  7:32 ` [PATCH v6 8/8] emacs: add global keybinding M-= for refresh all buffers Mark Walters
@ 2016-10-17 12:17   ` David Bremner
  0 siblings, 0 replies; 11+ messages in thread
From: David Bremner @ 2016-10-17 12:17 UTC (permalink / raw)
  To: Mark Walters, notmuch

Mark Walters <markwalters1009@gmail.com> writes:

> We can't use c-u = as some of the notmuch-show refresh function
> already uses that. This is a global keybinding for a relatively
> infrequent function but M-= seems unlikely to cause conflicts.
> ---
>  emacs/notmuch-lib.el | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/emacs/notmuch-lib.el b/emacs/notmuch-lib.el
> index 7cb1169..1f0d167 100644
> --- a/emacs/notmuch-lib.el
> +++ b/emacs/notmuch-lib.el
> @@ -151,6 +151,7 @@ For example, if you wanted to remove an \"inbox\" tag and add an
>      (define-key map "z" 'notmuch-tree)
>      (define-key map "m" 'notmuch-mua-new-mail)
>      (define-key map "=" 'notmuch-refresh-this-buffer)
> +    (define-key map (kbd "M-=") 'notmuch-refresh-all-buffers)
>      (define-key map "G" 'notmuch-poll-and-refresh-this-buffer)
>      (define-key map "j" 'notmuch-jump-search)
>      map)

Series pushed to master.

d

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

end of thread, other threads:[~2016-10-17 12:17 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-15  7:32 [PATCH v6 0/8] Add refresh all buffers functionality Mark Walters
2016-10-15  7:32 ` [PATCH v6 1/8] emacs: tree: make refresh use generic binding Mark Walters
2016-10-15  7:32 ` [PATCH v6 2/8] emacs: make the refresh functions more consistent Mark Walters
2016-10-15  7:32 ` [PATCH v6 3/8] emacs: hello: stop update from forcing the buffer to be displayed Mark Walters
2016-10-15  7:32 ` [PATCH v6 4/8] emacs: notmuch-search: add no-display functionality Mark Walters
2016-10-15  7:32 ` [PATCH v6 5/8] emacs: notmuch-search-refresh-view: reuse buffer Mark Walters
2016-10-15  7:32 ` [PATCH v6 6/8] emacs: notmuch-show: refresh all windows displaying buffer Mark Walters
2016-10-15  7:32 ` [PATCH v6 7/8] emacs: notmuch-lib: add refresh all buffers function Mark Walters
2016-10-15  7:32 ` [PATCH v6 8/8] emacs: add global keybinding M-= for refresh all buffers Mark Walters
2016-10-17 12:17   ` David Bremner
2016-10-16 16:20 ` [PATCH v6 0/8] Add refresh all buffers functionality Tomi Ollila

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