Function: gnus-group-kill-group

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

Signature

(gnus-group-kill-group &optional N DISCARD)

Documentation

Kill the next N groups.

The killed newsgroups can be yanked by using M-x gnus-group-yank-group (gnus-group-yank-group). However, only groups that were alive can be yanked; already killed groups or zombie groups can't be yanked. The return value is the name of the group that was killed, or a list of groups killed.

View in manual

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/gnus-group.el.gz
(defun gnus-group-kill-group (&optional n discard)
  "Kill the next N groups.
The killed newsgroups can be yanked by using \\[gnus-group-yank-group].
However, only groups that were alive can be yanked; already killed
groups or zombie groups can't be yanked.
The return value is the name of the group that was killed, or a list
of groups killed."
  (interactive "P" gnus-group-mode)
  (let ((buffer-read-only nil)
	(groups (gnus-group-process-prefix n))
	group entry level out)
    (if (< (length groups) 10)
	;; This is faster when there are few groups.
	(while groups
	  (push (setq group (pop groups)) out)
	  (gnus-group-remove-mark group)
	  (setq level (gnus-group-group-level))
	  (gnus-delete-line)
	  (when (and (not discard)
		     (setq entry (gnus-group-entry group)))
	    (gnus-undo-register
	      `(progn
		 (gnus-group-goto-group ,(gnus-group-group-name))
		 (gnus-group-yank-group)))
	    (push (cons (car entry) (nth 1 entry))
		  gnus-list-of-killed-groups))
	  (gnus-group-change-level
	   (if entry entry group) gnus-level-killed (if entry nil level))
	  ;; FIXME: Since the group has already been removed from
	  ;; `gnus-newsrc-hashtb', this check will always return nil.
	  (when (numberp (gnus-group-unread group))
	    (gnus-request-update-group-status group 'unsubscribe))
	  (message "Killed group %s" group))
      ;; If there are lots and lots of groups to be killed, we use
      ;; this thing instead.
      (dolist (group (nreverse groups))
	(gnus-group-remove-mark group)
	(gnus-delete-line)
	(push group gnus-killed-list)
	(setq gnus-newsrc-alist
	      (delq (assoc group gnus-newsrc-alist)
		    gnus-newsrc-alist))
	(when gnus-group-change-level-function
	  (funcall gnus-group-change-level-function
		   group gnus-level-killed 3))
	(cond
	 ((setq entry (gnus-group-entry group))
	  (push (cons (car entry) (nth 1 entry))
		gnus-list-of-killed-groups)
	  (setcdr (cdr entry) (cdddr entry)))
	 ((member group gnus-zombie-list)
	  (setq gnus-zombie-list (delete group gnus-zombie-list))))
	;; There may be more than one instance displayed.
	(while (gnus-group-goto-group group)
	  (gnus-delete-line))
	(when (numberp (gnus-group-unread group))
	  (gnus-request-update-group-status group 'unsubscribe)))
      (gnus-make-hashtable-from-newsrc-alist))

    (gnus-group-position-point)
    (if (< (length out) 2) (car out) (nreverse out))))