unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Mark Walters <markwalters1009@gmail.com>
To: notmuch@notmuchmail.org
Subject: [PATCH] emacs: make the refresh code more consistent
Date: Thu,  6 Oct 2016 22:42:02 +0100	[thread overview]
Message-ID: <1475790122-21539-1-git-send-email-markwalters1009@gmail.com> (raw)
In-Reply-To: <87twcpb3dq.fsf@adiPC.i-did-not-set--mail-host-address--so-tickle-me>

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

This might be a sensible change to make before the series
id:20161006134227.17194-1-adi@adirat.com (or merge into that series).

I think the refresh functions should all be called non-interactively
as that will make it easier to pass arguments, and they should also
take the same arguments (though they can feel free to ignore them).

Best wishes

Mark


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

  reply	other threads:[~2016-10-06 21:42 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-06 13:42 [PATCH v3 0/4] Add refresh all buffers functionality Ioan-Adrian Ratiu
2016-10-06 13:42 ` [PATCH v3 1/4] emacs: reuse buffer when refreshing searches Ioan-Adrian Ratiu
2016-10-06 13:42 ` [PATCH v3 2/4] emacs: notmuch-show: refresh all windows showing a buffer Ioan-Adrian Ratiu
2016-10-06 13:42 ` [PATCH v3 3/4] emacs: add refresh buffer optional no-display arg Ioan-Adrian Ratiu
2016-10-06 17:24   ` Mark Walters
2016-10-06 20:59     ` Ioan-Adrian Ratiu
2016-10-06 21:42       ` Mark Walters [this message]
2016-10-07 14:49         ` [PATCH] emacs: make the refresh code more consistent Ioan-Adrian Ratiu
2016-10-06 13:42 ` [PATCH v3 4/4] emacs: notmuch-lib: add refresh all buffers function Ioan-Adrian Ratiu

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=1475790122-21539-1-git-send-email-markwalters1009@gmail.com \
    --to=markwalters1009@gmail.com \
    --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).