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 8086F429E25 for ; Mon, 6 Jun 2011 23:37:30 -0700 (PDT) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -0.7 X-Spam-Level: X-Spam-Status: No, score=-0.7 tagged_above=-999 required=5 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_LOW=-0.7] 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 FMGo6+GB1VVp for ; Mon, 6 Jun 2011 23:37:29 -0700 (PDT) Received: from new1.smtp.messagingengine.com (new1.smtp.messagingengine.com [66.111.4.221]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by olra.theworths.org (Postfix) with ESMTPS id AF565431FB6 for ; Mon, 6 Jun 2011 23:37:29 -0700 (PDT) Received: from compute1.internal (compute1.nyi.mail.srv.osa [10.202.2.41]) by gateway1.messagingengine.com (Postfix) with ESMTP id C7BC62077C for ; Tue, 7 Jun 2011 02:37:28 -0400 (EDT) Received: from frontend2.messagingengine.com ([10.202.2.161]) by compute1.internal (MEProxy); Tue, 07 Jun 2011 02:37:28 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=messagingengine.com; h=date:from:to:subject:message-id:in-reply-to:references:mime-version:content-type; s=smtpout; bh=WT+y3rCVxYGq/HIav8KTE57zgHg=; b=hFu6qjc5ESzeGcSLavQmheRcYvnQQ+WXi3XYXO35E+m3XyYGEQFMslFh8SsKuNnEQGvo5fjL1CdGnmul3DYHyAMm8Dv4nOjZN9hIg8wWg7wWuGwGkl7BaqC5DZNg6MESZeSl0CYiIAwzm62kDs+EzFt+Z3Z2rX67YoZkBYf7vxM= X-Sasl-enc: Cn+/+GEsj/e9VT7Q4VFcgGNgR8sTORiKK/RVJ6N4uEx7 1307428647 Received: from smart (cpe-76-175-234-46.socal.res.rr.com [76.175.234.46]) by mail.messagingengine.com (Postfix) with ESMTPSA id 8547A442101 for ; Tue, 7 Jun 2011 02:37:27 -0400 (EDT) Date: Mon, 6 Jun 2011 23:37:37 -0700 From: Dima Kogan To: notmuch@notmuchmail.org Subject: Re: [PATCH] added keys to hide/show a portion of the thread Message-ID: <20110606233737.417dbb44@smart> In-Reply-To: <1306659404-21840-1-git-send-email-notmuch@dima.secretsauce.net> References: <1306659404-21840-1-git-send-email-notmuch@dima.secretsauce.net> X-Mailer: Claws Mail 3.7.9 (GTK+ 2.24.4; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="MP_/5iQ=vw+=WwAqDiDRsB3sSAx" 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: Tue, 07 Jun 2011 06:37:30 -0000 --MP_/5iQ=vw+=WwAqDiDRsB3sSAx Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline > On Sun, 29 May 2011 01:56:44 -0700 > notmuch@dima.secretsauce.net wrote: > > Here's another improvement. In the notmuch-show display this binds > '[' to expand all the children messages (replies). Analogously ']' > collapses all the children messages. Here's an update of the patch to conform with notmuch's indentation style. --MP_/5iQ=vw+=WwAqDiDRsB3sSAx Content-Type: text/x-patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=0001-added-keys-to-hide-show-a-portion-of-the-thread.patch >From 0e2ef657fe0f6e7f8f2f7e87acd1fbbf58d8d95d Mon Sep 17 00:00:00 2001 From: Dima Kogan Date: Sun, 29 May 2011 00:37:55 -0700 Subject: [PATCH] added keys to hide/show a portion of the thread --- emacs/notmuch-show.el | 31 +++++++++++++++++++++++++++++++ 1 files changed, 31 insertions(+), 0 deletions(-) diff --git a/emacs/notmuch-show.el b/emacs/notmuch-show.el index 2ba151e..5ecf5ca 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,35 @@ 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.5.3 --MP_/5iQ=vw+=WwAqDiDRsB3sSAx--