aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarl Heuer1994-04-24 18:30:53 +0000
committerKarl Heuer1994-04-24 18:30:53 +0000
commit99887e16ef939603515231b4bb06ee5aca2b160a (patch)
tree886f5c6179e5a6da7ec74d82e2c957688bea8a42
parentc63e83a4ee11ed29aedd3235bc45c1892b2efbff (diff)
downloademacs-99887e16ef939603515231b4bb06ee5aca2b160a.tar.gz
emacs-99887e16ef939603515231b4bb06ee5aca2b160a.zip
(rmail-highlight-headers): Extracted as a new function. Fix overlay position.
Do nothing if face support is unavailable.
-rw-r--r--lisp/mail/rmail.el79
1 files changed, 42 insertions, 37 deletions
diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el
index 9606398706a..b61fd65b698 100644
--- a/lisp/mail/rmail.el
+++ b/lisp/mail/rmail.el
@@ -1397,43 +1397,7 @@ If summary buffer is currently displayed, update current message there also."
1397 (narrow-to-region (point) end)) 1397 (narrow-to-region (point) end))
1398 (goto-char (point-min)) 1398 (goto-char (point-min))
1399 (rmail-display-labels) 1399 (rmail-display-labels)
1400 ;; Find all occurrences of certain fields, and highlight them. 1400 (rmail-highlight-headers)
1401 (save-excursion
1402 (search-forward "\n\n" nil 'move)
1403 (save-restriction
1404 (narrow-to-region (point-min) (point))
1405 (let ((case-fold-search t)
1406 (inhibit-read-only t)
1407 ;; Highlight with boldface if that is available.
1408 ;; Otherwise use the `highlight' face.
1409 (face (if (face-differs-from-default-p 'bold)
1410 'bold 'highlight))
1411 ;; List of overlays to reuse.
1412 (overlays rmail-overlay-list))
1413 (goto-char (point-min))
1414 (while (re-search-forward rmail-highlighted-headers nil t)
1415 (skip-syntax-forward " ")
1416 (let ((beg (point))
1417 overlay)
1418 (while (progn (forward-line 1)
1419 (looking-at "[ \t]")))
1420 ;; Back up over newline, then trailing spaces or tabs
1421 (forward-char -1)
1422 (while (member (preceding-char) '(? ?\t))
1423 (forward-char -1))
1424 (if overlays
1425 ;; Reuse an overlay we already have.
1426 (progn
1427 (setq overlay (car overlays)
1428 overlays (cdr overlays))
1429 (overlay-put overlay 'face face)
1430 (move-overlay overlay beg (point)))
1431 ;; Make a new overlay and add it to
1432 ;; rmail-overlay-list.
1433 (setq overlay (make-overlay beg beg))
1434 (overlay-put overlay 'face face)
1435 (setq rmail-overlay-list
1436 (cons overlay rmail-overlay-list))))))))
1437 (run-hooks 'rmail-show-message-hook) 1401 (run-hooks 'rmail-show-message-hook)
1438 ;; If there is a summary buffer, try to move to this message 1402 ;; If there is a summary buffer, try to move to this message
1439 ;; in that buffer. But don't complain if this message 1403 ;; in that buffer. But don't complain if this message
@@ -1445,6 +1409,47 @@ If summary buffer is currently displayed, update current message there also."
1445 (if blurb 1409 (if blurb
1446 (message blurb)))))) 1410 (message blurb))))))
1447 1411
1412;; Find all occurrences of certain fields, and highlight them.
1413(defun rmail-highlight-headers ()
1414 ;; Do this only if the system supports faces.
1415 (if (fboundp 'internal-find-face)
1416 (save-excursion
1417 (search-forward "\n\n" nil 'move)
1418 (save-restriction
1419 (narrow-to-region (point-min) (point))
1420 (let ((case-fold-search t)
1421 (inhibit-read-only t)
1422 ;; Highlight with boldface if that is available.
1423 ;; Otherwise use the `highlight' face.
1424 (face (if (face-differs-from-default-p 'bold)
1425 'bold 'highlight))
1426 ;; List of overlays to reuse.
1427 (overlays rmail-overlay-list))
1428 (goto-char (point-min))
1429 (while (re-search-forward rmail-highlighted-headers nil t)
1430 (skip-syntax-forward " ")
1431 (let ((beg (point))
1432 overlay)
1433 (while (progn (forward-line 1)
1434 (looking-at "[ \t]")))
1435 ;; Back up over newline, then trailing spaces or tabs
1436 (forward-char -1)
1437 (while (member (preceding-char) '(? ?\t))
1438 (forward-char -1))
1439 (if overlays
1440 ;; Reuse an overlay we already have.
1441 (progn
1442 (setq overlay (car overlays)
1443 overlays (cdr overlays))
1444 (overlay-put overlay 'face face)
1445 (move-overlay overlay beg (point)))
1446 ;; Make a new overlay and add it to
1447 ;; rmail-overlay-list.
1448 (setq overlay (make-overlay beg (point)))
1449 (overlay-put overlay 'face face)
1450 (setq rmail-overlay-list
1451 (cons overlay rmail-overlay-list))))))))))
1452
1448(defun rmail-next-message (n) 1453(defun rmail-next-message (n)
1449 "Show following message whether deleted or not. 1454 "Show following message whether deleted or not.
1450With prefix arg N, moves forward N messages, or backward if N is negative." 1455With prefix arg N, moves forward N messages, or backward if N is negative."