- (while (looking-at ">")
- (next-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.]")))))
- (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))))
-
-(defun notmuch-show-markup-body ()
+ (while (looking-at citation)
+ (forward-line))
+ (let ((overlay (make-overlay beg-sub (point)))
+ (invis-spec (make-symbol "notmuch-citation-region")))
+ (add-to-invisibility-spec invis-spec)
+ (overlay-put overlay 'invisible invis-spec)
+ (let (
+ (p (point))
+ (cite-button-text
+ (concat "[" (number-to-string (count-lines beg-sub (point)))
+ "-line citation.]"))
+ )
+ (goto-char (- beg-sub 1))
+ (insert (concat "\n" indent))
+ (let ((cite-button (insert-button cite-button-text)))
+ (button-put cite-button 'invisibility-spec invis-spec)
+ (button-put cite-button 'action 'notmuch-toggle-invisible-action)
+ (button-put cite-button 'follow-link t)
+ (button-put cite-button 'help-echo
+ "mouse-1, RET: Show citation")
+
+ )
+ (insert "\n")
+ (goto-char (+ (length cite-button-text) p))
+ ))))
+ (move-to-column depth)
+ (if (looking-at notmuch-show-signature-regexp)
+ (let ((sig-lines (- (count-lines beg-sub end) 1)))
+ (if (<= sig-lines notmuch-show-signature-lines-max)
+ (progn
+ (let ((invis-spec (make-symbol "notmuch-signature-region")))
+ (add-to-invisibility-spec invis-spec)
+ (overlay-put (make-overlay beg-sub end)
+ 'invisible invis-spec)
+
+ (goto-char (- beg-sub 1))
+ (insert (concat "\n" indent))
+ (let ((sig-button (insert-button
+ (concat "[" (number-to-string sig-lines)
+ "-line signature.]"))))
+ (button-put sig-button 'invisibility-spec invis-spec)
+ (button-put sig-button 'action
+ 'notmuch-toggle-invisible-action)
+ (button-put sig-button 'follow-link t)
+ (button-put sig-button 'help-echo
+ "mouse-1, RET: Show signature")
+ )
+ (insert "\n")
+ (goto-char end))))))
+ (forward-line))))
+
+(defun notmuch-show-markup-part (beg end depth)
+ (if (re-search-forward notmuch-show-part-begin-regexp nil t)
+ (progn
+ (forward-line)
+ (let ((beg (point-marker)))
+ (re-search-forward notmuch-show-part-end-regexp)
+ (let ((end (copy-marker (match-beginning 0))))
+ (goto-char end)
+ (if (not (bolp))
+ (insert "\n"))
+ (indent-rigidly beg end depth)
+ (notmuch-show-markup-citations-region beg end depth)
+ ; Advance to the next part (if any) (so the outer loop can
+ ; determine whether we've left the current message.
+ (if (re-search-forward notmuch-show-part-begin-regexp nil t)
+ (beginning-of-line)))))
+ (goto-char end)))
+
+(defun notmuch-show-markup-parts-region (beg end depth)
+ (save-excursion
+ (goto-char beg)
+ (while (< (point) end)
+ (notmuch-show-markup-part beg end depth))))
+
+(defun notmuch-show-markup-body (depth)