Subject: bug#39344: 28.0.50; Gnus: Selecting deleted buffer

From: Michael Heerdegen <[email-masked]>
Date: Wed, 29 Jan 2020 12:48:42 +0100

Hello,

since today (master built) when exiting Gnus I get this error:

Debugger entered--Lisp error: (error "Selecting deleted buffer")
  set-buffer(#<killed buffer>)
  (save-current-buffer (set-buffer buffer) (set-buffer-modified-p nil) (if (local-variable-p 'kill-buffer-hook) (progn (setq kill-buffer-hook nil))))
  (let ((buffer (car --dolist-tail--))) (save-current-buffer (set-buffer buffer) (set-buffer-modified-p nil) (if (local-variable-p 'kill-buffer-hook) (progn (setq kill-buffer-hook nil)))) (let ((buf buffer)) (if (gnus-buffer-live-p buf) (progn (kill-buffer buf) (gnus-prune-buffers)))) (setq --dolist-tail-- (cdr --dolist-tail--)))
  (while --dolist-tail-- (let ((buffer (car --dolist-tail--))) (save-current-buffer (set-buffer buffer) (set-buffer-modified-p nil) (if (local-variable-p 'kill-buffer-hook) (progn (setq kill-buffer-hook nil)))) (let ((buf buffer)) (if (gnus-buffer-live-p buf) (progn (kill-buffer buf) (gnus-prune-buffers)))) (setq --dolist-tail-- (cdr --dolist-tail--))))
  (let ((--dolist-tail-- (gnus-buffers))) (while --dolist-tail-- (let ((buffer (car --dolist-tail--))) (save-current-buffer (set-buffer buffer) (set-buffer-modified-p nil) (if (local-variable-p 'kill-buffer-hook) (progn (setq kill-buffer-hook nil)))) (let ((buf buffer)) (if (gnus-buffer-live-p buf) (progn (kill-buffer buf) (gnus-prune-buffers)))) (setq --dolist-tail-- (cdr --dolist-tail--)))))
  (let ((kill-buffer-query-functions kill-buffer-query-functions)) (remove-hook 'kill-buffer-query-functions 'process-kill-buffer-query-function) (apply f args))
  gnus-clear-system()
  gnus-group-exit()
  funcall-interactively(gnus-group-exit)
  call-interactively(gnus-group-exit nil nil)
  command-execute(gnus-group-exit)

Could this be due to

| Make sure that all gnus buffers are killed on exit
| 5ee3c37634f7f8651b2da1f4b611334a2b146928
| Author:     Sam Steingold <[email-masked]>
| AuthorDate: Fri Jan 10 13:34:59 2020 -0500

?

AFAICT `my-gnus-clear-system-around-ad' is unrelated, it looks like

--8<---------------cut here---------------start------------->8---
(defun my-gnus-clear-system-around-ad (f &rest args)
              (let ((kill-buffer-query-functions kill-buffer-query-functions))
                (remove-hook 'kill-buffer-query-functions 'process-kill-buffer-query-function)
                (apply f args)))
--8<---------------cut here---------------end--------------->8---

The problem rather seems to be that the return value of (gnus-buffers)
contains killed buffers.

TIA,

Michael.

In GNU Emacs 28.0.50 (build 6, x86_64-pc-linux-gnu, GTK+ Version 3.24.13, cairo version 1.16.0)
 of 2020-01-29 built on drachen
Repository revision: c7e3568e9e62146ee68cb97ca970e03576889a28
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12006000
System Description: Debian GNU/Linux bullseye/sid