Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 7BA7E431FBD for ; Mon, 30 Nov 2009 22:18:27 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hqs0cgh-UDPs for ; Mon, 30 Nov 2009 22:18:26 -0800 (PST) Received: from msr12.hinet.net (msr12.hinet.net [168.95.4.112]) by olra.theworths.org (Postfix) with ESMTP id 137BF431FBC for ; Mon, 30 Nov 2009 22:18:25 -0800 (PST) Received: from anar.kanru.info ([203.74.21.24]) by msr12.hinet.net (8.9.3/8.9.3) with ESMTP id OAA00265 for ; Tue, 1 Dec 2009 14:18:22 +0800 (CST) Received: from kanru (uid 1000) (envelope-from kanru@anar.kanru.info) id 1da0 by anar.kanru.info (DragonFly Mail Agent) Tue, 01 Dec 2009 14:18:04 +0800 From: Kan-Ru Chen To: notmuch@notmuchmail.org Date: Tue, 1 Dec 2009 14:17:32 +0800 Message-Id: <1259648253-31034-2-git-send-email-kanru@kanru.info> X-Mailer: git-send-email 1.6.5.3 In-Reply-To: <1259648033-30653-1-git-send-email-kanru@kanru.info> References: <1259648033-30653-1-git-send-email-kanru@kanru.info> Subject: [notmuch] [PATCH 2/3] notmuch.el: Add collapse all and expand all to notmuch-show X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2009 06:18:27 -0000 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 --- 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