diff options
| author | Richard M. Stallman | 1993-11-21 10:04:52 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1993-11-21 10:04:52 +0000 |
| commit | 6f759698c6d8a1c0be2ad77669d47c2f65243db2 (patch) | |
| tree | 16a6ba669d49c94d4ed70deb4858ae7eff287bc8 | |
| parent | 4ba131170f39bb88c6bc997afa7a00608659f3f2 (diff) | |
| download | emacs-6f759698c6d8a1c0be2ad77669d47c2f65243db2.tar.gz emacs-6f759698c6d8a1c0be2ad77669d47c2f65243db2.zip | |
(mail-fetch-field): Exclude trailing whitespace.
Delete duplicate (goto-char (point-min)).
| -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." | |||
| 161 | (goto-char (point-min)) | 161 | (goto-char (point-min)) |
| 162 | (let ((case-fold-search t) | 162 | (let ((case-fold-search t) |
| 163 | (name (concat "^" (regexp-quote field-name) "[ \t]*:[ \t]*"))) | 163 | (name (concat "^" (regexp-quote field-name) "[ \t]*:[ \t]*"))) |
| 164 | (goto-char (point-min)) | ||
| 165 | (if all | 164 | (if all |
| 166 | (let ((value "")) | 165 | (let ((value "")) |
| 167 | (while (re-search-forward name nil t) | 166 | (while (re-search-forward name nil t) |
| 168 | (let ((opoint (point))) | 167 | (let ((opoint (point))) |
| 169 | (while (progn (forward-line 1) | 168 | (while (progn (forward-line 1) |
| 170 | (looking-at "[ \t]"))) | 169 | (looking-at "[ \t]"))) |
| 170 | ;; Back up over newline, then trailing spaces or tabs | ||
| 171 | (forward-char -1) | ||
| 172 | (while (member (preceding-char) '(? ?\t)) | ||
| 173 | (forward-char -1)) | ||
| 171 | (setq value (concat value | 174 | (setq value (concat value |
| 172 | (if (string= value "") "" ", ") | 175 | (if (string= value "") "" ", ") |
| 173 | (buffer-substring opoint (1- (point))))))) | 176 | (buffer-substring opoint (point)))))) |
| 174 | (and (not (string= value "")) value)) | 177 | (and (not (string= value "")) value)) |
| 175 | (if (re-search-forward name nil t) | 178 | (if (re-search-forward name nil t) |
| 176 | (progn | 179 | (progn |
| @@ -178,7 +181,11 @@ If third arg ALL is non-nil, concatenate all such fields with commas between." | |||
| 178 | (let ((opoint (point))) | 181 | (let ((opoint (point))) |
| 179 | (while (progn (forward-line 1) | 182 | (while (progn (forward-line 1) |
| 180 | (looking-at "[ \t]"))) | 183 | (looking-at "[ \t]"))) |
| 181 | (buffer-substring opoint (1- (point)))))))))) | 184 | ;; Back up over newline, then trailing spaces or tabs |
| 185 | (forward-char -1) | ||
| 186 | (while (member (preceding-char) '(? ?\t)) | ||
| 187 | (forward-char -1)) | ||
| 188 | (buffer-substring opoint (point))))))))) | ||
| 182 | 189 | ||
| 183 | ;; Parse a list of tokens separated by commas. | 190 | ;; Parse a list of tokens separated by commas. |
| 184 | ;; It runs from point to the end of the visible part of the buffer. | 191 | ;; It runs from point to the end of the visible part of the buffer. |