aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Ingebrigtsen2019-07-12 16:07:43 +0200
committerLars Ingebrigtsen2019-07-12 16:07:43 +0200
commit8179cbff9ed37e7d8892643859adfad448ae1c7a (patch)
treee98ae238f20752c032c4392d047b2ba334d0dc24
parent4c4ff9d90aa040ef3e1e474b3aa6a29f54c88e2e (diff)
downloademacs-8179cbff9ed37e7d8892643859adfad448ae1c7a.tar.gz
emacs-8179cbff9ed37e7d8892643859adfad448ae1c7a.zip
Remove initial and trailing whitespace in message-fetch-field
* lisp/gnus/message.el (message-fetch-field): Remove initial and trailing whitespace.
-rw-r--r--lisp/gnus/message.el6
1 files changed, 5 insertions, 1 deletions
diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el
index db23217081d..3f190ed6517 100644
--- a/lisp/gnus/message.el
+++ b/lisp/gnus/message.el
@@ -1987,6 +1987,8 @@ is used by default."
1987 1987
1988(defun message-fetch-field (header &optional not-all) 1988(defun message-fetch-field (header &optional not-all)
1989 "The same as `mail-fetch-field', only remove all newlines. 1989 "The same as `mail-fetch-field', only remove all newlines.
1990Surrounding whitespace is also removed.
1991
1990The buffer is expected to be narrowed to just the header of the message; 1992The buffer is expected to be narrowed to just the header of the message;
1991see `message-narrow-to-headers-or-head'." 1993see `message-narrow-to-headers-or-head'."
1992 (let* ((inhibit-point-motion-hooks t) 1994 (let* ((inhibit-point-motion-hooks t)
@@ -1994,7 +1996,9 @@ see `message-narrow-to-headers-or-head'."
1994 (when value 1996 (when value
1995 (while (string-match "\n[\t ]+" value) 1997 (while (string-match "\n[\t ]+" value)
1996 (setq value (replace-match " " t t value))) 1998 (setq value (replace-match " " t t value)))
1997 value))) 1999 ;; If the initial or final line is blank (just a newline), then
2000 ;; we have initial or trailing white space; remove it.
2001 (string-trim value))))
1998 2002
1999(defun message-field-value (header &optional not-all) 2003(defun message-field-value (header &optional not-all)
2000 "The same as `message-fetch-field', only narrow to the headers first." 2004 "The same as `message-fetch-field', only narrow to the headers first."