From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/82974 Path: news.gmane.org!not-for-mail From: Dave Abrahams Newsgroups: gmane.emacs.gnus.general Subject: Proposal: gnus-refer-article Date: Sun, 03 Mar 2013 22:42:00 -0800 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1362379851 16001 80.91.229.3 (4 Mar 2013 06:50:51 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 4 Mar 2013 06:50:51 +0000 (UTC) To: ding@gnus.org Original-X-From: ding-owner+M31240@lists.math.uh.edu Mon Mar 04 07:51:15 2013 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UCPEv-0000uE-Fg for ding-account@gmane.org; Mon, 04 Mar 2013 07:51:13 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by util0.math.uh.edu with smtp (Exim 4.63) (envelope-from ) id 1UCPDx-0004xF-Fp; Mon, 04 Mar 2013 00:50:13 -0600 Original-Received: from mx1.math.uh.edu ([129.7.128.32]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1UCPDh-0004wr-Hs for ding@lists.math.uh.edu; Mon, 04 Mar 2013 00:49:57 -0600 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx1.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.76) (envelope-from ) id 1UCPDf-00052T-QK for ding@lists.math.uh.edu; Mon, 04 Mar 2013 00:49:56 -0600 Original-Received: from plane.gmane.org ([80.91.229.3]) by quimby.gnus.org with esmtp (Exim 4.72) (envelope-from ) id 1UCPDd-0003HW-Rv for ding@gnus.org; Mon, 04 Mar 2013 07:49:53 +0100 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1UCPDy-0000GL-6y for ding@gnus.org; Mon, 04 Mar 2013 07:50:14 +0100 Original-Received: from c-50-143-153-218.hsd1.ca.comcast.net ([50.143.153.218]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 04 Mar 2013 07:50:14 +0100 Original-Received: from dave by c-50-143-153-218.hsd1.ca.comcast.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 04 Mar 2013 07:50:14 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 71 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: c-50-143-153-218.hsd1.ca.comcast.net User-Agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.2.93 (darwin) Cancel-Lock: sha1:YtiwYhJOa795o1l6MC2v9wNEhKE= X-Spam-Score: -2.5 (--) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:82974 Archived-At: 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