emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 8179cbf: Remove initial and trailing whitespace in


From: Lars Ingebrigtsen
Subject: [Emacs-diffs] master 8179cbf: Remove initial and trailing whitespace in message-fetch-field
Date: Fri, 12 Jul 2019 10:08:18 -0400 (EDT)

branch: master
commit 8179cbff9ed37e7d8892643859adfad448ae1c7a
Author: Lars Ingebrigtsen <address@hidden>
Commit: Lars Ingebrigtsen <address@hidden>

    Remove initial and trailing whitespace in message-fetch-field
    
    * lisp/gnus/message.el (message-fetch-field): Remove initial and
    trailing whitespace.
---
 lisp/gnus/message.el | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el
index db23217..3f190ed 100644
--- a/lisp/gnus/message.el
+++ b/lisp/gnus/message.el
@@ -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."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]