Gnus development mailing list
 help / color / mirror / Atom feed
* Proposal: gnus-refer-article
@ 2013-03-04  6:42 Dave Abrahams
  2013-08-01 16:15 ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 12+ messages in thread
From: Dave Abrahams @ 2013-03-04  6:42 UTC (permalink / raw)
  To: ding


I propose the following code for inclusion in Gnus.  It defines a new
function, `gnus-refer-article', which is just like
`gnus-summary-refer-article', but can be invoked outside the summary
buffer.  The article will appear in a new buffer.

With this, I can store links to articles/messages I want to deal with in
my TODO list and jump to them at any time.  If I want to see the article
in context of its entire thread, that's just an `A T' away.

#+begin-src: lisp
;; ==== gnus-refer-article ====
;;
;; We'll need to create a dummy group from which we can use
;; gnus-summary-refer-article.  An nndoc group almost works for that
;; purpose, but nndoc is a non-virtual backend, and warping (which
;; gnus-summary-refer-article needs in order to find the article) only
;; works in virtual groups.  Therefore, we derive a new virtual
;; backend from nndoc and use that instead.  The backend is called
;; MessageID rather than something starting with `nn' to improve the
;; appearance of the modeline in the resulting summary and article
;; buffers.
(require 'nndoc)
(nnoo-declare MessageID nndoc)
(gnus-declare-backend "MessageID" 'virtual)
;; Use nndoc functions for just about everything.
(nnoo-import MessageID (nndoc))
;; define the one method that nnoo-import won't grab for us
(deffoo MessageID-request-group (group &optional server dont-check info)
  (nndoc-request-group group server dont-check info))
(provide 'MessageID)

(defun gnus-refer-article (message-id)
  "Open a group containing the article with the given MESSAGE-ID."
  (interactive "sMessage-ID: ")
  (with-temp-buffer
    ;; Prepare a dummy article
    (erase-buffer)
    (insert "From nobody Tue Sep 13 22:05:34 2011\n\n")

    ;; Prepare pretty modelines for summary and article buffers
    (let ((gnus-summary-mode-line-format "Found %G")
          (gnus-article-mode-line-format 
           ;; Group names just get in the way here, especially the abbreviated ones
           (if (string-match "%[gG]" gnus-article-mode-line-format)
                (concat (substring gnus-article-mode-line-format 0 (match-beginning 0))
                        (substring gnus-article-mode-line-format (match-end 0)))
              gnus-article-mode-line-format)
          ))
      
      ;; Build an ephemeral group containing the dummy article (hidden)
      (gnus-group-read-ephemeral-group
       message-id
       `(MessageID ,message-id
                   (nndoc-address ,(current-buffer))
                   (nndoc-article-type mbox))
       :activate
       (cons (current-buffer) gnus-current-window-configuration)
       (not :request-only)
       '(-1) ; :select-articles
       (not :parameters)
       0     ; :number
       ))
    ;; Fetch the desired article
    (gnus-summary-refer-article message-id)
    ))
#+end_src

-- 
Dave Abrahams





^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2014-02-01  0:00 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-03-04  6:42 Proposal: gnus-refer-article Dave Abrahams
2013-08-01 16:15 ` Lars Magne Ingebrigtsen
2013-08-02 14:05   ` Dave Abrahams
2013-08-02 14:13     ` Lars Magne Ingebrigtsen
2013-08-02 15:00       ` Dave Abrahams
2013-08-03 11:24         ` Lars Magne Ingebrigtsen
2013-08-03 16:24           ` Dave Abrahams
2013-08-05  2:16             ` Lars Magne Ingebrigtsen
2013-08-05  5:10               ` Dave Abrahams
2013-09-29  2:12               ` Dave Abrahams
2013-10-03  3:27                 ` Eric Abrahamsen
2014-02-01  0:00                 ` Lars Ingebrigtsen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).