diff options
author | Richard M. Stallman <rms@gnu.org> | 1993-11-21 10:04:52 +0000 |
---|---|---|
committer | Richard M. Stallman <rms@gnu.org> | 1993-11-21 10:04:52 +0000 |
commit | 6f759698c6d8a1c0be2ad77669d47c2f65243db2 (patch) | |
tree | 16a6ba669d49c94d4ed70deb4858ae7eff287bc8 /lisp/mail/mail-utils.el | |
parent | 4ba131170f39bb88c6bc997afa7a00608659f3f2 (diff) | |
download | emacs-6f759698c6d8a1c0be2ad77669d47c2f65243db2.tar.gz |
(mail-fetch-field): Exclude trailing whitespace.
Delete duplicate (goto-char (point-min)).
Diffstat (limited to 'lisp/mail/mail-utils.el')
-rw-r--r-- | lisp/mail/mail-utils.el | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lisp/mail/mail-utils.el b/lisp/mail/mail-utils.el index 5f45ab00acd..766d2c94c81 100644 --- a/lisp/mail/mail-utils.el +++ b/lisp/mail/mail-utils.el @@ -161,16 +161,19 @@ If third arg ALL is non-nil, concatenate all such fields with commas between." (goto-char (point-min)) (let ((case-fold-search t) (name (concat "^" (regexp-quote field-name) "[ \t]*:[ \t]*"))) - (goto-char (point-min)) (if all (let ((value "")) (while (re-search-forward name nil t) (let ((opoint (point))) (while (progn (forward-line 1) (looking-at "[ \t]"))) + ;; Back up over newline, then trailing spaces or tabs + (forward-char -1) + (while (member (preceding-char) '(? ?\t)) + (forward-char -1)) (setq value (concat value (if (string= value "") "" ", ") - (buffer-substring opoint (1- (point))))))) + (buffer-substring opoint (point)))))) (and (not (string= value "")) value)) (if (re-search-forward name nil t) (progn @@ -178,7 +181,11 @@ If third arg ALL is non-nil, concatenate all such fields with commas between." (let ((opoint (point))) (while (progn (forward-line 1) (looking-at "[ \t]"))) - (buffer-substring opoint (1- (point)))))))))) + ;; Back up over newline, then trailing spaces or tabs + (forward-char -1) + (while (member (preceding-char) '(? ?\t)) + (forward-char -1)) + (buffer-substring opoint (point))))))))) ;; Parse a list of tokens separated by commas. ;; It runs from point to the end of the visible part of the buffer. |