emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] scratch/gnus-search 66a7735 20/30: WIP on rebase


From: Eric Abrahamsen
Subject: [Emacs-diffs] scratch/gnus-search 66a7735 20/30: WIP on rebase
Date: Thu, 1 Jun 2017 03:50:23 -0400 (EDT)

branch: scratch/gnus-search
commit 66a7735817d17c75df916e0987da892a5c213271
Author: Eric Abrahamsen <address@hidden>
Commit: Eric Abrahamsen <address@hidden>

    WIP on rebase
---
 lisp/gnus/gnus-group.el  | 87 +++++++-----------------------------------------
 lisp/gnus/gnus-search.el |  2 +-
 lisp/gnus/nnselect.el    | 17 +++-------
 3 files changed, 17 insertions(+), 89 deletions(-)

diff --git a/lisp/gnus/gnus-group.el b/lisp/gnus/gnus-group.el
index 8f7dc92..6e4a649 100644
--- a/lisp/gnus/gnus-group.el
+++ b/lisp/gnus/gnus-group.el
@@ -41,7 +41,6 @@
 
 (eval-when-compile
   (require 'mm-url)
-  (require 'nnselect)
   (let ((features (cons 'gnus-group features)))
     (require 'gnus-sum))
   (unless (boundp 'gnus-cache-active-hashtb)
@@ -2798,67 +2797,6 @@ server."
               (nnheader-get-report backend))))
     t))
 
-(defun gnus-group-make-permanent-search-group (&optional arg specs)
-  (interactive "P")
-  (gnus-group-make-search-group arg t specs))
-
-(defun gnus-group-make-search-group (&optional arg perm specs)
-  "Create an nnselect group based on a search.  Prompt for a
-search query and determine the groups to search as follows: if
-called from the *Server* buffer search all groups belonging to
-the server on the current line; if called from the *Group* buffer
-search any marked groups, or the group on the current line, or
-all the groups under the current topic. Calling with a prefix-arg
-means the search query will be passed raw to the . A
-non-nil `specs' arg must be an alist with `search-query-spec' and
-`search-group-spec' keys, and skips all prompting."
-  (interactive "P")
-  (require 'gnus-search)
-  (let* ((group-spec
-         (or (cdr (assq 'search-group-spec specs))
-           (if (gnus-server-server-name)
-               (list (list (gnus-server-server-name)))
-             (nnselect-categorize
-              (or gnus-group-marked
-                  (if (gnus-group-group-name)
-                      (list (gnus-group-group-name))
-                    (when (gnus-topic-mode-p)
-                      (cdr (assoc (gnus-group-topic-name) gnus-topic-alist)))))
-              gnus-group-server))))
-        (query-spec
-         (or (cdr (assq 'search-query-spec specs))
-           (list (cons 'query
-                       (read-string "Query: " nil 'gnus-search-history))
-                 (cons 'raw arg)))))
-    (if perm
-       (let ((name (read-string "Group name: " nil)))
-         (gnus-group-make-group
-          name
-          (list 'nnselect "nnselect")
-          nil
-          (list
-           (cons 'nnselect-specs
-                 (list
-                  (cons 'nnselect-function 'gnus-search-run-query)
-                  (cons 'nnselect-args
-                        (list (cons 'search-query-spec query-spec)
-                              (cons 'search-group-spec group-spec))))))))
-      (gnus-group-read-ephemeral-group
-       (concat "nnselect-" (message-unique-id))
-       (list 'nnselect "nnselect")
-       nil
-       (cons (current-buffer) gnus-current-window-configuration)
-                                       ;     nil
-       nil nil
-       (list
-       (cons 'nnselect-specs
-             (list
-              (cons 'nnselect-function 'gnus-search-run-query)
-              (cons 'nnselect-args
-                    (list (cons 'search-query-spec query-spec)
-                          (cons 'search-group-spec group-spec)))))
-       (cons 'nnselect-artlist nil))))))
-
 (defun gnus-group-delete-groups (&optional arg)
   "Delete the current group.  Only meaningful with editable groups."
   (interactive "P")
@@ -3258,15 +3196,14 @@ mail messages or news articles in files that have 
numeric names."
      (gnus-group-real-name group)
      (list 'nndir (gnus-group-real-name group) (list 'nndir-directory dir)))))
 
-
-(autoload 'nnir-make-specs "nnir")
+(autoload 'gnus-search-make-specs "gnus-search")
 (autoload 'gnus-group-topic-name "gnus-topic")
 
 ;; Temporary to make group creation easier
-(defun gnus-group-make-search-group (nnir-extra-parms &optional specs)
+(defun gnus-group-make-search-group (arg &optional specs)
   (interactive "P")
-  (let ((name (gnus-read-group "Group name: ")))
-    (with-current-buffer gnus-group-buffer
+  (let ((name (read-string "Group name: " nil)))
+     (with-current-buffer gnus-group-buffer
       (gnus-group-make-group
        name
        (list 'nnselect "nnselect")
@@ -3274,20 +3211,20 @@ mail messages or news articles in files that have 
numeric names."
        (list
        (cons 'nnselect-specs
              (list
-              (cons 'nnselect-function 'nnir-run-query)
+              (cons 'nnselect-function 'gnus-search-run-query)
               (cons 'nnselect-args
-                    (nnir-make-specs nnir-extra-parms specs)))))))))
+                    (gnus-search-make-specs arg specs))))))))
 
-(defun gnus-group-read-ephemeral-search-group (nnir-extra-parms        
&optional specs)
+(defun gnus-group-read-ephemeral-search-group (arg &optional specs)
   "Create an nnselect group based on a search.  Prompt for a
 search query and determine the groups to search as follows: if
 called from the *Server* buffer search all groups belonging to
 the server on the current line; if called from the *Group* buffer
 search any marked groups, or the group on the current line, or
 all the groups under the current topic. Calling with a prefix-arg
-prompts for additional search-engine specific constraints. A
-non-nil `specs' arg must be an alist with `nnir-query-spec' and
-`nnir-group-spec' keys, and skips all prompting."
+prevents parsing of the query. A non-nil `specs' arg must be an
+alist with `search-query-spec' and `search-group-spec' keys, and
+skips all prompting."
   (interactive "P")
   (gnus-group-read-ephemeral-group
    (concat "nnselect-" (message-unique-id))
@@ -3299,9 +3236,9 @@ non-nil `specs' arg must be an alist with 
`nnir-query-spec' and
    (list
     (cons 'nnselect-specs
          (list
-          (cons 'nnselect-function 'nnir-run-query)
+          (cons 'nnselect-function 'gnus-search-run-query)
           (cons 'nnselect-args
-                (nnir-make-specs nnir-extra-parms specs))))
+                (gnus-search-make-specs arg specs))))
     (cons 'nnselect-artlist nil))))
 
 (defun gnus-group-add-to-virtual (n vgroup)
diff --git a/lisp/gnus/gnus-search.el b/lisp/gnus/gnus-search.el
index bf53dd2..c23a0f8 100644
--- a/lisp/gnus/gnus-search.el
+++ b/lisp/gnus/gnus-search.el
@@ -2068,7 +2068,7 @@ Assume \"size\" key is equal to \"larger\"."
      (lambda (x)
        (let* ((server (car x))
              (search-engine (gnus-search-server-to-engine server))
-             (groups (cadr x)))
+             (groups (cdr x)))
         (setq results
               (vconcat
                (gnus-search-run-search
diff --git a/lisp/gnus/nnselect.el b/lisp/gnus/nnselect.el
index ad062ef..2f2c9dd 100644
--- a/lisp/gnus/nnselect.el
+++ b/lisp/gnus/nnselect.el
@@ -48,7 +48,7 @@
 
 
 (require 'gnus-art)
-(require 'nnir)
+(require 'gnus-search)
 
 (eval-when-compile (require 'cl-lib))
 
@@ -656,15 +656,6 @@ If this variable is nil, or if the provided function 
returns nil,
     group))
 
 
-;; (defun nnselect-server-opened (&optional server)
-;;   "Open SERVER if not yet opened."
-;;   (let ((backend (car (gnus-server-to-method server))))
-;;     (nnoo-current-server-p (or backend 'nnselect) server)))
-
-(deffoo nnselect-server-opened (&optional _server)
-  t)
-
-
 (declare-function gnus-registry-get-id-key "gnus-registry"
                   (id key))
 (defun nnselect-search-thread (header)
@@ -803,17 +794,17 @@ originating groups."
 
 (declare-function gnus-registry-get-id-key "gnus-registry" (id key))
 
-(defun gnus-summary-make-search-group (nnir-extra-parms)
+(defun gnus-summary-make-search-group (extra-parms)
   "Search a group from the summary buffer."
   (interactive "P")
   (gnus-warp-to-article)
   (let ((spec
         (list
-         (cons 'nnir-group-spec
+         (cons 'search-group-spec
                (list (list
                       (gnus-group-server gnus-newsgroup-name)
                       gnus-newsgroup-name))))))
-    (gnus-group-make-search-group nnir-extra-parms spec)))
+    (gnus-group-make-search-group extra-parms spec)))
 
 ;; The end.
 (provide 'nnselect)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]