From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/74018 Path: news.gmane.org!not-for-mail From: Andrew Cohen Newsgroups: gmane.emacs.gnus.general Subject: Re: nnir and move Date: Wed, 10 Nov 2010 13:42:28 -0500 Message-ID: <87k4klt3zf.fsf@andy.bu.edu> References: <87wrox5jyh.fsf@andy.bu.edu> <87sjzl5jis.fsf@andy.bu.edu> <8739rl5d9d.fsf@andy.bu.edu> <87vd4h3xmh.fsf@andy.bu.edu> <87sjzap2yk.fsf@lifelogs.com> <87oc9xt9mi.fsf@andy.bu.edu> <87sjz9m83m.fsf@lifelogs.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: dough.gmane.org 1289414589 28666 80.91.229.12 (10 Nov 2010 18:43:09 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 10 Nov 2010 18:43:09 +0000 (UTC) To: ding@gnus.org Original-X-From: ding-owner+M22386@lists.math.uh.edu Wed Nov 10 19:43:05 2010 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PGFdQ-0005BN-KZ for ding-account@gmane.org; Wed, 10 Nov 2010 19:43:05 +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 1PGFdB-0008M4-PJ; Wed, 10 Nov 2010 12:42:49 -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 1PGFd9-0008Ll-D3 for ding@lists.math.uh.edu; Wed, 10 Nov 2010 12:42:47 -0600 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx1.math.uh.edu with esmtp (Exim 4.72) (envelope-from ) id 1PGFd7-0006p5-C6 for ding@lists.math.uh.edu; Wed, 10 Nov 2010 12:42:46 -0600 Original-Received: from lo.gmane.org ([80.91.229.12]) by quimby.gnus.org with esmtp (Exim 3.36 #1 (Debian)) id 1PGFd6-0005Gs-00 for ; Wed, 10 Nov 2010 19:42:44 +0100 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1PGFd5-0004xS-He for ding@gnus.org; Wed, 10 Nov 2010 19:42:43 +0100 Original-Received: from rain.gmane.org ([80.91.229.7]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 10 Nov 2010 19:42:43 +0100 Original-Received: from cohen by rain.gmane.org with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 10 Nov 2010 19:42:43 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 134 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: rain.gmane.org User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/24.0.50 (gnu/linux) Cancel-Lock: sha1:N71w/htpLFsNvF9ZRE3Pcty4cxw= X-Spam-Score: -1.9 (-) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:74018 Archived-At: --=-=-= Content-Type: text/plain >>>>> "Ted" == Ted Zlatanov 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. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=tmp.diff Content-Description: possible patch 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 --=-=-=--