* mu4e-view.el: fix mu4e~view-fontify-cited

This commit is contained in:
djcb
2012-05-21 15:11:56 +03:00
parent a480ee9789
commit ab119df2d9

View File

@ -547,24 +547,25 @@ Seen; if the message is not New/Unread, do nothing."
(save-excursion (save-excursion
(let ((more-lines t)) (let ((more-lines t))
(goto-char (point-min)) (goto-char (point-min))
(while more-lines (when (search-forward-regexp "^\n") ;; search the first empty line
;; Get the citation level at point -- i.e., the number of '>' (while more-lines
;; prefixes, starting with 0 for 'no citation' ;; Get the citation level at point -- i.e., the number of '>'
(beginning-of-line 1) ;; prefixes, starting with 0 for 'no citation'
(let* ((level (how-many ">" (line-beginning-position 1) (beginning-of-line 1)
(line-end-position 1))) (let* ((level (how-many ">" (line-beginning-position 1)
(face (line-end-position 1)))
(unless (zerop level) (face
(intern-soft (format "mu4e-cited-%d-face" level))))) (unless (zerop level)
(when face (intern-soft (format "mu4e-cited-%d-face" level)))))
(add-text-properties (line-beginning-position 1) (when face
(line-end-position 1) `(face ,face)))) (add-text-properties (line-beginning-position 1)
(setq more-lines (line-end-position 1) `(face ,face))))
(and (= 0 (forward-line 1)) (setq more-lines
;; we need to add this weird check below; it seems in some cases (and (= 0 (forward-line 1))
;; `forward-line' continues to return 0, even when at the end, which ;; we need to add this weird check below; it seems in some cases
;; would lead to an infinite loop ;; `forward-line' continues to return 0, even when at the end, which
(not (= (point-max) (line-end-position))))))))) ;; would lead to an infinite loop
(not (= (point-max) (line-end-position))))))))))
(defun mu4e~view-fontify-footer () (defun mu4e~view-fontify-footer ()
"Give the message footers a distinctive color." "Give the message footers a distinctive color."