unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Austin Clements <amdragon@MIT.EDU>
To: notmuch@notmuchmail.org
Cc: tomi.ollila@iki.fi
Subject: [PATCH v3 2/3] emacs: Reverse the meaning of notmuch-show-refresh-view's argument
Date: Tue, 21 Feb 2012 10:42:32 -0500	[thread overview]
Message-ID: <1329838953-20666-3-git-send-email-amdragon@mit.edu> (raw)
In-Reply-To: <1329838953-20666-1-git-send-email-amdragon@mit.edu>

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@mail.
 test_expect_equal_file OUTPUT EXPECTED
 
 test_begin_subtest "Refresh modified show buffer"
-test_subtest_known_broken
 test_emacs '(notmuch-show "id:f35dbb950911171438k5df6eb56k77b6c0944e2e79ae@mail.gmail.com")
 	    (notmuch-show-toggle-message)
 	    (notmuch-show-next-message)
-- 
1.7.7.3

  parent reply	other threads:[~2012-02-21 15:42 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-19  6:22 [PATCH 0/3] Make notmuch-show-refresh-view retain state by default Austin Clements
2012-02-19  6:22 ` [PATCH 1/3] emacs: Fix out-of-date declare-function Austin Clements
2012-02-19  6:22 ` [PATCH 2/3] emacs: Reverse the meaning of notmuch-show-refresh-view's argument Austin Clements
2012-02-19  6:22 ` [PATCH 3/3] News for retaining state when refreshing notmuch show Austin Clements
2012-02-19  9:43 ` [PATCH 0/3] Make notmuch-show-refresh-view retain state by default Tomi Ollila
2012-02-19 17:25   ` Austin Clements
2012-02-19 17:29     ` Dmitry Kurochkin
2012-02-19 18:03       ` Austin Clements
2012-02-19 17:16 ` Dmitry Kurochkin
2012-02-19 18:02 ` [PATCH v2 0/4] " Austin Clements
2012-02-19 18:02   ` [PATCH v2 1/4] emacs: Fix out-of-date declare-function Austin Clements
2012-02-21  3:09     ` David Bremner
2012-02-19 18:02   ` [PATCH v2 2/4] emacs: When refreshing a show buffer, only mark read when resetting state Austin Clements
2012-02-19 18:02   ` [PATCH v2 3/4] emacs: Reverse the meaning of notmuch-show-refresh-view's argument Austin Clements
2012-02-19 18:02   ` [PATCH v2 4/4] News for retaining state when refreshing notmuch show Austin Clements
2012-02-19 19:01   ` [PATCH v2 0/4] Make notmuch-show-refresh-view retain state by default Austin Clements
2012-02-21 15:42 ` [PATCH v3 0/3] Fix refreshing with state and make it the default Austin Clements
2012-02-21 15:42   ` [PATCH v3 1/3] emacs: When refreshing a show buffer, only mark read when resetting state Austin Clements
2012-02-21 15:42   ` Austin Clements [this message]
2012-02-21 15:42   ` [PATCH v3 3/3] News for retaining state when refreshing notmuch show Austin Clements
2012-02-21 16:34   ` [PATCH v3 0/3] Fix refreshing with state and make it the default Tomi Ollila
2012-02-22 19:37   ` Pieter Praet
2012-02-25 14:39   ` David Bremner

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=1329838953-20666-3-git-send-email-amdragon@mit.edu \
    --to=amdragon@mit.edu \
    --cc=notmuch@notmuchmail.org \
    --cc=tomi.ollila@iki.fi \
    /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).