Function: gnus-read-ephemeral-bug-group

gnus-read-ephemeral-bug-group is an interactive and byte-compiled function defined in gnus-group.el.gz.

Signature

(gnus-read-ephemeral-bug-group IDS MBOX-URL &optional WINDOW-CONF)

Documentation

Browse bug reports with IDS in an ephemeral group.

IDS can be either a single bug ID (a number or string), or a list thereof. MBOX-URL is a URL format string identifying the bug tracker; see gnus-bug-group-download-format-alist for details. Interactively, read multiple bug IDS in the minibuffer and default to the MBOX-URL for the Emacs bug tracker. WINDOW-CONF is the name of the Gnus window configuration to use when exiting the ephemeral group.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/gnus-group.el.gz
(defun gnus-read-ephemeral-bug-group (ids mbox-url &optional window-conf)
  "Browse bug reports with IDS in an ephemeral group.
IDS can be either a single bug ID (a number or string), or a list
thereof.  MBOX-URL is a URL format string identifying the bug
tracker; see `gnus-bug-group-download-format-alist' for details.
Interactively, read multiple bug IDS in the minibuffer and
default to the MBOX-URL for the Emacs bug tracker.  WINDOW-CONF
is the name of the Gnus window configuration to use when exiting
the ephemeral group."
  (interactive
   (list (gnus-group--read-bug-ids)
         (alist-get 'emacs gnus-bug-group-download-format-alist)))
  (or ids (user-error "No bug IDs specified"))
  (setq ids (mapcar (lambda (id) (format "%s" id))
                    (if (consp ids) ids (list ids))))
  (let ((tmpfile (make-temp-file "gnus-temp-group-")))
    (unwind-protect
	;; Add the debbugs address so that we can respond to reports easily.
        (let* ((address (format "%s@%s" (car ids)
                                (url-host (url-generic-parse-url mbox-url))))
               (address-re (concat "\\(?:\\`\\|[ ,<]\\)"
                                   (regexp-quote address)
                                   "\\(?:\\'\\|[ ,>]\\)"))
               (delim (concat "^" message-unix-mail-delimiter)))
          (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
                   (nndoc-article-type mbox))
           nil window-conf))
      (delete-file tmpfile))))