[PATCH v3 2/3] emacs: Reverse the meaning of notmuch-show-refresh-view's argument

Austin Clements amdragon at MIT.EDU
Tue Feb 21 07:42:32 PST 2012


Consensus seems to be that people prefer that refreshing show buffers
retains state by default, rather than resetting it by default.  This
turns out to be the case in the code, as well.  In fact, there's even
a test for this that's been marked broken for several months, which
this patch finally gets to mark as fixed.
---
 emacs/notmuch-crypto.el |    4 ++--
 emacs/notmuch-show.el   |   18 +++++++++---------
 test/emacs              |    1 -
 3 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/emacs/notmuch-crypto.el b/emacs/notmuch-crypto.el
index 972f26e..94da325 100644
--- a/emacs/notmuch-crypto.el
+++ b/emacs/notmuch-crypto.el
@@ -120,7 +120,7 @@ mode."
      :notmuch-from from)
     (insert "\n")))
 
-(declare-function notmuch-show-refresh-view "notmuch-show" (&optional retain-state))
+(declare-function notmuch-show-refresh-view "notmuch-show" (&optional reset-state))
 
 (defun notmuch-crypto-sigstatus-good-callback (button)
   (let* ((sigstatus (button-get button :notmuch-sigstatus))
@@ -145,7 +145,7 @@ mode."
 	(insert "\n")
 	(call-process "gpg" nil t t "--list-keys" keyid))
       (recenter -1))
-    (notmuch-show-refresh-view)))
+    (notmuch-show-refresh-view t)))
 
 (defun notmuch-crypto-insert-encstatus-button (encstatus)
   (let* ((status (plist-get encstatus :status))
diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index f759351..ac9bdbc 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -957,7 +957,7 @@ current buffer, if possible."
   (message (if notmuch-show-process-crypto
 	       "Processing cryptographic MIME parts."
 	     "Not processing cryptographic MIME parts."))
-  (notmuch-show-refresh-view t))
+  (notmuch-show-refresh-view))
 
 (defun notmuch-show-toggle-elide-non-matching ()
   "Toggle the display of non-matching messages."
@@ -966,7 +966,7 @@ current buffer, if possible."
   (message (if notmuch-show-elide-non-matching-messages
 	       "Showing matching messages only."
 	     "Showing all messages."))
-  (notmuch-show-refresh-view t))
+  (notmuch-show-refresh-view))
 
 (defun notmuch-show-toggle-thread-indentation ()
   "Toggle the indentation of threads."
@@ -975,7 +975,7 @@ current buffer, if possible."
   (message (if notmuch-show-indent-content
 	       "Content is indented."
 	     "Content is not indented."))
-  (notmuch-show-refresh-view t))
+  (notmuch-show-refresh-view))
 
 (defun notmuch-show-insert-tree (tree depth)
   "Insert the message tree TREE at depth DEPTH in the current thread."
@@ -1117,17 +1117,17 @@ This includes:
       (message "Previously current message not found."))
     (notmuch-show-message-adjust)))
 
-(defun notmuch-show-refresh-view (&optional retain-state)
+(defun notmuch-show-refresh-view (&optional reset-state)
   "Refresh the current view.
 
 Refreshes the current view, observing changes in display
-preferences. If RETAIN-STATE is non-nil then the state of the
-buffer is stored and re-applied after the refresh."
+preferences. If invoked with a prefix argument (or RESET-STATE is
+non-nil) then the state of the buffer (open/closed messages) is
+reset based on the original query."
   (interactive "P")
   (let ((inhibit-read-only t)
-	state)
-    (if retain-state
-	(setq state (notmuch-show-capture-state)))
+	(state (unless reset-state
+		 (notmuch-show-capture-state))))
     (erase-buffer)
     (notmuch-show-build-buffer)
     (if state
diff --git a/test/emacs b/test/emacs
index b74cfa9..2dffee8 100755
--- a/test/emacs
+++ b/test/emacs
@@ -456,7 +456,6 @@ test_emacs '(notmuch-show "id:f35dbb950911171438k5df6eb56k77b6c0944e2e79ae at mail.
 test_expect_equal_file OUTPUT EXPECTED
 
 test_begin_subtest "Refresh modified show buffer"
-test_subtest_known_broken
 test_emacs '(notmuch-show "id:f35dbb950911171438k5df6eb56k77b6c0944e2e79ae at mail.gmail.com")
 	    (notmuch-show-toggle-message)
 	    (notmuch-show-next-message)
-- 
1.7.7.3



More information about the notmuch mailing list