From: Andrew Cohen <cohen@andy.bu.edu>
To: ding@gnus.org
Subject: Re: nnir and move
Date: Wed, 10 Nov 2010 13:42:28 -0500 [thread overview]
Message-ID: <87k4klt3zf.fsf@andy.bu.edu> (raw)
In-Reply-To: <87sjz9m83m.fsf@lifelogs.com>
[-- Attachment #1: Type: text/plain, Size: 1825 bytes --]
>>>>> "Ted" == Ted Zlatanov <tzz@lifelogs.com> writes:
Ted> Could you use nnir-original-group and nnir-original-subject in
Ted> the let you said you would do? I'll make the names more
Ted> general if anyone else needs it but I was thinking this way
Ted> it's clear that it's a nnir requirement.
Ted> That way the registry will not care what nnir does to the
Ted> subject or group name, it will just take the originals from the
Ted> let-bound variables.
In fact I'm thinking about a different way (but this might not be best
way):
1. nnir ends up replacing the parsed header with a new one, so the
original subject isn't available anymore, but its easy enough to get
back with a simple string-match. And the only place the original subject
is used is in the registry, which is why I thought that it was best to
just modify gnus-registry-simplify-subject to:
(defun gnus-registry-simplify-subject (subject)
(if (stringp subject)
(progn
(string-match "^\\[[0-9]+:.+/[0-9]+\\] " subject)
(setq subject (substring subject (match-end 0)))
(gnus-simplify-subject subject))
nil))
2. As for the original newsgroup name, I am trying to avoid anything
nnir specific outside the nnir.el file. Its also possible that
other/future virtual backends might want to do something similar so I've
tried an approach that won't require special-casing. The trick is to
pass the original newsgroup name back in to gnus-summary-move-article. I
think this is easy---just introduce a let-bound variable
gnus-original-newsgroup-name initialized to gnus-newsgroup-name and let
the backend-specific 'request-move-article replace it as needed. So only
a few lines of changes and no need for nnir-specific code.
Sorry for being so wordy, and let me know if I'm off-base. Here is the
proposed patch.
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: possible patch --]
[-- Type: text/x-diff, Size: 2736 bytes --]
diff --git a/lisp/gnus-registry.el b/lisp/gnus-registry.el
index 79080f2..629d804 100644
--- a/lisp/gnus-registry.el
+++ b/lisp/gnus-registry.el
@@ -728,7 +728,10 @@ Consults `gnus-registry-unfollowed-groups' and
(defun gnus-registry-simplify-subject (subject)
(if (stringp subject)
- (gnus-simplify-subject subject)
+ (progn
+ (string-match "^\\[[0-9]+:.+/[0-9]+\\] " subject)
+ (setq subject (substring subject (match-end 0)))
+ (gnus-simplify-subject subject))
nil))
(defun gnus-registry-fetch-simplified-message-subject-fast (article)
diff --git a/lisp/gnus-sum.el b/lisp/gnus-sum.el
index 9715510..dd97b23 100644
--- a/lisp/gnus-sum.el
+++ b/lisp/gnus-sum.el
@@ -9703,6 +9703,7 @@ ACTION can be either `move' (the default), `crosspost' or `copy'."
articles)
(while articles
(setq article (pop articles))
+ (let ((gnus-original-newsgroup-name gnus-newsgroup-name))
(setq
art-group
(cond
@@ -9781,7 +9782,7 @@ ACTION can be either `move' (the default), `crosspost' or `copy'."
action
(gnus-data-header
(assoc article (gnus-data-list nil)))
- gnus-newsgroup-name nil
+ gnus-original-newsgroup-name nil
select-method)))
(t
(let* ((pto-group (gnus-group-prefixed-name
@@ -9881,7 +9882,7 @@ ACTION can be either `move' (the default), `crosspost' or `copy'."
action
(gnus-data-header
(assoc article (gnus-data-list nil)))
- gnus-newsgroup-name
+ gnus-original-newsgroup-name
to-newsgroup
select-method))
@@ -9903,7 +9904,7 @@ ACTION can be either `move' (the default), `crosspost' or `copy'."
(gnus-kill-buffer copy-buf)
(gnus-summary-position-point)
- (gnus-set-mode-line 'summary)))
+ (gnus-set-mode-line 'summary))))
(defun gnus-summary-copy-article (&optional n to-newsgroup select-method)
"Copy the current article to some other group.
diff --git a/lisp/nnir.el b/lisp/nnir.el
index ae6b903..a71f1f3 100644
--- a/lisp/nnir.el
+++ b/lisp/nnir.el
@@ -453,6 +453,9 @@ result, `gnus-retrieve-headers' will be called instead.")
(defvar nnir-extra-parms nil
"Internal: stores request for extra search parms")
+(defvar gnus-original-newsgroup-name nil
+ "Internal: stores the real newsgroup name")
+
;;; Code:
;; Gnus glue.
@@ -596,6 +600,7 @@ result, `gnus-retrieve-headers' will be called instead.")
(to-method (gnus-find-method-for-group to-newsgroup))
(from-method (gnus-find-method-for-group artfullgroup))
(move-is-internal (gnus-server-equal from-method to-method)))
+ (setq gnus-original-newsgroup-name artfullgroup)
(gnus-request-move-article
artno
artfullgroup
next prev parent reply other threads:[~2010-11-10 18:42 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-31 14:07 Richard Riley
2010-10-31 17:18 ` Lars Magne Ingebrigtsen
2010-11-01 4:20 ` Richard Riley
2010-11-01 12:04 ` Andrew Cohen
2010-11-01 12:08 ` Lars Magne Ingebrigtsen
2010-11-01 12:13 ` Andrew Cohen
2010-11-01 14:28 ` Andrew Cohen
2010-11-01 14:51 ` Andrew Cohen
2010-11-09 22:05 ` Ted Zlatanov
2010-11-10 16:40 ` Andrew Cohen
2010-11-10 16:55 ` Ted Zlatanov
2010-11-10 18:42 ` Andrew Cohen [this message]
2010-11-10 18:54 ` Ted Zlatanov
2010-11-10 19:09 ` Andrew Cohen
2010-11-15 2:40 ` Katsumi Yamaoka
2010-11-15 2:53 ` Andrew Cohen
2010-12-01 14:13 ` Andrew Cohen
2010-12-01 17:01 ` Lars Magne Ingebrigtsen
2010-12-01 17:47 ` Andrew Cohen
2010-12-01 17:50 ` Lars Magne Ingebrigtsen
2010-12-01 22:01 ` Andrew Cohen
2010-12-14 23:36 ` Ted Zlatanov
2010-11-03 1:05 Andrew Cohen
2010-11-03 12:17 ` Richard Riley
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=87k4klt3zf.fsf@andy.bu.edu \
--to=cohen@andy.bu.edu \
--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).