diff options
Diffstat (limited to 'lisp/gnus')
-rw-r--r-- | lisp/gnus/gnus-group.el | 69 |
1 files changed, 31 insertions, 38 deletions
diff --git a/lisp/gnus/gnus-group.el b/lisp/gnus/gnus-group.el index d1098be6fd3..35103e9c4f4 100644 --- a/lisp/gnus/gnus-group.el +++ b/lisp/gnus/gnus-group.el @@ -2421,44 +2421,37 @@ the ephemeral group." (regexp-quote address) "\\(?:\\'\\|[ ,>]\\)")) (delim (concat "^" message-unix-mail-delimiter))) - (let ((coding-system-for-write 'binary) - (coding-system-for-read 'binary)) - (with-temp-file tmpfile - (mm-disable-multibyte) - (dolist (id ids) - (let ((file (expand-file-name id (locate-user-emacs-file - "debbugs-cache")))) - (if (and (not gnus-plugged) - (file-exists-p file)) - (insert-file-contents file) - ;; Pass non-nil VISIT to avoid errors with non-nil - ;; `url-automatic-caching' (bug#26063, bug#29008) - ;; and immediately unvisit. - ;; FIXME: This masks real errors! - (url-insert-file-contents (format mbox-url id) t) - (setq buffer-file-name nil)))) - (goto-char (point-min)) - ;; Throw an informative error early instead of passing nonsense - ;; to `gnus-group-read-ephemeral-group' (bug#36433). - (unless (save-excursion (re-search-forward delim nil t)) - (error "Invalid mbox format for bug IDs: %s" - (string-join ids ", "))) - (while (re-search-forward delim nil t) - (narrow-to-region (point) - (if (search-forward "\n\n" nil t) - (1- (point)) - (point-max))) - (unless (string-match-p address-re - (concat (message-fetch-field "to") " " - (message-fetch-field "cc"))) - (goto-char (point-min)) - (if (not (re-search-forward "^To:" nil t)) - (insert "To: " address "\n") - (message-next-header) - (skip-chars-backward "\t\n ") - (insert ", " address))) - (goto-char (point-max)) - (widen)))) + (with-temp-file tmpfile + (mm-disable-multibyte) + (dolist (id ids) + (let ((file (expand-file-name id (locate-user-emacs-file + "debbugs-cache")))) + (if (and (not gnus-plugged) + (file-exists-p file)) + (insert-file-contents-literally file) + (url-insert-file-contents-literally (format mbox-url id))))) + (goto-char (point-min)) + ;; Throw an informative error early instead of passing nonsense + ;; to `gnus-group-read-ephemeral-group' (bug#36433). + (unless (save-excursion (re-search-forward delim nil t)) + (error "Invalid mbox format for bug IDs: %s" + (string-join ids ", "))) + (while (re-search-forward delim nil t) + (narrow-to-region (point) + (if (search-forward "\n\n" nil t) + (1- (point)) + (point-max))) + (unless (string-match-p address-re + (concat (message-fetch-field "to") " " + (message-fetch-field "cc"))) + (goto-char (point-min)) + (if (not (re-search-forward "^To:" nil t)) + (insert "To: " address "\n") + (message-next-header) + (skip-chars-backward "\t\n ") + (insert ", " address))) + (goto-char (point-max)) + (widen))) (gnus-group-read-ephemeral-group (concat "nndoc+ephemeral:bug#" (string-join ids ",")) `(nndoc ,tmpfile |