]> git.eshelyaron.com Git - emacs.git/commitdiff
(rmail-header-hide-headers): Simplify.
authorHenrik Enberg <henrik.enberg@telia.com>
Thu, 19 Jan 2006 12:59:11 +0000 (12:59 +0000)
committerHenrik Enberg <henrik.enberg@telia.com>
Thu, 19 Jan 2006 12:59:11 +0000 (12:59 +0000)
lisp/mail/ChangeLog
lisp/mail/rmailhdr.el

index 865e71523d641879b1959466d93cfd5f8bbe7ad4..ead759502f74be259e26edd46240abbee1f67795 100644 (file)
@@ -2,6 +2,7 @@
 
        * rmailhdr.el (rmail-header-get-header): Rewrite to be a
        convenience wrapper for mail-fetch-field.
+       (rmail-header-hide-headers): Simplify.
 
        * rmail.el (rmail-process-new-messages): Use
        rmail-header-get-header instead of mail-fetch-field.
index 34246dff1adf7617476c5fb513c7309c405a2a4c..9fea38fe1a5b38b71b6aa6e44ed1203caf607db6 100644 (file)
@@ -111,7 +111,6 @@ The current buffer, possibly narrowed, contains a single message."
             (goto-char (point-min))
             (mail-parse-comma-list))))))
 
-
 (defun rmail-header-hide-headers ()
   "Hide ignored headers.  All others will be visible.
 The current buffer, possibly narrowed, contains a single message."
@@ -119,66 +118,57 @@ The current buffer, possibly narrowed, contains a single message."
     (let ((case-fold-search t)
          (limit (rmail-header-get-limit))
          (inhibit-point-motion-hooks t)
-         start end visibility-p overlay overlay-list)
-
+         ;; start end
+         visibility-p
+         ;;overlay
+         overlay-list)
       ;; Record the display state as having headers hidden.
       (setq rmail-header-display-mode t)
-
       ;; Clear the pool of overlays for reuse.
       (mapcar 'delete-overlay rmail-header-overlay-list)
       (setq overlay-list rmail-header-overlay-list)
-
       ;; Determine whether to use the displayed headers or the ignored
       ;; headers.
       (if rmail-displayed-headers
-
          ;; Set the visibility predicate function to ignore headers
          ;; marked for display.
          (setq visibility-p 'rmail-header-show-displayed-p)
-
        ;; Set the visibility predicate function to hide ignored
        ;; headers.
        (setq visibility-p 'rmail-header-hide-ignored-p))
-
       ;; Walk through all the headers marking the non-displayed
       ;; headers as invisible.
       (goto-char (point-min))
       (while (re-search-forward "^[^ \t:]+[ :]" limit t)
-
        ;; Determine if the current header needs to be hidden.
        (beginning-of-line)
-       (if (funcall visibility-p)
-
-           ;; It does.  Make this header hidden by setting an overlay
-           ;; with both the invisible and intangible properties set.
-           (progn
-             (setq start (point))
-             (forward-line 1)
-             (while (looking-at "[ \t]+")
-               (forward-line 1))
-             (setq end (point))
-
-             ;; Use one of the cleared, cached overlays until they
-             ;; run out.
-             (if (car overlay-list)
-
-                 ;; Use a cached overlay.
-                 (progn
-                   (setq overlay (car overlay-list)
-                         overlay-list (cdr overlay-list))
-                   (move-overlay overlay start end))
-
-               ;; No overlay exists for this header.  Create one and
-               ;; add it to the cache.
-               (setq overlay (make-overlay start end)
-                     rmail-header-overlay-list
-                     (append (list overlay)
-                             rmail-header-overlay-list))
-               (overlay-put overlay 'invisible t)
-               (overlay-put overlay 'intangible t)))
-
-         ;; It does not.  Move point away from this header.
-         (forward-line 1))))))
+       (if (not (funcall visibility-p))
+           ;; It does not.  Move point away from this header.
+           (forward-line 1)
+         ;; It does.  Make this header hidden by setting an overlay
+         ;; with both the invisible and intangible properties set.
+         (let ((start (point))
+               overlay)
+           ;; Move to end and pick upp any continuation lines on folded
+           ;; headers.
+           (forward-line 1)
+           (while (looking-at "[ \t]+")
+             (forward-line 1))
+           ;; (setq end (point))
+           ;; Use one of the cleared, cached overlays until they
+           ;; run out.
+           (if (car overlay-list)
+               ;; Use a cached overlay.
+               (progn
+                 (setq overlay (car overlay-list)
+                       overlay-list (cdr overlay-list))
+                 (move-overlay overlay start (point)))
+             ;; No overlay exists for this header.  Create one and
+             ;; add it to the cache.
+             (setq overlay (make-overlay start (point)))
+             (overlay-put overlay 'invisible t)
+             (overlay-put overlay 'intangible t)
+             (push overlay rmail-header-overlay-list))))))))
 
 (defun rmail-header-persist-attributes (attributes)
   "Save ATTRIBUTES in the Rmail BABYL header."
@@ -246,3 +236,5 @@ single message."
   (not (looking-at rmail-displayed-headers)))
 
 (provide 'rmailhdr)
+
+;;; rmailhdr.el ends here