[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] scratch/gnus-search 6e1e003 5/9: Move search group creatio
From: |
Eric Abrahamsen |
Subject: |
[Emacs-diffs] scratch/gnus-search 6e1e003 5/9: Move search group creation functions to gnus-group.el |
Date: |
Wed, 3 May 2017 11:54:55 -0400 (EDT) |
branch: scratch/gnus-search
commit 6e1e003fdb3c38dcd2fbb1677f20493ef4f82c28
Author: Eric Abrahamsen <address@hidden>
Commit: Eric Abrahamsen <address@hidden>
Move search group creation functions to gnus-group.el
* lisp/gnus/gnus-group.el (gnus-group-make-search-group,
gnus-group-make-permanent-search-group): These two functions live in
gnus.group.el now.
* lisp/gnus/gnus-search.el: Remove from here.
---
lisp/gnus/gnus-group.el | 60 +++++++++++++++++++++++++++++++++++++++++++
lisp/gnus/gnus-search.el | 66 ------------------------------------------------
2 files changed, 60 insertions(+), 66 deletions(-)
diff --git a/lisp/gnus/gnus-group.el b/lisp/gnus/gnus-group.el
index a61f70d..316b48a 100644
--- a/lisp/gnus/gnus-group.el
+++ b/lisp/gnus/gnus-group.el
@@ -52,6 +52,7 @@
(autoload 'gnus-cloud-upload-all-data "gnus-cloud")
(autoload 'gnus-cloud-download-all-data "gnus-cloud")
+(autoload 'gnus-registry-get-id-key "gnus-registry")
(defcustom gnus-no-groups-message "No news is good news"
"Message displayed by Gnus when no groups are available."
@@ -2795,6 +2796,65 @@ 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")
+ (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))
+ (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 'no-parse 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")
diff --git a/lisp/gnus/gnus-search.el b/lisp/gnus/gnus-search.el
index 27f4939..180888a 100644
--- a/lisp/gnus/gnus-search.el
+++ b/lisp/gnus/gnus-search.el
@@ -2015,71 +2015,5 @@ article came from is also searched."
(forward-line)))))
groups))
-;;; Interface with Gnus and nnselect
-
-(declare-function gnus-registry-get-id-key "gnus-registry" (id key))
-(declare-function gnus-group-topic-name "gnus-topic" ())
-
-;; Temporary to make group creation easier
-
-(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")
- (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))
- (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 'no-parse 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))))))
-
(provide 'gnus-search)
;;; gnus-search.el ends here
- [Emacs-diffs] branch scratch/gnus-search created (now ec2eadf), Eric Abrahamsen, 2017/05/03
- [Emacs-diffs] scratch/gnus-search a3e7edf 4/9: Add function gnus-search-prepare-query, Eric Abrahamsen, 2017/05/03
- [Emacs-diffs] scratch/gnus-search 741ccdc 6/9: Create general gnus-search-indexed-massage-output method, Eric Abrahamsen, 2017/05/03
- [Emacs-diffs] scratch/gnus-search 5c9bab3 3/9: Make related change to nnselect.el, Eric Abrahamsen, 2017/05/03
- [Emacs-diffs] scratch/gnus-search 05dbfee 7/9: Make related change to nnselect.el, Eric Abrahamsen, 2017/05/03
- [Emacs-diffs] scratch/gnus-search 6e1e003 5/9: Move search group creation functions to gnus-group.el,
Eric Abrahamsen <=
- [Emacs-diffs] scratch/gnus-search 2f27292 8/9: Handle regexp and wildcard search terms, Eric Abrahamsen, 2017/05/03
- [Emacs-diffs] scratch/gnus-search ec2eadf 9/9: Remove Hyrex search engine, Eric Abrahamsen, 2017/05/03
- [Emacs-diffs] scratch/gnus-search 8d71e81 1/9: WIP on a generalized search query language for Gnus, Eric Abrahamsen, 2017/05/03
- [Emacs-diffs] scratch/gnus-search 89700be 2/9: Rename nnir.el to gnus-search.el, Eric Abrahamsen, 2017/05/03