unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] emacs: make `notmuch-show-open-or-close-all' toggle visibility
@ 2012-01-25  5:25 Pieter Praet
  2012-01-25  6:35 ` David Edmondson
                   ` (9 more replies)
  0 siblings, 10 replies; 22+ messages in thread
From: Pieter Praet @ 2012-01-25  5:25 UTC (permalink / raw)
  To: Notmuch Mail

* emacs/notmuch-show.el (notmuch-show-open-or-close-all):
  Rename to `notmuch-show-toggle-all-messages', and make it toggle
  visibility of all messages based on the visibility of the current
  message, instead of setting visibility based on whether or not a
  prefix arg was supplied.

Same functionality, less effort (reaching for 'C-u' is a pain)...

---
 emacs/notmuch-show.el |   22 ++++++++++++----------
 1 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el
index e6a5b31..2d17f74 100644
--- a/emacs/notmuch-show.el
+++ b/emacs/notmuch-show.el
@@ -1050,8 +1050,8 @@ thread id.  If a prefix is given, crypto processing is toggled."
 	(define-key map "p" 'notmuch-show-previous-open-message)
 	(define-key map (kbd "DEL") 'notmuch-show-rewind)
 	(define-key map " " 'notmuch-show-advance-and-archive)
-	(define-key map (kbd "M-RET") 'notmuch-show-open-or-close-all)
 	(define-key map (kbd "RET") 'notmuch-show-toggle-message)
+	(define-key map (kbd "M-RET") 'notmuch-show-toggle-all-messages)
 	(define-key map "#" 'notmuch-show-print-message)
 	map)
       "Keymap for \"notmuch show\" buffers.")
@@ -1502,16 +1502,18 @@ the result."
      (not (plist-get props :message-visible))))
   (force-window-update))
 
-(defun notmuch-show-open-or-close-all ()
-  "Set the visibility all of the messages in the current thread.
-By default make all of the messages visible. With a prefix
-argument, hide all of the messages."
+(defun notmuch-show-toggle-all-messages ()
+  "Toggle the visibility of all messages in the current thread.
+If the current message is visible, hide all messages -- and vice versa."
   (interactive)
-  (save-excursion
-    (goto-char (point-min))
-    (loop do (notmuch-show-message-visible (notmuch-show-get-message-properties)
-					   (not current-prefix-arg))
-	  until (not (notmuch-show-goto-message-next))))
+  (let ((toggle (notmuch-show-message-visible-p)))
+    (save-excursion
+      (goto-char (point-min))
+      (loop do (notmuch-show-message-visible
+		(notmuch-show-get-message-properties)
+		(not toggle))
+	    until (not (notmuch-show-goto-message-next)))))
+  (recenter-top-bottom 1)
   (force-window-update))
 
 (defun notmuch-show-next-button ()
-- 
1.7.8.1

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

end of thread, other threads:[~2012-10-20 20:41 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-01-25  5:25 [PATCH] emacs: make `notmuch-show-open-or-close-all' toggle visibility Pieter Praet
2012-01-25  6:35 ` David Edmondson
2012-01-25 13:03   ` Tomi Ollila
2012-01-26 13:02   ` Pieter Praet
2012-01-26 15:04     ` David Edmondson
2012-01-26 15:58 ` Tomi Ollila
2012-02-13 10:51 ` Dmitry Kurochkin
2012-02-22 18:41   ` Pieter Praet
2012-02-22 18:43 ` [PATCH v2 1/7] test: emacs: new tests "notmuch-show: {show, hide} message headers" Pieter Praet
2012-10-20 20:40   ` David Bremner
2012-02-22 18:43 ` [PATCH v2 2/7] test: emacs: new tests "notmuch-show: {, un}collapse all messages in thread" Pieter Praet
2012-02-22 18:43 ` [PATCH v2 3/7] emacs: rename `notmuch-show-toggle-headers' to `notmuch-show-toggle-visibility-headers' Pieter Praet
2012-10-12 21:36   ` Ethan Glasser-Camp
2012-10-18  0:29     ` Ethan Glasser-Camp
2012-10-18  9:47       ` Tomi Ollila
2012-10-18  9:50       ` Tomi Ollila
2012-10-18 13:37         ` Ethan
2012-10-18 13:59           ` Tomi Ollila
2012-02-22 18:43 ` [PATCH v2 4/7] emacs: rename `notmuch-show-toggle-message' to `notmuch-show-toggle-visibility-message' Pieter Praet
2012-02-22 18:43 ` [PATCH v2 5/7] emacs: rename `notmuch-show-open-or-close-all' to `notmuch-show-toggle-visibility-messages' Pieter Praet
2012-02-22 18:43 ` [PATCH v2 6/7] emacs: make `notmuch-show-toggle-visibility-messages' live up to its new name Pieter Praet
2012-02-22 18:43 ` [PATCH v2 7/7] emacs: `notmuch-show-toggle-visibility-messages' with prefix arg filters by tag Pieter Praet

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