From 94a8a4996689282c659f04f933334f937ee61ead Mon Sep 17 00:00:00 2001 From: JSDurand Date: Sat, 18 Dec 2021 22:43:33 +0800 Subject: ibuffer: reset or remove killed buffers * ibuffer.el (durand-reset-clearlist): Reset or remove killed buffers from the clear list. --- ibuffer.el | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/ibuffer.el b/ibuffer.el index f270a69..4944c3a 100644 --- a/ibuffer.el +++ b/ibuffer.el @@ -97,10 +97,30 @@ automatically.") (setq durand-clear-passlist durand-default-clear-passlist) ;;;###autoload -(defun durand-reset-clearlist () - "Reset `durand-clear-passlist' to `durand-default-clear-passlist'." - (interactive) - (setq durand-clear-passlist durand-default-clear-passlist)) +(defun durand-reset-clearlist (&optional arg) + "Remove killed buffers from `durand-clear-passlist'. +If ARG is non-nil, reset `durand-clear-passlist' to +`durand-default-clear-passlist'." + (interactive "P") + (setq + durand-clear-passlist + (cond + ((null arg) + (delq nil + (mapcar + (lambda (buf) + (cond ((and (stringp buf) + (get-buffer buf) + (buffer-live-p (get-buffer buf))) + buf) + ((and (bufferp buf) (buffer-live-p buf)) + buf))) + durand-clear-passlist))) + (durand-default-clear-passlist))) + (message "%s the clear list!" + (cond + ((null arg) "Removed killed buffers from") + ("Reset")))) (autoload #'durand-member "common.el") -- cgit v1.2.3-18-g5258