Function: gnus-summary-exit

gnus-summary-exit is an autoloaded, interactive and byte-compiled function defined in gnus-sum.el.gz.

Signature

(gnus-summary-exit &optional TEMPORARY LEAVE-HIDDEN)

Documentation

Exit reading current newsgroup, and then return to group selection mode.

gnus-exit-group-hook is called with no arguments if that value is non-nil.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/gnus-sum.el.gz
(defun gnus-summary-exit (&optional temporary leave-hidden)
  "Exit reading current newsgroup, and then return to group selection mode.
`gnus-exit-group-hook' is called with no arguments if that value is non-nil."
  (interactive nil gnus-summary-mode)
  (gnus-set-global-variables)
  (when (gnus-buffer-live-p gnus-article-buffer)
    (with-current-buffer gnus-article-buffer
      (mm-destroy-parts gnus-article-mime-handles)
      ;; Set it to nil for safety reason.
      (setq gnus-article-mime-handle-alist nil)
      (setq gnus-article-mime-handles nil)))
  (gnus-kill-save-kill-buffer)
  (gnus-async-halt-prefetch)
  (let* ((group gnus-newsgroup-name)
	 (quit-config (gnus-group-quit-config gnus-newsgroup-name))
	 (gnus-group-is-exiting-p t)
	 (article-buffer gnus-article-buffer)
	 (original-article-buffer gnus-original-article-buffer)
	 (mode major-mode)
	 (group-point nil)
	 (buf (current-buffer))
	 ;; `gnus-single-article-buffer' is nil buffer-locally in
	 ;; ephemeral group of which summary buffer will be killed,
	 ;; but the global value may be non-nil.
	 (single-article-buffer gnus-single-article-buffer))
    (unless quit-config
      ;; Do adaptive scoring, and possibly save score files.
      (when gnus-newsgroup-adaptive
	(gnus-score-adaptive))
      (when gnus-use-scoring
	(gnus-score-save)))
    (when gnus-use-cache
      (gnus-cache-possibly-remove-articles)
      (gnus-cache-save-buffers))
    (gnus-async-prefetch-remove-group group)
    (when gnus-suppress-duplicates
      (gnus-dup-enter-articles))
    (when gnus-use-trees
      (gnus-tree-close))
    (when gnus-use-cache
      (gnus-cache-write-active))
    ;; Remove entries for this group.
    (nnmail-purge-split-history group)
    ;; Make all changes in this group permanent.
    (unless quit-config
      (gnus-run-hooks 'gnus-exit-group-hook)
      (gnus-summary-update-info))
    (gnus-run-hooks 'gnus-summary-prepare-exit-hook)
    (gnus-close-group group)
    ;; Make sure where we were, and go to next newsgroup.
    (when (gnus-buffer-live-p gnus-group-buffer)
      (set-buffer gnus-group-buffer))
    (unless quit-config
      (gnus-group-jump-to-group group))
    (gnus-run-hooks 'gnus-summary-exit-hook)
    (unless (or quit-config
		(not gnus-summary-next-group-on-exit)
		;; If this group has disappeared from the summary
		;; buffer, don't skip forwards.
		(not (string= group (gnus-group-group-name))))
      (gnus-group-next-unread-group 1))
    (setq group-point (point))
    (unless leave-hidden
      (gnus-configure-windows 'group 'force))
    (if temporary
	nil				;Nothing to do.
      (set-buffer buf)
      (if (not gnus-kill-summary-on-exit)
	  (progn
	    (gnus-deaden-summary)
	    (setq mode nil))
	(when (get-buffer gnus-article-buffer)
	  (bury-buffer gnus-article-buffer))
	;; Return to group mode buffer.
	(when (eq mode 'gnus-summary-mode)
	  (gnus-kill-buffer buf)))

      (setq gnus-current-select-method gnus-select-method)
      (when (gnus-buffer-live-p gnus-group-buffer)
	(set-buffer gnus-group-buffer))
      (if quit-config
	  (gnus-handle-ephemeral-exit quit-config)
	(goto-char group-point)
	;; If gnus-group-buffer is already displayed, make sure we also move
	;; the cursor in the window that displays it.
	(let ((win (get-buffer-window (current-buffer) 0)))
	  (goto-char group-point)
	  (if win (set-window-point win (point)))))

      ;; If we have several article buffers, we kill them at exit.
      (unless single-article-buffer
	(when (gnus-buffer-live-p article-buffer)
	  (with-current-buffer article-buffer
	    ;; Don't kill sticky article buffers
	    (unless (eq major-mode 'gnus-sticky-article-mode)
	      (gnus-kill-buffer article-buffer)
	      (setq gnus-article-current nil))))
	(gnus-kill-buffer original-article-buffer))

      ;; Clear the current group name.
      (unless quit-config
	(setq gnus-newsgroup-name nil)))))