Function: mh-clean-msg-header

mh-clean-msg-header is an autoloaded and byte-compiled function defined in mh-show.el.gz.

Signature

(mh-clean-msg-header START INVISIBLE-HEADERS VISIBLE-HEADERS)

Documentation

Flush extraneous lines in message header.

Header is cleaned from START to the end of the message header. INVISIBLE-HEADERS contains a regular expression specifying lines to delete from the header. VISIBLE-HEADERS contains a regular expression specifying the lines to display. INVISIBLE-HEADERS is ignored if VISIBLE-HEADERS is non-nil.

Source Code

;; Defined in /usr/src/emacs/lisp/mh-e/mh-show.el.gz
;;;###mh-autoload
(defun mh-clean-msg-header (start invisible-headers visible-headers)
  "Flush extraneous lines in message header.

Header is cleaned from START to the end of the message header.
INVISIBLE-HEADERS contains a regular expression specifying lines
to delete from the header. VISIBLE-HEADERS contains a regular
expression specifying the lines to display. INVISIBLE-HEADERS is
ignored if VISIBLE-HEADERS is non-nil."
  ;; XXX Note that MH-E no longer supports the `mh-visible-headers'
  ;; variable, so this function could be trimmed of this feature too."
  (let ((case-fold-search t)
        (buffer-read-only nil))
    (save-restriction
      (goto-char start)
      (if (search-forward "\n\n" nil 'move)
          (backward-char 1))
      (narrow-to-region start (point))
      (goto-char (point-min))
      (if visible-headers
          (while (< (point) (point-max))
            (cond ((looking-at visible-headers)
                   (forward-line 1)
                   (while (looking-at "[ \t]") (forward-line 1)))
                  (t
                   (mh-delete-line 1)
                   (while (looking-at "[ \t]")
                     (mh-delete-line 1)))))
        (while (re-search-forward invisible-headers nil t)
          (beginning-of-line)
          (mh-delete-line 1)
          (while (looking-at "[ \t]")
            (mh-delete-line 1)))))
    (let ((mh-compose-skipped-header-fields ()))
      (mh-letter-hide-all-skipped-fields))
    (unlock-buffer)))