Merge remote branch 'drax/master'

This commit is contained in:
Carl Worth 2009-11-23 00:43:26 +01:00
commit ec738509f2

View file

@ -477,6 +477,15 @@ which this thread was originally shown."
(if last (if last
(notmuch-show-archive-thread)))))) (notmuch-show-archive-thread))))))
(defun notmuch-toggle-invisible-action (cite-button)
(let ((invis-spec (button-get button 'invisibility-spec)))
(if (invisible-p invis-spec)
(remove-from-invisibility-spec invis-spec)
(add-to-invisibility-spec invis-spec)
))
(force-window-update)
(redisplay t))
(defun notmuch-show-markup-citations-region (beg end depth) (defun notmuch-show-markup-citations-region (beg end depth)
(goto-char beg) (goto-char beg)
(beginning-of-line) (beginning-of-line)
@ -488,25 +497,53 @@ which this thread was originally shown."
(progn (progn
(while (looking-at citation) (while (looking-at citation)
(forward-line)) (forward-line))
(let ((overlay (make-overlay beg-sub (point)))) (let ((overlay (make-overlay beg-sub (point)))
(overlay-put overlay 'invisible 'notmuch-show-citation) (invis-spec (make-symbol "notmuch-citation-region")))
(overlay-put overlay 'before-string (add-to-invisibility-spec invis-spec)
(concat indent (overlay-put overlay 'invisible invis-spec)
"[" (number-to-string (count-lines beg-sub (point))) (let (
"-line citation. Press 'c' to show.]\n"))))) (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) (move-to-column depth)
(if (looking-at notmuch-show-signature-regexp) (if (looking-at notmuch-show-signature-regexp)
(let ((sig-lines (- (count-lines beg-sub end) 1))) (let ((sig-lines (- (count-lines beg-sub end) 1)))
(if (<= sig-lines notmuch-show-signature-lines-max) (if (<= sig-lines notmuch-show-signature-lines-max)
(progn (progn
(let ((invis-spec (make-symbol "notmuch-signature-region")))
(add-to-invisibility-spec invis-spec)
(overlay-put (make-overlay beg-sub end) (overlay-put (make-overlay beg-sub end)
'invisible 'notmuch-show-signature) 'invisible invis-spec)
(overlay-put (make-overlay beg (- beg-sub 1))
'after-string (goto-char (- beg-sub 1))
(concat "\n" indent (insert (concat "\n" indent))
"[" (number-to-string sig-lines) (let ((sig-button (insert-button
"-line signature. Press 's' to show.]")) (concat "[" (number-to-string sig-lines)
(goto-char end))))) "-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)))) (forward-line))))
(defun notmuch-show-markup-part (beg end depth) (defun notmuch-show-markup-part (beg end depth)
@ -559,9 +596,19 @@ which this thread was originally shown."
(re-search-forward notmuch-show-header-end-regexp) (re-search-forward notmuch-show-header-end-regexp)
(beginning-of-line) (beginning-of-line)
(let ((end (point-marker))) (let ((end (point-marker)))
(goto-char beg)
(forward-line)
(while (looking-at "[A-Za-z][-A-Za-z0-9]*:")
(beginning-of-line)
(overlay-put (make-overlay (point) (re-search-forward ":"))
'face 'bold)
(forward-line)
)
(indent-rigidly beg end depth) (indent-rigidly beg end depth)
(overlay-put (make-overlay beg-hidden end) (overlay-put (make-overlay beg-hidden end)
'invisible 'notmuch-show-header) 'invisible 'notmuch-show-header)
(goto-char end)
(insert "\n")
(set-marker beg nil) (set-marker beg nil)
(set-marker beg-hidden nil) (set-marker beg-hidden nil)
(set-marker end nil) (set-marker end nil)