Function: message-remove-header
message-remove-header is a byte-compiled function defined in
message.el.gz.
Signature
(message-remove-header HEADER &optional IS-REGEXP FIRST REVERSE)
Documentation
Remove HEADER in the narrowed buffer.
If IS-REGEXP, HEADER is a regular expression. If FIRST, only remove the first instance of the header. If REVERSE, remove headers that doesn't match HEADER. Return the number of headers removed.
Source Code
;; Defined in /usr/src/emacs/lisp/gnus/message.el.gz
;;; End of functions adopted from `message-utils.el'.
(defun message-remove-header (header &optional is-regexp first reverse)
"Remove HEADER in the narrowed buffer.
If IS-REGEXP, HEADER is a regular expression.
If FIRST, only remove the first instance of the header.
If REVERSE, remove headers that doesn't match HEADER.
Return the number of headers removed."
(goto-char (point-min))
(let ((regexp (if is-regexp header (concat "^" (regexp-quote header) ":")))
(number 0)
(case-fold-search t)
last)
(while (and (not (eobp))
(not last))
(if (if reverse
(and (not (looking-at regexp))
;; Don't remove things not looking like header.
(looking-at "[!-9;-~]+:"))
(looking-at regexp))
(progn
(incf number)
(when first
(setq last t))
(delete-region
(point)
;; There might be a continuation header, so we have to search
;; until we find a new non-continuation line.
(progn
(forward-line 1)
(if (re-search-forward "^[^ \t]" nil t)
(goto-char (match-beginning 0))
(point-max)))))
(forward-line 1)
(if (re-search-forward "^[^ \t]" nil t)
(goto-char (match-beginning 0))
(goto-char (point-max)))))
number))