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

* Re: Proposal: gnus-refer-article
  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
  0 siblings, 1 reply; 12+ messages in thread
From: Lars Magne Ingebrigtsen @ 2013-08-01 16:15 UTC (permalink / raw)
  To: Dave Abrahams; +Cc: ding

Dave Abrahams <dave@boostpro.com> writes:

> 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.

That's a good idea, but there are some things I don't quite understand
in the implementation.

> ;; 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.

Wouldn't it make sense to make warping work in nndoc groups instead, and
then we wouldn't need another backend?

-- 
(domestic pets only, the antidote for overdose, milk.)
  No Gnus T-Shirt for sale: http://ingebrigtsen.no/no.php



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

* Re: Proposal: gnus-refer-article
  2013-08-01 16:15 ` Lars Magne Ingebrigtsen
@ 2013-08-02 14:05   ` Dave Abrahams
  2013-08-02 14:13     ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 12+ messages in thread
From: Dave Abrahams @ 2013-08-02 14:05 UTC (permalink / raw)
  To: Lars Magne Ingebrigtsen; +Cc: ding


on Thu Aug 01 2013, Lars Magne Ingebrigtsen <larsi-AT-gnus.org> wrote:

> Dave Abrahams <dave@boostpro.com> writes:
>
>> 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.
>
> That's a good idea, but there are some things I don't quite understand
> in the implementation.
>
>> ;; 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.
>
> Wouldn't it make sense to make warping work in nndoc groups instead, and
> then we wouldn't need another backend?

Exactly!  Thus my questions here:
http://permalink.gmane.org/gmane.emacs.gnus.general/82136

Unfortunately, my understanding from questions over the years is that:

* warping should not be allowed to work in non-virtual groups 
* nndoc is not virtual
* nndoc should not be made virtual

If you change any of these, life would be much simpler, but until you
do, I think we need a new backend.

-- 
Dave Abrahams



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

* Re: Proposal: gnus-refer-article
  2013-08-02 14:05   ` Dave Abrahams
@ 2013-08-02 14:13     ` Lars Magne Ingebrigtsen
  2013-08-02 15:00       ` Dave Abrahams
  0 siblings, 1 reply; 12+ messages in thread
From: Lars Magne Ingebrigtsen @ 2013-08-02 14:13 UTC (permalink / raw)
  To: Dave Abrahams; +Cc: ding

Dave Abrahams <dave@boostpro.com> writes:

> Unfortunately, my understanding from questions over the years is that:
>
> * warping should not be allowed to work in non-virtual groups 

But why?  If you have a (say) nnml group that contains an article you've
copied from somewhere else, why shouldn't you be allowed to warp
somewhere else?

> * nndoc is not virtual
> * nndoc should not be made virtual

Word.

-- 
(domestic pets only, the antidote for overdose, milk.)
  No Gnus T-Shirt for sale: http://ingebrigtsen.no/no.php



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

* Re: Proposal: gnus-refer-article
  2013-08-02 14:13     ` Lars Magne Ingebrigtsen
@ 2013-08-02 15:00       ` Dave Abrahams
  2013-08-03 11:24         ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 12+ messages in thread
From: Dave Abrahams @ 2013-08-02 15:00 UTC (permalink / raw)
  To: Lars Magne Ingebrigtsen; +Cc: ding



Sent from my moss-covered three-handled family gradunza

On Aug 2, 2013, at 7:13 AM, Lars Magne Ingebrigtsen <larsi@gnus.org> wrote:

> 
>> Unfortunately, my understanding from questions over the years is that:
>> 
>> * warping should not be allowed to work in non-virtual groups
> 
> But why?  If you have a (say) nnml group that contains an article you've
> copied from somewhere else, why shouldn't you be allowed to warp
> somewhere else?

I don't know why. I've tried several times to get you to accept the patch that lifts that restriction. 


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

* Re: Proposal: gnus-refer-article
  2013-08-02 15:00       ` Dave Abrahams
@ 2013-08-03 11:24         ` Lars Magne Ingebrigtsen
  2013-08-03 16:24           ` Dave Abrahams
  0 siblings, 1 reply; 12+ messages in thread
From: Lars Magne Ingebrigtsen @ 2013-08-03 11:24 UTC (permalink / raw)
  To: Dave Abrahams; +Cc: ding

