diff options
author | David Bremner <bremner@unb.ca> | 2009-12-25 16:09:08 -0400 |
---|---|---|
committer | Carl Worth <cworth@cworth.org> | 2010-02-08 14:24:34 -0800 |
commit | 9b93717a6de367087e275756fb55ecee42227e6b (patch) | |
tree | 1620fae1efdc29a3b64a18012d8a2c8c79566c43 /notmuch.el | |
parent | 24b2f7699f7492d589cff54f06c58693e7207d34 (diff) |
notmuch.el: show some of citation even when hiding.
- 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
Reviewed-by: Kan-Ru Chen <kanru@kanru.info>
Diffstat (limited to 'notmuch.el')
-rw-r--r-- | notmuch.el | 28 |
1 files changed, 17 insertions, 11 deletions
@@ -95,13 +95,13 @@ move past the indentation when testing this pattern, (so that the pattern can still test against the entire line).") (defvar notmuch-show-signature-button-format - "[ %d-line hidden signature. Click/Enter to show ]" + "[ %d-line signature. Click/Enter to toggle visibility. ]" "String used to construct button text for hidden signatures 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") @@ -109,8 +109,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.") @@ -683,13 +686,16 @@ 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) - (notmuch-show-region-to-button - cite-start cite-end - "citation" - indent - (format notmuch-show-citation-button-format cite-lines) - )))) + (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 + (point) cite-end + "citation" + indent + (format notmuch-show-citation-button-format + (- cite-lines notmuch-show-citation-lines-prefix)) + )))) (if (and (< (point) end) (re-search-forward signature-regexp end t)) (let* ((sig-start (match-beginning 0)) |