Function: gnus-select-group-with-message-id
gnus-select-group-with-message-id is a byte-compiled function defined
in gnus-int.el.gz.
Signature
(gnus-select-group-with-message-id GROUP MESSAGE-ID)
Documentation
Activate and select GROUP with the given MESSAGE-ID selected.
Returns the article number of the message.
If GROUP is not already selected, the message will be the only one in the group's summary.
Source Code
;; Defined in /usr/src/emacs/lisp/gnus/gnus-int.el.gz
(defun gnus-select-group-with-message-id (group message-id)
"Activate and select GROUP with the given MESSAGE-ID selected.
Returns the article number of the message.
If GROUP is not already selected, the message will be the only one in
the group's summary."
;; TODO: is there a way to know at this point whether the group will
;; be newly-selected? If so we could clean up the logic at the end
;;
;; save the new group's display parameter, if any, so we
;; can replace it temporarily with zero.
(let ((saved-display
(gnus-group-get-parameter group 'display :allow-list)))
;; Tell gnus we really don't want any articles
(gnus-group-set-parameter group 'display 0)
(unwind-protect
(gnus-summary-read-group-1
group (not :show-all) :no-article (not :kill-buffer)
;; The combination of no-display and this dummy list of
;; articles to select somehow makes it possible to open a
;; group with no articles in it. Black magic.
:no-display '(-1); select-articles
)
;; Restore the new group's display parameter
(gnus-group-set-parameter group 'display saved-display)))
;; The summary buffer was suppressed by :no-display above.
;; Create it now and insert the message
(let ((group-is-new (gnus-summary-setup-buffer group)))
(condition-case err
(let ((article-number
(gnus-summary-insert-subject message-id)))
(unless article-number
(signal 'error "message-id not in group"))
(gnus-summary-select-article nil nil nil article-number)
article-number)
;; Clean up the new summary and propagate the error
(error (when group-is-new (gnus-summary-exit))
(apply #'signal err)))))