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 884D1431FD0 for ; Sun, 29 May 2011 01:56:34 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[RCVD_IN_DNSWL_NONE=-0.0001] autolearn=disabled 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 4rsEhS28wGCv for ; Sun, 29 May 2011 01:56:33 -0700 (PDT) Received: from hrndva-omtalb.mail.rr.com (hrndva-omtalb.mail.rr.com [71.74.56.123]) by olra.theworths.org (Postfix) with ESMTP id B0C39431FB6 for ; Sun, 29 May 2011 01:56:33 -0700 (PDT) X-Authority-Analysis: v=1.1 cv=NmbQexcdgr4rtO3OwYGrP5Q3rTMpacrTPhuaXkv4uP8= c=1 sm=0 a=E-klbLaLA44A:10 a=8YMtuzaJ5FE3wtSInqJrPg==:17 a=ncDVm-j7AAAA:8 a=2PeZjLzq-K_LnB-q7ZMA:9 a=77gGT1gBv2MC1DDIb3YA:7 a=1TAlIYiSTWAA:10 a=8YMtuzaJ5FE3wtSInqJrPg==:117 X-Cloudmark-Score: 0 X-Originating-IP: 76.175.234.46 Received: from [76.175.234.46] ([76.175.234.46:57221] helo=localhost.localdomain) by hrndva-oedge01.mail.rr.com (envelope-from ) (ecelerity 2.2.3.46 r()) with ESMTP id D3/9C-08391-04A02ED4; Sun, 29 May 2011 08:56:33 +0000 From: notmuch@dima.secretsauce.net To: notmuch@notmuchmail.org Subject: [PATCH] added keys to hide/show a portion of the thread Date: Sun, 29 May 2011 01:56:44 -0700 Message-Id: <1306659404-21840-1-git-send-email-notmuch@dima.secretsauce.net> X-Mailer: git-send-email 1.7.5.3 X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 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: Sun, 29 May 2011 08:56:34 -0000 From: Dima Kogan --- Here's another improvement. In the notmuch-show display this binds '[' to expand all the children messages (replies). Analogously ']' collapses all the children messages. dima emacs/notmuch-show.el | 34 ++++++++++++++++++++++++++++++++++ 1 files changed, 34 insertions(+), 0 deletions(-) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index 2ba151e..600f3ec 100644 --- a/emacs/notmuch-show.el +++ b/emacs/notmuch-show.el @@ -813,6 +813,8 @@ function is used. " (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 "]" 'notmuch-show-hide-hierarchy) + (define-key map "[" 'notmuch-show-show-hierarchy) map) "Keymap for \"notmuch show\" buffers.") (fset 'notmuch-show-mode-map notmuch-show-mode-map) @@ -1266,6 +1268,38 @@ argument, hide all of the messages." until (not (notmuch-show-goto-message-next)))) (force-window-update)) +; get the depth, assuming the point is at the start of the header line +(defun notmuch-show-get-depth () + (save-excursion + (let ((start (point))) + (- (re-search-forward "^ *") start)))) + +(defun notmuch-show-hideshow-hierarchy (doshow) + "Hides or shows this message and all its replies" + (interactive) + (save-excursion + (notmuch-show-move-to-message-top) + + (let ((depth0 (notmuch-show-get-depth))) + (loop do (notmuch-show-message-visible (notmuch-show-get-message-properties) + doshow) + until (or (not (notmuch-show-goto-message-next)) + (<= (notmuch-show-get-depth) depth0)))) + (force-window-update)) +) + +(defun notmuch-show-show-hierarchy () + "Show this message and all its replies" + (interactive) + (notmuch-show-hideshow-hierarchy 1) +) + +(defun notmuch-show-hide-hierarchy () + "Hide this message and all its replies" + (interactive) + (notmuch-show-hideshow-hierarchy nil) +) + (defun notmuch-show-next-button () "Advance point to the next button in the buffer." (interactive) -- 1.7.4.4