unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Kan-Ru Chen <kanru@kanru.info>
To: notmuch@notmuchmail.org
Subject: [PATCH 2/3] notmuch.el: Add collapse all and expand all to notmuch-show
Date: Tue,  1 Dec 2009 14:17:32 +0800	[thread overview]
Message-ID: <1259648253-31034-2-git-send-email-kanru@kanru.info> (raw)
In-Reply-To: <1259648033-30653-1-git-send-email-kanru@kanru.info>

These two functions behave like gmail's collapse all and expand all
commands. notmuch-show-collapse-all is bound to 'B' but
notmuch-show-expand-all has no keybindig because I thought it is not often
used.

Signed-off-by: Kan-Ru Chen <kanru@kanru.info>
---
 notmuch.el |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/notmuch.el b/notmuch.el
index 2526020..5b8513c 100644
--- a/notmuch.el
+++ b/notmuch.el
@@ -63,6 +63,7 @@
     (define-key map "a" 'notmuch-show-archive-thread)
     (define-key map "A" 'notmuch-show-mark-read-then-archive-thread)
     (define-key map "b" 'notmuch-show-toggle-current-body)
+    (define-key map "B" 'notmuch-show-collapse-all)
     (define-key map "f" 'notmuch-show-forward-current)
     (define-key map "h" 'notmuch-show-toggle-current-header)
     (define-key map "m" 'message-mail)
@@ -582,6 +583,30 @@ which this thread was originally shown."
     (push-button))
   )
 
+(defun notmuch-show-collapse-all ()
+  (interactive)
+  (save-excursion
+    (beginning-of-buffer)
+    (while (not (notmuch-show-last-message-p))
+      (unless (button-at (point))
+        (notmuch-show-next-button))
+      (let ((invis-spec (button-get (button-at (point)) 'invisibility-spec)))
+        (add-to-invisibility-spec invis-spec))
+      (notmuch-show-next-open-message)
+      )))
+
+(defun notmuch-show-expand-all ()
+  (interactive)
+  (save-excursion
+    (beginning-of-buffer)
+    (while (not (notmuch-show-last-message-p))
+      (unless (button-at (point))
+        (notmuch-show-next-button))
+      (let ((invis-spec (button-get (button-at (point)) 'invisibility-spec)))
+        (remove-from-invisibility-spec invis-spec))
+      (notmuch-show-next-message)
+      )))
+
 (define-button-type 'notmuch-button-invisibility-toggle-type 'action 'notmuch-toggle-invisible-action 'follow-link t)
 (define-button-type 'notmuch-button-citation-toggle-type 'help-echo "mouse-1, RET: Show citation"
   :supertype 'notmuch-button-invisibility-toggle-type)
-- 
1.6.5.3

  parent reply	other threads:[~2009-12-01  6:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-01  6:13 [PATCH 1/3] notmuch.el: Add keybinding to toggle display of message body and headers Kan-Ru Chen
     [not found] ` <1259648033-30653-2-git-send-email-kanru@kanru.info>
2009-12-01  6:13   ` [PATCH 3/3] notmuch.el: Use emacs built-in forward-button and backward-button Kan-Ru Chen
2010-02-05 19:45     ` Carl Worth
2009-12-01  6:17 ` Kan-Ru Chen [this message]
2010-02-05 19:45   ` [PATCH 2/3] notmuch.el: Add collapse all and expand all to notmuch-show Carl Worth
2010-02-05 19:32 ` [PATCH 1/3] notmuch.el: Add keybinding to toggle display of message body and headers Carl Worth

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=1259648253-31034-2-git-send-email-kanru@kanru.info \
    --to=kanru@kanru.info \
    --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).