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 8FFA9431FC2 for ; Fri, 25 Dec 2009 12:09:37 -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 a6T7w7XiPBgE for ; Fri, 25 Dec 2009 12:09:36 -0800 (PST) Received: from pivot.cs.unb.ca (pivot.cs.unb.ca [131.202.240.57]) by olra.theworths.org (Postfix) with ESMTP id 154CB431FC3 for ; Fri, 25 Dec 2009 12:09:35 -0800 (PST) Received: from fctnnbsc30w-142167182194.pppoe-dynamic.high-speed.nb.bellaliant.net ([142.167.182.194] helo=localhost) by pivot.cs.unb.ca with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.69) (envelope-from ) id 1NOGTe-0004og-Ml; Fri, 25 Dec 2009 16:09:34 -0400 Received: from bremner by localhost with local (Exim 4.71) (envelope-from ) id 1NOGTZ-0006B8-C4; Fri, 25 Dec 2009 16:09:29 -0400 From: david@tethera.net To: notmuch@notmuchmail.org Date: Fri, 25 Dec 2009 16:09:08 -0400 Message-Id: <1261771748-23687-3-git-send-email-david@tethera.net> X-Mailer: git-send-email 1.6.5.7 In-Reply-To: <1261771748-23687-2-git-send-email-david@tethera.net> References: <87my17965l.fsf@anar.kanru.info> <1261771748-23687-1-git-send-email-david@tethera.net> <1261771748-23687-2-git-send-email-david@tethera.net> X-Sender-Verified: bremner@pivot.cs.unb.ca Cc: David Bremner Subject: [notmuch] [PATCH 2/2] notmuch.el: show some of citation even when hiding. 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: Fri, 25 Dec 2009 20:09:38 -0000 From: David Bremner - rename notmuch-show-citation-lines-min to n-s-c-l-prefix - call forward-line with the appropriate parameter to adjust region to be hidden. - change citation button text so that it makes (some) sense when citation is shown --- notmuch.el | 18 ++++++++++++------ 1 files changed, 12 insertions(+), 6 deletions(-) diff --git a/notmuch.el b/notmuch.el index 8a51d27..c280411 100644 --- a/notmuch.el +++ b/notmuch.el @@ -99,7 +99,7 @@ pattern can still test against the entire line).") Can use up to one integer format parameter, i.e. %d") (defvar notmuch-show-citation-button-format - "[ %d-line hidden citation. Click/Enter to show ]" + "[ %d more citation lines. Click/Enter to toggle visibility. ]" "String used to construct button text for hidden citations. Can use up to one integer format parameter, i.e. %d") @@ -107,8 +107,11 @@ Can use up to one integer format parameter, i.e. %d") (defvar notmuch-show-signature-lines-max 12 "Maximum length of signature that will be hidden by default.") -(defvar notmuch-show-citation-lines-min 4 - "Minimum length of citation that will be hidden.") +(defvar notmuch-show-citation-lines-prefix 4 + "Always show at least this many lines of a citation. + +If there is one more line, show that, otherwise collapse +remaining lines into a button.") (defvar notmuch-command "notmuch" "Command to run the notmuch binary.") @@ -660,12 +663,15 @@ is what to put on the button." (let* ((cite-start (match-beginning 0)) (cite-end (match-end 0)) (cite-lines (count-lines cite-start cite-end))) - (if (>= cite-lines notmuch-show-citation-lines-min) + (when (> cite-lines (1+ notmuch-show-citation-lines-prefix)) + (goto-char cite-start) + (forward-line notmuch-show-citation-lines-prefix) (notmuch-show-region-to-button - cite-start cite-end + (point) cite-end "citation" indent - (format notmuch-show-citation-button-format cite-lines) + (format notmuch-show-citation-button-format + (- cite-lines notmuch-show-citation-lines-prefix)) )))) (if (and (< (point) end) (re-search-forward signature-regexp end t)) -- 1.6.5.7