Function: message-beginning-of-header

message-beginning-of-header is a byte-compiled function defined in message.el.gz.

Signature

(message-beginning-of-header HANDLE-FOLDED)

Documentation

Move point to beginning of header's value.

When point is at the first header line, moves it after the colon and spaces separating header name and header value.

When point is in a continuation line of a folded header (i.e. the line starts with a space), the behavior depends on HANDLE-FOLDED argument. If it's nil, function moves the point to the start of the header continuation; otherwise, function locates the beginning of the header and moves point past the colon as is the case of single-line headers.

No check whether point is inside of a header or body of the message is performed.

Returns point or nil if beginning of header's value could not be found. In the latter case, the point is still moved to the beginning of line (possibly after attempting to move it to the beginning of a folded header).

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/message.el.gz
(defun message-beginning-of-header (handle-folded)
  "Move point to beginning of header's value.

When point is at the first header line, moves it after the colon
and spaces separating header name and header value.

When point is in a continuation line of a folded header (i.e. the
line starts with a space), the behavior depends on HANDLE-FOLDED
argument.  If it's nil, function moves the point to the start of
the header continuation; otherwise, function locates the
beginning of the header and moves point past the colon as is the
case of single-line headers.

No check whether point is inside of a header or body of the
message is performed.

Returns point or nil if beginning of header's value could not be
found.  In the latter case, the point is still moved to the
beginning of line (possibly after attempting to move it to the
beginning of a folded header)."
  ;; https://www.rfc-editor.org/rfc/rfc2822.txt, section 2.2.3. says that when
  ;; unfolding a single WSP should be consumed.  WSP is defined as a space
  ;; character or a horizontal tab.
  (beginning-of-line)
  (when handle-folded
    (while (and (> (point) (point-min))
                (or (eq (char-after) ?\s) (eq (char-after) ?\t)))
      (beginning-of-line 0)))
  (when (or (eq (char-after) ?\s) (eq (char-after) ?\t)
            (search-forward ":" (point-at-eol) t))
    ;; We are a bit more lacks than the RFC and allow any positive number of WSP
    ;; characters.
    (skip-chars-forward " \t" (point-at-eol))
    (point)))