From: Lars Ingebrigtsen Date: Wed, 2 Dec 2020 10:16:30 +0000 (+0100) Subject: Fix the message-fetch-field doc string X-Git-Tag: emacs-28.0.90~4970 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=bf43bcbed81ba0fa4376bcd6568279fa3c519c3a;p=emacs.git Fix the message-fetch-field doc string * lisp/gnus/message.el (message-fetch-field): Improve the doc string (bug#44991). --- diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index 288ccc494c9..2ab3eb62120 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el @@ -2090,14 +2090,21 @@ is used by default." (goto-char (point-min)) (looking-at message-unix-mail-delimiter)))) -(defun message-fetch-field (header &optional not-all) - "The same as `mail-fetch-field', only remove all newlines. +(defun message-fetch-field (header &optional first) + "Return the value of the header field named HEADER. +Continuation lines are folded (i.e., newlines are removed). Surrounding whitespace is also removed. +By default, if there's more than one header field named HEADER, +all the values are returned as one concatenated string, and +values are comma-separated. + +If FIRST is non-nil, only the first value is returned. + The buffer is expected to be narrowed to just the header of the message; see `message-narrow-to-headers-or-head'." (let* ((inhibit-point-motion-hooks t) - (value (mail-fetch-field header nil (not not-all)))) + (value (mail-fetch-field header nil (not first)))) (when value (while (string-match "\n[\t ]+" value) (setq value (replace-match " " t t value))) @@ -2105,12 +2112,12 @@ see `message-narrow-to-headers-or-head'." ;; we have initial or trailing white space; remove it. (string-trim value)))) -(defun message-field-value (header &optional not-all) +(defun message-field-value (header &optional first) "The same as `message-fetch-field', only narrow to the headers first." (save-excursion (save-restriction (message-narrow-to-headers-or-head) - (message-fetch-field header not-all)))) + (message-fetch-field header first)))) (defun message-narrow-to-field () "Narrow the buffer to the header on the current line."