summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJSDurand <mmemmew@gmail.com>2021-12-18 22:43:33 +0800
committerJSDurand <mmemmew@gmail.com>2021-12-18 22:43:33 +0800
commit94a8a4996689282c659f04f933334f937ee61ead (patch)
tree26c176bff0b69c8da4ba4ad0c1a000e6767fa560
parent761b527a83cf37f821f4b687c2614175aab1387b (diff)
ibuffer: reset or remove killed buffers
* ibuffer.el (durand-reset-clearlist): Reset or remove killed buffers from the clear list.
-rw-r--r--ibuffer.el28
1 files 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")