Dave Abrahams <dave@boostpro.com> writes:

>> But why?  If you have a (say) nnml group that contains an article you've
>> copied from somewhere else, why shouldn't you be allowed to warp
>> somewhere else?
>
> I don't know why. I've tried several times to get you to accept the
> patch that lifts that restriction.

Since nobody else seems to have any objections, please re-send a patch
and I'll apply it.

-- 
(domestic pets only, the antidote for overdose, milk.)
  No Gnus T-Shirt for sale: http://ingebrigtsen.no/no.php



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

* Re: Proposal: gnus-refer-article
  2013-08-03 11:24         ` Lars Magne Ingebrigtsen
@ 2013-08-03 16:24           ` Dave Abrahams
  2013-08-05  2:16             ` Lars Magne Ingebrigtsen
  0 siblings, 1 reply; 12+ messages in thread
From: Dave Abrahams @ 2013-08-03 16:24 UTC (permalink / raw)
  To: Lars Magne Ingebrigtsen; +Cc: ding

[-- Attachment #1: Type: text/plain, Size: 520 bytes --]


on Sat Aug 03 2013, Lars Magne Ingebrigtsen <larsi-AT-gnus.org> wrote:

> Dave Abrahams <dave@boostpro.com> writes:
>
>>> But why?  If you have a (say) nnml group that contains an article you've
>>> copied from somewhere else, why shouldn't you be allowed to warp
>>> somewhere else?
>>
>> I don't know why. I've tried several times to get you to accept the
>> patch that lifts that restriction.
>
> Since nobody else seems to have any objections, please re-send a patch
> and I'll apply it.

voilà:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Allow-warping-from-non-virtual-groups.patch --]
[-- Type: text/x-patch, Size: 1721 bytes --]

From 9cdfc3029a64880efddaea0713227218508ca0d6 Mon Sep 17 00:00:00 2001
From: Dave Abrahams <dave@boostpro.com>
Date: Sat, 3 Aug 2013 09:18:28 -0700
Subject: [PATCH] Allow warping from non-virtual groups

---
 lisp/gnus-int.el | 21 ++++++++++-----------
 1 file changed, 10 insertions(+), 11 deletions(-)

diff --git a/lisp/gnus-int.el b/lisp/gnus-int.el
index 6aa874f..c067b31 100644
--- a/lisp/gnus-int.el
+++ b/lisp/gnus-int.el
@@ -582,18 +582,17 @@ This is the string that Gnus uses to identify the group."
    (gnus-group-method group)))
 
 (defun gnus-warp-to-article ()
-  "Jump from an article in a virtual group to the article in its real group.
-Does nothing in a real group."
+  "Jump from an article in a group where it did not originate to
+the article in its original group."
   (interactive)
-  (when (gnus-virtual-group-p gnus-newsgroup-name)
-    (let ((gnus-command-method
-           (gnus-find-method-for-group gnus-newsgroup-name)))
-      (or
-       (when (gnus-check-backend-function
-              'warp-to-article (car gnus-command-method))
-         (funcall (gnus-get-function gnus-command-method 'warp-to-article)))
-       (and (bound-and-true-p gnus-registry-enabled)
-            (gnus-try-warping-via-registry))))))
+  (let ((gnus-command-method
+         (gnus-find-method-for-group gnus-newsgroup-name)))
+    (or
+     (when (gnus-check-backend-function
+            'warp-to-article (car gnus-command-method))
+       (funcall (gnus-get-function gnus-command-method 'warp-to-article)))
+     (and (bound-and-true-p gnus-registry-enabled)
+          (gnus-try-warping-via-registry)))))
 
 (defun gnus-request-head (article group)
   "Request the head of ARTICLE in GROUP."
-- 
1.8.3.1


[-- Attachment #3: Type: text/plain, Size: 19 bytes --]


-- 
Dave Abrahams

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

* Re: Proposal: gnus-refer-article
  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
  0 siblings, 2 replies; 12+ messages in thread
From: Lars Magne Ingebrigtsen @ 2013-08-05  2:16 UTC (permalink / raw)
  To: Dave Abrahams; +Cc: ding

Dave Abrahams <dave@boostpro.com> writes:

> voilà:

Thanks; applied.  Could you respin `gnus-refer-article' to use this new
setup?

