[gnus git] branch master updated: m0-5-287-g40499d3 =1= nnir.el: Allow nnir group creation based on an existing query.

Andrew Cohen <[email protected]>
Newsgroups gmane.emacs.gnus.cvs
Message-ID <[email protected]>
       via  40499d31258a1e348786da7dc56ea9c199d855c7 (commit)
      from  abc27269e73081391b76b6bb88363875f0e26ce2 (commit)


- Log -----------------------------------------------------------------
commit 40499d31258a1e348786da7dc56ea9c199d855c7
Author: Andrew Cohen <[email protected]>
Date:   Fri Mar 29 09:40:09 2013 -0400

    nnir.el: Allow nnir group creation based on an existing query.

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 55dc9aa..991c6ae 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,11 @@
+2013-03-29  Andrew Cohen  <[email protected]>
+
+	* nnir.el: Define 'number-sequence for xemacs.
+	(gnus-summary-create-nnir-group): New function to create an nnir group
+	from an nnir summary buffer based on the current query.
+	(nnir-request-create-group): Update to allow nnir group creation based
+	on the current query.
+
 2013-03-28  Katsumi Yamaoka  <[email protected]>
 
 	* nndraft.el (nndraft-request-expire-articles):
diff --git a/lisp/nnir.el b/lisp/nnir.el
index 8f4e818..468cd95 100644
--- a/lisp/nnir.el
+++ b/lisp/nnir.el
@@ -173,7 +173,15 @@
 
 ;; For Emacs <22.2 and XEmacs.
 (eval-and-compile
-  (unless (fboundp 'declare-function) (defmacro declare-function (&rest r))))
+  (unless (fboundp 'declare-function) (defmacro declare-function (&rest r)))
+  (unless (fboundp 'number-sequence)
+    (defun number-sequence (from to)
+      (let (seq (n 0) (next from))
+	(while (<= next to)
+	  (setq seq (cons next seq)
+		n (1+ n)
+		next (+ from  n )))
+	(nreverse seq)))))
 
 (require 'nnoo)
 (require 'gnus-group)
@@ -1840,24 +1848,38 @@ article came from is also searched."
       (add-hook 'gnus-summary-article-expire-hook 'nnir-registry-action t t))))
 
 
+(defun gnus-summary-create-nnir-group ()
+  (interactive)
+  (let ((name (gnus-read-group "Group name: "))
+	(method "nnir")
+	(pgroup (if (gnus-group-prefixed-p gnus-newsgroup-name)
+		    gnus-newsgroup-name
+		  (gnus-group-prefixed-name
+		   gnus-newsgroup-name '(nnir "nnir")))))
+    (with-current-buffer gnus-group-buffer
+      (gnus-group-make-group
+       name method nil
+       (gnus-group-find-parameter pgroup)))))
+
 
 (deffoo nnir-request-create-group (group &optional server args)
   (message "Creating nnir group %s" group)
-  (let ((group (gnus-group-prefixed-name  group '(nnir "nnir")))
+  (let* ((group (gnus-group-prefixed-name  group '(nnir "nnir")))
+         (specs (assoc 'nnir-specs args))
 	(query-spec
+          (or (cdr (assoc 'nnir-query-spec specs))
 	  (list (cons 'query
-		      (read-string "Query: " nil 'nnir-search-history))))
-	 (group-spec (list (list (read-string "Server: " nil nil)))))
-    (gnus-group-set-parameter
-     group 'nnir-specs
-     (list (cons 'nnir-query-spec query-spec)
-	   (cons 'nnir-group-spec group-spec)))
+                          (read-string "Query: " nil 'nnir-search-history)))))
+         (group-spec
+          (or (cdr (assoc 'nnir-group-spec specs))
+              (list (list (read-string "Server: " nil nil)))))
+         (nnir-specs (list (cons 'nnir-query-spec query-spec)
+                           (cons 'nnir-group-spec group-spec))))
+    (gnus-group-set-parameter group 'nnir-specs nnir-specs)
     (gnus-group-set-parameter
      group 'nnir-artlist
-     (setq nnir-artlist
-	   (nnir-run-query
-	    (list (cons 'nnir-query-spec query-spec)
-		  (cons 'nnir-group-spec group-spec)))))
+     (or (cdr (assoc 'nnir-artlist args))
+         (nnir-run-query nnir-specs)))
     (nnir-request-update-info group (gnus-get-info group)))
   t)
 

-----------------------------------------------------------------------
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we listed those
revisions in full, above.

Summary of changes:
 lisp/ChangeLog |    8 ++++++++
 lisp/nnir.el   |   50 ++++++++++++++++++++++++++++++++++++--------------
 2 files changed, 44 insertions(+), 14 deletions(-)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnus Project".

The branch, master has been updated


hooks/post-receive
-- 
Gnus Project
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.