From: Lars Ingebrigtsen Date: Fri, 26 Feb 2016 03:24:41 +0000 (+1030) Subject: Remove killed buffers from the list of Gnus buffers X-Git-Tag: emacs-26.0.90~2458 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=a1e7304fc45ed356f35459697ea8415d52008fd8;p=emacs.git 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). --- 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."