X-Git-Url: https://git.notmuchmail.org/git?p=notmuch;a=blobdiff_plain;f=notmuch.el;h=20436f83a5ca5a89f3b4c3e4cdee4f82a7af4bc5;hp=de44d24737fbb54ec75994fadb22a5227fe4a481;hb=97b5f8153399d57bb9db643e778b06e23387110c;hpb=a1f631ab6b533da5bbada0ed97a33da23f4a29c6 diff --git a/notmuch.el b/notmuch.el index de44d247..20436f83 100644 --- a/notmuch.el +++ b/notmuch.el @@ -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 (point))) - "-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)