Function: gnus-group-make-search-group

gnus-group-make-search-group is an interactive and byte-compiled function defined in gnus-group.el.gz.

Signature

(gnus-group-make-search-group NO-PARSE &optional SPECS)

Documentation

Make a 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. A prefix arg NO-PARSE means that Gnus should not parse the search query before passing it to the underlying search engine. A non-nil SPECS arg must be an alist with search-query-spec and search-group-spec keys, and skips all prompting.

Probably introduced at or before Emacs version 28.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/gnus-group.el.gz
;; Temporary to make group creation easier
(defun gnus-group-make-search-group (no-parse &optional specs)
  "Make a 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.  A
prefix arg NO-PARSE means that Gnus should not parse the search
query before passing it to the underlying search engine.  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-mode)
  (let ((name (gnus-read-group "Group name: ")))
    (with-current-buffer gnus-group-buffer
      (let* ((group-spec
	      (or
	       (cdr (assq 'search-group-spec specs))
	       (cdr (assq 'nnir-group-spec specs))
	       (if (gnus-server-server-name)
		   (list (list (gnus-server-server-name)))
		 (seq-group-by
		  (lambda (elt) (gnus-group-server elt))
		  (or gnus-group-marked
		      (if (gnus-group-group-name)
			  (list (gnus-group-group-name))
			(mapcar #'caadr
				(gnus-topic-find-groups
				 (gnus-group-topic-name)
				 nil 'all nil t))))))))
	     (query-spec
	      (or
	       (cdr (assq 'search-query-spec specs))
	       (cdr (assq 'nnir-query-spec specs))
	       (gnus-search-make-spec no-parse))))
	;; If our query came via an old call to nnir, we know not to
	;; parse the query.
	(when (assq 'nnir-query-spec specs)
	  (setf (alist-get 'raw query-spec) t))
	(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)))))
	  (cons 'nnselect-artlist nil)))))))