diff options
author | Carl Worth <cworth@cworth.org> | 2009-11-04 15:42:12 -0800 |
---|---|---|
committer | Carl Worth <cworth@cworth.org> | 2009-11-04 15:44:11 -0800 |
commit | 97b5f8153399d57bb9db643e778b06e23387110c (patch) | |
tree | 048c8f639acb492142e2ff1629ee6e56c7cb3844 /notmuch.el | |
parent | 3604a19beb0c6f90bea199884d0ac696c2de4505 (diff) |
notmuch.el: Don't hide long signatures.
Chances are, a signature above a certain threshold isn't just a
signature, (for example, it could be an encrypted messages tacked onto
the end of the file, or could be any sort of PS.)
We add a new variable, notmuch-show-signature-lines-max that can be
used to configure the threshold, (set to 6 by default for now).
Diffstat (limited to 'notmuch.el')
-rw-r--r-- | notmuch.el | 25 |
1 files changed, 16 insertions, 9 deletions
@@ -46,6 +46,9 @@ "Keymap for \"notmuch show\" buffers.") (fset 'notmuch-show-mode-map notmuch-show-mode-map) +(defvar notmuch-show-signature-lines-max 6 + "Maximum length of signature that will be hidden by default.") + (defvar notmuch-show-message-begin-regexp "message{") (defvar notmuch-show-message-end-regexp "message}") (defvar notmuch-show-header-begin-regexp "header{") @@ -297,20 +300,24 @@ which this thread was originally shown." (if (looking-at ">") (progn (while (looking-at ">") - (next-line)) + (forward-line)) (let ((overlay (make-overlay beg-sub (point)))) (overlay-put overlay 'invisible 'notmuch-show-citation) (overlay-put overlay 'before-string (concat "[" (number-to-string (count-lines beg-sub (point))) - " quoted lines.]"))))) + " quoted lines.]\n"))))) (if (looking-at "--[ ]?$") - (let ((overlay (make-overlay beg-sub end))) - (overlay-put overlay 'invisible 'notmuch-show-signature) - (overlay-put overlay 'before-string - (concat "[" (number-to-string (count-lines beg-sub end)) - "-line signature.]")) - (goto-char end))) - (next-line)))) + (let ((sig-lines (count-lines beg-sub end))) + (if (<= sig-lines notmuch-show-signature-lines-max) + (progn + (overlay-put (make-overlay beg-sub (+ beg-sub 1)) + 'before-string + (concat "[" (number-to-string sig-lines) + "-line signature.]")) + (overlay-put (make-overlay (+ beg-sub 2) end) + 'invisible 'notmuch-show-signature) + (goto-char end))))) + (forward-line)))) (defun notmuch-show-markup-body () (re-search-forward notmuch-show-body-begin-regexp) |