X-Git-Url: https://git.notmuchmail.org/git?a=blobdiff_plain;f=emacs%2Fnotmuch-wash.el;h=6760f3e743c3a578dbba46758d682292a1a55784;hb=b7db7ea42056b96578b329db5a184c9c408062c2;hp=e8134bf77c5002d16b590ad00590c3d915006232;hpb=b6862c7eb9bfb00183e568b40d77ea25ade21db2;p=notmuch diff --git a/emacs/notmuch-wash.el b/emacs/notmuch-wash.el index e8134bf7..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,12 +168,19 @@ 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)) (cite-end (match-end 0)) (cite-lines (count-lines cite-start cite-end))) - (overlay-put (make-overlay cite-start cite-end) 'face 'message-cited-text-face) + (overlay-put (make-overlay cite-start cite-end) 'face 'message-cited-text) (when (> cite-lines (+ notmuch-wash-citation-lines-prefix notmuch-wash-citation-lines-suffix 1)) @@ -178,7 +202,7 @@ insert before the button, probably for indentation." (sig-end-marker (make-marker))) (set-marker sig-start-marker sig-start) (set-marker sig-end-marker (point-max)) - (overlay-put (make-overlay sig-start-marker sig-end-marker) 'face 'message-cited-text-face) + (overlay-put (make-overlay sig-start-marker sig-end-marker) 'face 'message-cited-text) (notmuch-wash-region-to-button sig-start-marker sig-end-marker "signature" "\n"))))))