[PATCH v2 6/7] emacs: make `notmuch-show-toggle-visibility-messages' live up to its...
authorPieter Praet <pieter@praet.org>
Wed, 22 Feb 2012 18:43:33 +0000 (19:43 +0100)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:44:50 +0000 (09:44 -0800)
3f/e6b1ad88b7ef26860bea6bee63e8d4b4069c61 [new file with mode: 0644]

diff --git a/3f/e6b1ad88b7ef26860bea6bee63e8d4b4069c61 b/3f/e6b1ad88b7ef26860bea6bee63e8d4b4069c61
new file mode 100644 (file)
index 0000000..9d21428
--- /dev/null
@@ -0,0 +1,136 @@
+Return-Path: <pieter@praet.org>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 3319B431FB6\r
+       for <notmuch@notmuchmail.org>; Wed, 22 Feb 2012 10:46:14 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.7\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5\r
+       tests=[RCVD_IN_DNSWL_LOW=-0.7] autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id ZkkXxzZBlZ3l for <notmuch@notmuchmail.org>;\r
+       Wed, 22 Feb 2012 10:46:12 -0800 (PST)\r
+Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com\r
+       [209.85.212.181]) (using TLSv1 with cipher RC4-SHA (128/128 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 7E902431FD2\r
+       for <notmuch@notmuchmail.org>; Wed, 22 Feb 2012 10:45:59 -0800 (PST)\r
+Received: by mail-wi0-f181.google.com with SMTP id hi8so270670wib.26\r
+       for <notmuch@notmuchmail.org>; Wed, 22 Feb 2012 10:45:59 -0800 (PST)\r
+Received-SPF: pass (google.com: domain of pieter@praet.org designates\r
+       10.180.24.202 as permitted sender) client-ip=10.180.24.202; \r
+Authentication-Results: mr.google.com;\r
+       spf=pass (google.com: domain of pieter@praet.org\r
+       designates 10.180.24.202 as permitted sender)\r
+       smtp.mail=pieter@praet.org\r
+Received: from mr.google.com ([10.180.24.202])\r
+       by 10.180.24.202 with SMTP id w10mr37952116wif.9.1329936359244\r
+       (num_hops = 1); Wed, 22 Feb 2012 10:45:59 -0800 (PST)\r
+MIME-Version: 1.0\r
+Received: by 10.180.24.202 with SMTP id w10mr31404498wif.9.1329936359162;\r
+       Wed, 22 Feb 2012 10:45:59 -0800 (PST)\r
+Received: from localhost ([109.131.181.26])\r
+       by mx.google.com with ESMTPS id hs6sm40609002wib.2.2012.02.22.10.45.58\r
+       (version=TLSv1/SSLv3 cipher=OTHER);\r
+       Wed, 22 Feb 2012 10:45:58 -0800 (PST)\r
+From: Pieter Praet <pieter@praet.org>\r
+To: Notmuch Mail <notmuch@notmuchmail.org>\r
+Subject: [PATCH v2 6/7] emacs: make `notmuch-show-toggle-visibility-messages'\r
+       live up to its new name\r
+Date: Wed, 22 Feb 2012 19:43:33 +0100\r
+Message-Id: <1329936214-30959-6-git-send-email-pieter@praet.org>\r
+X-Mailer: git-send-email 1.7.8.1\r
+In-Reply-To: <1327469139-1968-1-git-send-email-pieter@praet.org>\r
+References: <1327469139-1968-1-git-send-email-pieter@praet.org>\r
+X-Gm-Message-State:\r
+ ALoCoQkaA5ifvHffQjlGAqknyHBr56wpptXbG+nSmxTH03vyQJ2OrsVNEN982g+AQzQYjTYfi6G8\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Wed, 22 Feb 2012 18:46:14 -0000\r
+\r
+* emacs/notmuch-show.el (notmuch-show-toggle-visibility-messages):\r
+  Toggle visibility of all messages in current thread based on visibility\r
+  of the current message, instead of setting visibility based on whether\r
+  or not a prefix arg was supplied.\r
+\r
+  Also move current buffer line to the 2nd window line so the current\r
+  message is put properly into focus, whilst making the presence of\r
+  previous messages in the thread obvious.\r
+\r
+Same functionality, less effort (reaching for 'C-u' is a pain)...\r
+---\r
+ emacs/notmuch-show.el |   20 ++++++++++++--------\r
+ test/emacs            |    6 +++---\r
+ 2 files changed, 15 insertions(+), 11 deletions(-)\r
+\r
+diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el\r
+index e4d1f9c..82d4265 100644\r
+--- a/emacs/notmuch-show.el\r
++++ b/emacs/notmuch-show.el\r
+@@ -1669,15 +1669,19 @@ (defun notmuch-show-toggle-visibility-message ()\r
+   (force-window-update))\r
+ \r
+ (defun notmuch-show-toggle-visibility-messages ()\r
+-  "Set the visibility all of the messages in the current thread.\r
+-By default make all of the messages visible. With a prefix\r
+-argument, hide all of the messages."\r
++  "Toggle the visibility of all messages in the current thread.\r
++If the current message is visible, hide all messages -- and vice versa."\r
+   (interactive)\r
+-  (save-excursion\r
+-    (goto-char (point-min))\r
+-    (loop do (notmuch-show-message-visible (notmuch-show-get-message-properties)\r
+-                                         (not current-prefix-arg))\r
+-        until (not (notmuch-show-goto-message-next))))\r
++  (let ((visible-p (notmuch-show-message-visible-p)))\r
++    (notmuch-show-mapc\r
++     (lambda () (notmuch-show-message-visible\r
++               (notmuch-show-get-message-properties)\r
++               (not visible-p)))))\r
++\r
++  ;; Put the current message properly into focus, but don't\r
++  ;; obscure the presence of previous messages in the thread.\r
++  (recenter-top-bottom 1)\r
++\r
+   (force-window-update))\r
+ \r
+ (defun notmuch-show-next-button ()\r
+diff --git a/test/emacs b/test/emacs\r
+index 29fdec0..5c61743 100755\r
+--- a/test/emacs\r
++++ b/test/emacs\r
+@@ -410,14 +410,14 @@ test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-message-with-headers-hidden\r
+ \r
+ test_begin_subtest "notmuch-show: collapse all messages in thread"\r
+ test_emacs '(notmuch-show "id:f35dbb950911171435ieecd458o853c873e35f4be95@mail.gmail.com")\r
+-      (let ((current-prefix-arg t))\r
+-        (notmuch-show-toggle-visibility-messages)\r
+-        (test-visible-output))'\r
++      (notmuch-show-toggle-visibility-messages)\r
++      (test-visible-output)'\r
+ test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-thread-with-all-messages-collapsed\r
+ \r
+ test_begin_subtest "notmuch-show: uncollapse all messages in thread"\r
+ test_emacs '(notmuch-show "id:f35dbb950911171435ieecd458o853c873e35f4be95@mail.gmail.com")\r
+       (notmuch-show-toggle-visibility-messages)\r
++      (notmuch-show-toggle-visibility-messages)\r
+       (test-visible-output)'\r
+ test_expect_equal_file OUTPUT $EXPECTED/notmuch-show-thread-with-all-messages-uncollapsed\r
+ \r
+-- \r
+1.7.8.1\r
+\r