]> git.eshelyaron.com Git - emacs.git/commitdiff
Remove initial and trailing whitespace in message-fetch-field
authorLars Ingebrigtsen <larsi@gnus.org>
Fri, 12 Jul 2019 14:07:43 +0000 (16:07 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Fri, 12 Jul 2019 14:07:43 +0000 (16:07 +0200)
* lisp/gnus/message.el (message-fetch-field): Remove initial and
trailing whitespace.

lisp/gnus/message.el

index db23217081d22e22392c466e55af9cd3bef7a6dc..3f190ed6517648d3b6daa0981c8e6ca9513cad6e 100644 (file)
@@ -1987,6 +1987,8 @@ is used by default."
 
 (defun message-fetch-field (header &optional not-all)
   "The same as `mail-fetch-field', only remove all newlines.
+Surrounding whitespace is also removed.
+
 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)
@@ -1994,7 +1996,9 @@ see `message-narrow-to-headers-or-head'."
     (when value
       (while (string-match "\n[\t ]+" value)
        (setq value (replace-match " " t t value)))
-      value)))
+      ;; If the initial or final line is blank (just a newline), then
+      ;; we have initial or trailing white space; remove it.
+      (string-trim value))))
 
 (defun message-field-value (header &optional not-all)
   "The same as `message-fetch-field', only narrow to the headers first."