-- 
(domestic pets only, the antidote for overdose, milk.)
  No Gnus T-Shirt for sale: http://ingebrigtsen.no/no.php
  and http://lars.ingebrigtsen.no/2013/08/twenty-years-of-september.html



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

* Re: Proposal: gnus-refer-article
  2013-08-05  2:16             ` Lars Magne Ingebrigtsen
@ 2013-08-05  5:10               ` Dave Abrahams
  2013-09-29  2:12               ` Dave Abrahams
  1 sibling, 0 replies; 12+ messages in thread
From: Dave Abrahams @ 2013-08-05  5:10 UTC (permalink / raw)
  To: Lars Magne Ingebrigtsen; +Cc: ding


on Sun Aug 04 2013, Lars Magne Ingebrigtsen <larsi-AT-gnus.org> wrote:

> Dave Abrahams <dave@boostpro.com> writes:
>
>> voilà:
>
> Thanks; applied.  Could you respin `gnus-refer-article' to use this new
> setup?

Not sure when I'll get to it.

-- 
Dave Abrahams



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

* Re: Proposal: gnus-refer-article
  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
  1 sibling, 2 replies; 12+ messages in thread
From: Dave Abrahams @ 2013-09-29  2:12 UTC (permalink / raw)
  To: Lars Magne Ingebrigtsen; +Cc: ding


on Sun Aug 04 2013, Lars Magne Ingebrigtsen <larsi-AT-gnus.org> wrote:

> Dave Abrahams <dave@boostpro.com> writes:
>
>> voilà:
>
> Thanks; applied.  Could you respin `gnus-refer-article' to use this new
> setup?

OK, here it is.  One side-effect of using nndoc instead of a custom
method is that the mode line of the resulting buffer is not as pretty.
I'm sure someone like you could address that pretty quickly, though, if
you care.

--8<---------------cut here---------------start------------->8---
(require 'nndoc)

(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
       `(nndoc ,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)
    ))
--8<---------------cut here---------------end--------------->8---

-- 
Dave Abrahams



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

* Re: Proposal: gnus-refer-article
  2013-09-29  2:12               ` Dave Abrahams
@ 2013-10-03  3:27                 ` Eric Abrahamsen
  2014-02-01  0:00                 ` Lars Ingebrigtsen
  1 sibling, 0 replies; 12+ messages in thread
From: Eric Abrahamsen @ 2013-10-03  3:27 UTC (permalink / raw)
  To: ding

Dave Abrahams <dave@boostpro.com> writes:

> on Sun Aug 04 2013, Lars Magne Ingebrigtsen <larsi-AT-gnus.org> wrote:
>
>> Dave Abrahams <dave@boostpro.com> writes:
>>
>>> voilà:
>>
>> Thanks; applied.  Could you respin `gnus-refer-article' to use this new
>> setup?
>
> OK, here it is.  One side-effect of using nndoc instead of a custom
> method is that the mode line of the resulting buffer is not as pretty.
> I'm sure someone like you could address that pretty quickly, though, if
> you care.

Hey is this something that could be used to replace the org-mode links
to gnus messages? I find the current implementation[1] often doesn't
work. Can gnus-refer-article locate a message with nothing but message
ID, or does it also need the backend and group?

E

[1] the function `org-gnus-follow-link' here:
http://orgmode.org/cgit.cgi/org-mode.git/plain/lisp/org-gnus.el




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

* Re: Proposal: gnus-refer-article
  2013-09-29  2:12               ` Dave Abrahams
  2013-10-03  3:27                 ` Eric Abrahamsen
@ 2014-02-01  0:00                 ` Lars Ingebrigtsen
  1 sibling, 0 replies; 12+ messages in thread
From: Lars Ingebrigtsen @ 2014-02-01  0:00 UTC (permalink / raw)
  To: Dave Abrahams; +Cc: ding

Dave Abrahams <dave@boostpro.com> writes:

>> Thanks; applied.  Could you respin `gnus-refer-article' to use this new
>> setup?
>
> OK, here it is.

I've now installed your command in Ma Gnus 0.10, but I changed the name
to `gnus-summary-open-group-with-article' to avoid confusion with the
other commands that have "refer" in their names.

-- 
(domestic pets only, the antidote for overdose, milk.)
  bloggy blog http://lars.ingebrigtsen.no/



^ 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).