Function: gnus-read-move-group-name

gnus-read-move-group-name is a byte-compiled function defined in gnus-sum.el.gz.

Signature

(gnus-read-move-group-name PROMPT DEFAULT ARTICLES PREFIX)

Documentation

Read a group name.

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/gnus-sum.el.gz
(defun gnus-read-move-group-name (prompt default articles prefix)
  "Read a group name."
  (let* ((split-name (gnus-get-split-value gnus-move-split-methods))
	 (prom
	  (format "%s %s to"
		  prompt
		  (if (> (length articles) 1)
		      (format "these %d articles" (length articles))
		    "this article")))
	 (valid-names
	  (seq-filter #'gnus-valid-move-group-p
		      (hash-table-keys gnus-active-hashtb)))
	 (to-newsgroup
          (cond
           ((null split-name)
            (gnus-group-completing-read
             prom
	     valid-names
             nil prefix nil default))
           ((= 1 (length split-name))
            (gnus-group-completing-read
             prom
	     valid-names
             nil prefix 'gnus-group-history (car split-name)))
           (t
            (gnus-completing-read
             prom (nreverse split-name) nil nil 'gnus-group-history))))
         (to-method (gnus-server-to-method (gnus-group-method to-newsgroup))))
    (when to-newsgroup
      (if (or (string= to-newsgroup "")
	      (string= to-newsgroup prefix))
	  (setq to-newsgroup default))
      (unless to-newsgroup
	(error "No group name entered"))
      (or (gnus-active to-newsgroup)
	  (gnus-activate-group to-newsgroup nil nil to-method)
	  (if (gnus-y-or-n-p (format "No such group: %s.  Create it? "
				     to-newsgroup))
	      (or (and (gnus-request-create-group to-newsgroup to-method)
		       (gnus-activate-group to-newsgroup nil nil to-method)
		       (gnus-subscribe-group to-newsgroup))
		  (error "Couldn't create group %s" to-newsgroup)))
	  (user-error "No such group: %s" to-newsgroup))
      to-newsgroup)))