Gnus development mailing list
 help / color / mirror / Atom feed
From: Dave Abrahams <dave@boostpro.com>
To: ding@gnus.org
Subject: Proposal: gnus-refer-article
Date: Sun, 03 Mar 2013 22:42:00 -0800	[thread overview]
Message-ID: <m2lia3r7if.fsf@boostpro.com> (raw)


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





             reply	other threads:[~2013-03-04  6:42 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-04  6:42 Dave Abrahams [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m2lia3r7if.fsf@boostpro.com \
    --to=dave@boostpro.com \
    --cc=ding@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).