diff options
author | David Bremner <bremner@unb.ca> | 2010-02-24 14:30:06 -0400 |
---|---|---|
committer | Carl Worth <cworth@cworth.org> | 2011-06-10 15:59:45 -0700 |
commit | f56b86dffa5e6deb57e99bd16507920d75cf81a4 (patch) | |
tree | bc3f585220b2e8dd3c655d6ffb9f0486223cc8f3 | |
parent | 5143e5e840b5e9d95611f57fdc9d4b27af6f0564 (diff) |
notmuch.el: hide original message in top posted replies.
This code treats top posted copies essentially like signatures, except
that it doesn't sanity check their length, since neither do their
senders.
New user-visible variables:
notmuch-wash-button-original-hidden-format
notmuch-wash-button-original-visible-format
Rebased-by: Carl Worth <cworth@cworth.org>
-rw-r--r-- | emacs/notmuch-wash.el | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/emacs/notmuch-wash.el b/emacs/notmuch-wash.el index 115c3bb9..6760f3e7 100644 --- a/emacs/notmuch-wash.el +++ b/emacs/notmuch-wash.el @@ -35,6 +35,9 @@ "\\(^[[:space:]]*>.*\n\\)+" "Pattern to match citation lines.") +(defvar notmuch-wash-original-regexp "^\\(--+\s?[oO]riginal [mM]essage\s?--+\\)$" + "Pattern to match a line that separates original message from reply in top-posted message.") + (defvar notmuch-wash-button-signature-hidden-format "[ %d-line signature. Click/Enter to show. ]" "String used to construct button text for hidden signatures. @@ -55,6 +58,16 @@ Can use up to one integer format parameter, i.e. %d") "String used to construct button text for visible citations. Can use up to one integer format parameter, i.e. %d") +(defvar notmuch-wash-button-original-hidden-format + "[ %d-line hidden original message. Click/Enter to show. ]" + "String used to construct button text for hidden citations. +Can use up to one integer format parameter, i.e. %d") + +(defvar notmuch-wash-button-original-visible-format + "[ %d-line original message. Click/Enter to hide. ]" + "String used to construct button text for visible citations. +Can use up to one integer format parameter, i.e. %d") + (defvar notmuch-wash-signature-lines-max 12 "Maximum length of signature that will be hidden by default.") @@ -106,6 +119,10 @@ collapse the remaining lines into a button.") 'help-echo "mouse-1, RET: Show signature" :supertype 'notmuch-wash-button-invisibility-toggle-type) +(define-button-type 'notmuch-wash-button-original-toggle-type + 'help-echo "mouse-1, RET: Show original message" + :supertype 'notmuch-wash-button-invisibility-toggle-type) + (defun notmuch-wash-region-isearch-show (overlay) (remove-from-invisibility-spec (overlay-get overlay 'invisible))) @@ -151,6 +168,13 @@ insert before the button, probably for indentation." "Excerpt citations and up to one signature." (goto-char (point-min)) (beginning-of-line) + (if (and (< (point) (point-max)) + (re-search-forward notmuch-wash-original-regexp nil t)) + (let* ((msg-start (match-beginning 0)) + (msg-end (point-max)) + (msg-lines (count-lines msg-start msg-end))) + (notmuch-wash-region-to-button + msg-start msg-end "original" "\n"))) (while (and (< (point) (point-max)) (re-search-forward notmuch-wash-citation-regexp nil t)) (let* ((cite-start (match-beginning 0)) |