From a1e7304fc45ed356f35459697ea8415d52008fd8 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Fri, 26 Feb 2016 13:54:41 +1030 Subject: [PATCH] Remove killed buffers from the list of Gnus buffers * lisp/gnus/gnus.el (gnus-prune-buffers): Remove killed buffers from the list of Gnus buffers (bug#18522). --- lisp/gnus/gnus.el | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lisp/gnus/gnus.el b/lisp/gnus/gnus.el index f83932513bb..edf46f173b1 100644 --- a/lisp/gnus/gnus.el +++ b/lisp/gnus/gnus.el @@ -903,14 +903,20 @@ be set in `.emacs' instead." (defun gnus-add-buffer () "Add the current buffer to the list of Gnus buffers." + (gnus-prune-buffers) (push (current-buffer) gnus-buffers)) (defmacro gnus-kill-buffer (buffer) "Kill BUFFER and remove from the list of Gnus buffers." `(let ((buf ,buffer)) (when (gnus-buffer-exists-p buf) - (setq gnus-buffers (delete (get-buffer buf) gnus-buffers)) - (kill-buffer buf)))) + (kill-buffer buf) + (gnus-prune-buffers)))) + +(defun gnus-prune-buffers () + (dolist (buf gnus-buffers) + (unless (buffer-live-p buf) + (setq gnus-buffers (delete buf gnus-buffers))))) (defun gnus-buffers () "Return a list of live Gnus buffers." -- 2.39.5