summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJSDurand <mmemmew@gmail.com>2021-08-09 15:04:45 +0800
committerJSDurand <mmemmew@gmail.com>2021-08-09 15:04:45 +0800
commit71e3a7871d9493612e78152109d9e8aba49d39fb (patch)
tree27d0ad51d99ea046235be90c77bbd7d56d5fb1ff
parentae8db0e4e69603dbe8dd009dfe38dc814bbe11f2 (diff)
fix: durand-ibuffer-clear
* ibuffer.el (durand-ibuffer-clear): Make the behaviour with a prefix argument respect the `durand-clear-passlist'. And the prefixed behaviour now restricts the range of deletion to the marked buffers, which is kind of the opposite of the original behaviour. The rationale is that we can easily toggle marks in ibuffer, and to delete marked buffers is a much more intuitive behaviour.
-rw-r--r--ibuffer.el14
1 files changed, 8 insertions, 6 deletions
diff --git a/ibuffer.el b/ibuffer.el
index e1cf4ec..7d13214 100644
--- a/ibuffer.el
+++ b/ibuffer.el
@@ -93,8 +93,8 @@ automatically.")
;;;###autoload
(defun durand-ibuffer-clear (&optional arg)
"Kill every buffer except for those in `durand-clear-passlist'.
-If the optional ARG is non-nil, then kill every buffer except for
-those that are marked."
+If the optional ARG is non-nil, then restrict the range to the
+marked buffers."
(interactive "P")
(cond
((derived-mode-p 'ibuffer-mode))
@@ -116,14 +116,16 @@ derived modes of `ibuffer-mode'.")))
(mapc (function
(lambda (buffer-and-mark)
(cond
- ((or (= (cdr buffer-and-mark)
+ ((or (/= (cdr buffer-and-mark)
ibuffer-marked-char)
- (string= (buffer-name (car buffer-and-mark))
- dashboard-buffer-name)))
+ (durand-member (buffer-name (car buffer-and-mark))
+ durand-clear-passlist
+ #'string=)))
((kill-buffer (car buffer-and-mark))))))
(cons
(cons (current-buffer) 32)
- (ibuffer-current-state-list))))))
+ (ibuffer-current-state-list)))
+ (ibuffer-update nil t))))
(define-key global-map (vector 24 2) #'ibuffer)
(define-key global-map (vector ?\s-h) #'ibuffer)