Function: mail-hist-forward-header

mail-hist-forward-header is a byte-compiled function defined in mail-hist.el.gz.

Signature

(mail-hist-forward-header COUNT)

Documentation

Move forward COUNT headers (backward if COUNT is negative).

If last/first header is encountered first, stop there and returns nil.

Places point on the first non-whitespace on the line following the colon after the header name, or on the second space following that if the header is empty.

Source Code

;; Defined in /usr/src/emacs/lisp/mail/mail-hist.el.gz
(defsubst mail-hist-forward-header (count)
  "Move forward COUNT headers (backward if COUNT is negative).
If last/first header is encountered first, stop there and returns
nil.

Places point on the first non-whitespace on the line following the
colon after the header name, or on the second space following that if
the header is empty."
  (let ((boundary (mail-header-end)))
    (and
     (> boundary 0)
     (let ((unstopped t))
       (setq boundary (save-excursion
                    (goto-char boundary)
                    (beginning-of-line)
                    (1- (point))))
       (if (> count 0)
           (while (> count 0)
             (setq
              unstopped
              (re-search-forward mail-hist-header-regexp boundary t))
             (setq count (1- count)))
         ;; because the current header will match too.
         (setq count (1- count))
         ;; count is negative
         (while (< count 0)
           (setq
            unstopped
            (re-search-backward mail-hist-header-regexp nil t))
           (setq count (1+ count)))
         ;; we end up behind the header, so must move to the front
         (re-search-forward mail-hist-header-regexp boundary t))
       ;; Now we are right after the colon
       (and (looking-at "\\s-") (forward-char 1))
       ;; return nil if didn't go as far as asked, otherwise point
       unstopped))))