* [PATCH 1/5] Allow gnus-summary-insert-subject to work in empty groups.
2012-03-15 18:23 [PATCH 0/5] *** Resubmit: Warping via the registry *** Dave Abrahams
@ 2012-03-15 18:23 ` Dave Abrahams
2012-03-15 18:23 ` [PATCH 2/5] Record information in the registry about each article retrieved Dave Abrahams
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Dave Abrahams @ 2012-03-15 18:23 UTC (permalink / raw)
To: ding; +Cc: Dave Abrahams
In groups that haven't been populated yet, the minimum and maximum
article numbers are nil; that wasn't accounted for
---
lisp/gnus-sum.el | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/lisp/gnus-sum.el b/lisp/gnus-sum.el
index 46e246f..8c7334a 100644
--- a/lisp/gnus-sum.el
+++ b/lisp/gnus-sum.el
@@ -6626,9 +6626,9 @@ too, instead of trying to fetch new headers."
;; article if ID is a number -- so that the next `P' or `N'
;; command will fetch the previous (or next) article even
;; if the one we tried to fetch this time has been canceled.
- (when (> number gnus-newsgroup-end)
+ (unless (and gnus-newsgroup-end (< number gnus-newsgroup-end))
(setq gnus-newsgroup-end number))
- (when (< number gnus-newsgroup-begin)
+ (unless (and gnus-newsgroup-begin (> number gnus-newsgroup-begin))
(setq gnus-newsgroup-begin number))
(setq gnus-newsgroup-unselected
(delq number gnus-newsgroup-unselected)))
--
1.7.5.4
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 2/5] Record information in the registry about each article retrieved
2012-03-15 18:23 [PATCH 0/5] *** Resubmit: Warping via the registry *** Dave Abrahams
2012-03-15 18:23 ` [PATCH 1/5] Allow gnus-summary-insert-subject to work in empty groups Dave Abrahams
@ 2012-03-15 18:23 ` Dave Abrahams
2012-03-15 18:23 ` [PATCH 3/5] Add `gnus-select-group-with-message-id' Dave Abrahams
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Dave Abrahams @ 2012-03-15 18:23 UTC (permalink / raw)
To: ding; +Cc: Dave Abrahams
---
lisp/gnus-sum.el | 7 +++++++
1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/lisp/gnus-sum.el b/lisp/gnus-sum.el
index 8c7334a..b37562d 100644
--- a/lisp/gnus-sum.el
+++ b/lisp/gnus-sum.el
@@ -12428,6 +12428,13 @@ If REVERSE, save parts that do not match TYPE."
(not (setq header (car (gnus-get-newsgroup-headers nil t)))))
() ; Malformed head.
(unless (gnus-summary-article-sparse-p (mail-header-number header))
+ (when (and (bound-and-true-p gnus-registry-enabled)
+ (not (gnus-ephemeral-group-p (car where))))
+ (gnus-registry-handle-action
+ (mail-header-id header) nil
+ (gnus-group-prefixed-name (car where) gnus-override-method)
+ (mail-header-subject header)
+ (mail-header-from header)))
(when (and (stringp id)
(or
(not (string= (gnus-group-real-name group)
--
1.7.5.4
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 3/5] Add `gnus-select-group-with-message-id'
2012-03-15 18:23 [PATCH 0/5] *** Resubmit: Warping via the registry *** Dave Abrahams
2012-03-15 18:23 ` [PATCH 1/5] Allow gnus-summary-insert-subject to work in empty groups Dave Abrahams
2012-03-15 18:23 ` [PATCH 2/5] Record information in the registry about each article retrieved Dave Abrahams
@ 2012-03-15 18:23 ` Dave Abrahams
2012-03-15 18:23 ` [PATCH 4/5] Add `gnus-try-warping-via-registry()' Dave Abrahams
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Dave Abrahams @ 2012-03-15 18:23 UTC (permalink / raw)
To: ding; +Cc: Dave Abrahams
---
lisp/gnus-int.el | 43 +++++++++++++++++++++++++++++++++++++++++++
1 files changed, 43 insertions(+), 0 deletions(-)
diff --git a/lisp/gnus-int.el b/lisp/gnus-int.el
index 1190d79..8a00c4a 100644
--- a/lisp/gnus-int.el
+++ b/lisp/gnus-int.el
@@ -533,6 +533,49 @@ If BUFFER, insert the article in that group."
header
(gnus-group-real-name group))))
+(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)))))
+
(defun gnus-warp-to-article ()
"Warps from an article in a virtual group to the article in its
real group. Does nothing on a real group."
--
1.7.5.4
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 4/5] Add `gnus-try-warping-via-registry()'
2012-03-15 18:23 [PATCH 0/5] *** Resubmit: Warping via the registry *** Dave Abrahams
` (2 preceding siblings ...)
2012-03-15 18:23 ` [PATCH 3/5] Add `gnus-select-group-with-message-id' Dave Abrahams
@ 2012-03-15 18:23 ` Dave Abrahams
2012-03-15 18:23 ` [PATCH 5/5] Enable registry-warping as a fallback if warping via the current backend fails Dave Abrahams
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: Dave Abrahams @ 2012-03-15 18:23 UTC (permalink / raw)
To: ding; +Cc: Dave Abrahams
The new function attempts to warp to the article based on group
information stored for the article in the registry.
---
lisp/gnus-int.el | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 50 insertions(+), 0 deletions(-)
diff --git a/lisp/gnus-int.el b/lisp/gnus-int.el
index 8a00c4a..4ae6e2a 100644
--- a/lisp/gnus-int.el
+++ b/lisp/gnus-int.el
@@ -576,6 +576,56 @@ the group's summary.
(error (when group-is-new (gnus-summary-exit))
(apply 'signal err)))))
+(defun gnus-simplify-group-name (group)
+ "Return the simplest representation of the name of GROUP.
+This is the string that Gnus uses to identify the group."
+ (gnus-group-prefixed-name
+ (gnus-group-real-name group)
+ (gnus-group-method group)))
+
+;; largely based on nnir-warp-to-article
+(defun gnus-try-warping-via-registry ()
+ "Attempt to warp to the current article's source group based on
+data stored in the registry."
+ (interactive)
+ (when (gnus-summary-article-header)
+ (let* ((message-id (mail-header-id (gnus-summary-article-header)))
+ ;; Retrieve the message's group(s) from the registry
+ (groups (gnus-registry-get-id-key message-id 'group))
+ ;; If starting from an ephemeral group, this describes
+ ;; how to restore the window configuration
+ (quit-config
+ (gnus-ephemeral-group-p gnus-newsgroup-name))
+ (seen-groups (list (gnus-group-group-name))))
+
+ (catch 'found
+ (dolist (group (mapcar 'gnus-simplify-group-name groups))
+
+ ;; skip over any groups we really don't want to warp to.
+ (unless (or (member group seen-groups)
+ (gnus-ephemeral-group-p group) ;; any ephemeral group
+ (memq (car (gnus-find-method-for-group group))
+ '(nnir))) ;; Specific methods; this list may need to expand.
+
+ ;; remember that we've seen this group already
+ (push group seen-groups)
+
+ ;; first exit from any ephemeral summary buffer.
+ (when quit-config
+ (gnus-summary-exit)
+ ;; and if the ephemeral summary buffer in turn came from another
+ ;; summary buffer we have to clean that summary up too.
+ (when (eq (cdr quit-config) 'summary)
+ (gnus-summary-exit))
+ ;; remember that we've already done this part
+ (setq quit-config nil))
+
+ ;; Try to activate the group. If that fails, just move
+ ;; along. We may have more groups to work with
+ (ignore-errors
+ (gnus-select-group-with-message-id group message-id))
+ (throw 'found t)))))))
+
(defun gnus-warp-to-article ()
"Warps from an article in a virtual group to the article in its
real group. Does nothing on a real group."
--
1.7.5.4
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 5/5] Enable registry-warping as a fallback if warping via the current backend fails.
2012-03-15 18:23 [PATCH 0/5] *** Resubmit: Warping via the registry *** Dave Abrahams
` (3 preceding siblings ...)
2012-03-15 18:23 ` [PATCH 4/5] Add `gnus-try-warping-via-registry()' Dave Abrahams
@ 2012-03-15 18:23 ` Dave Abrahams
2012-03-19 17:05 ` [PATCH 0/5] *** Resubmit: Warping via the registry *** Ted Zlatanov
2012-03-22 20:59 ` Lars Magne Ingebrigtsen
6 siblings, 0 replies; 8+ messages in thread
From: Dave Abrahams @ 2012-03-15 18:23 UTC (permalink / raw)
To: ding; +Cc: Dave Abrahams
---
lisp/gnus-int.el | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/lisp/gnus-int.el b/lisp/gnus-int.el
index 4ae6e2a..d858c3a 100644
--- a/lisp/gnus-int.el
+++ b/lisp/gnus-int.el
@@ -632,9 +632,11 @@ real group. Does nothing on a real group."
(interactive)
(let ((gnus-command-method
(gnus-find-method-for-group gnus-newsgroup-name)))
- (when (gnus-check-backend-function
- 'warp-to-article (car gnus-command-method))
- (funcall (gnus-get-function gnus-command-method 'warp-to-article)))))
+ (or
+ (when (gnus-check-backend-function
+ 'warp-to-article (car gnus-command-method))
+ (funcall (gnus-get-function gnus-command-method 'warp-to-article)))
+ (gnus-try-warping-via-registry))))
(defun gnus-request-head (article group)
"Request the head of ARTICLE in GROUP."
--
1.7.5.4
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 0/5] *** Resubmit: Warping via the registry ***
2012-03-15 18:23 [PATCH 0/5] *** Resubmit: Warping via the registry *** Dave Abrahams
` (4 preceding siblings ...)
2012-03-15 18:23 ` [PATCH 5/5] Enable registry-warping as a fallback if warping via the current backend fails Dave Abrahams
@ 2012-03-19 17:05 ` Ted Zlatanov
2012-03-22 20:59 ` Lars Magne Ingebrigtsen
6 siblings, 0 replies; 8+ messages in thread
From: Ted Zlatanov @ 2012-03-19 17:05 UTC (permalink / raw)
To: ding
On Thu, 15 Mar 2012 14:23:08 -0400 Dave Abrahams <dave@boostpro.com> wrote:
DA> Note: I submitted this patch series back in October
DA> (http://permalink.gmane.org/gmane.emacs.gnus.general/80250). It still
DA> applies perfectly, but I rebased just in case. I'd really appreciate
DA> it if this series could get some attention. Further explanation of
DA> the motivation for this series is in
DA> http://article.gmane.org/gmane.emacs.gnus.general/80277. Thanks!
DA> This patch series implements the ability to warp to a message via
DA> information stored in the Gnus registry. From a user's point-of-view,
DA> this means that articles brought in from other groups by
DA> gnus-*-refer-* can be used as a jumping-off-point for further
DA> references.
Sorry for forgetting about this. I think you were still waiting on your
papers back then. I'm OK with this patch. If an XEmacs user could try
it too, that would be very helpful, but I think it's reasonable and
generally useful.
Ted
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 0/5] *** Resubmit: Warping via the registry ***
2012-03-15 18:23 [PATCH 0/5] *** Resubmit: Warping via the registry *** Dave Abrahams
` (5 preceding siblings ...)
2012-03-19 17:05 ` [PATCH 0/5] *** Resubmit: Warping via the registry *** Ted Zlatanov
@ 2012-03-22 20:59 ` Lars Magne Ingebrigtsen
6 siblings, 0 replies; 8+ messages in thread
From: Lars Magne Ingebrigtsen @ 2012-03-22 20:59 UTC (permalink / raw)
To: Dave Abrahams; +Cc: ding
Dave Abrahams <dave@boostpro.com> writes:
> Note: I submitted this patch series back in October
> (http://permalink.gmane.org/gmane.emacs.gnus.general/80250). It still
> applies perfectly, but I rebased just in case. I'd really appreciate
> it if this series could get some attention. Further explanation of
> the motivation for this series is in
> http://article.gmane.org/gmane.emacs.gnus.general/80277. Thanks!
Thanks; applied.
I've rearranged the code a bit to silence the resulting compilation
warnings.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog http://lars.ingebrigtsen.no/
^ permalink raw reply [flat|nested] 8+ messages in thread