From 71e3a7871d9493612e78152109d9e8aba49d39fb Mon Sep 17 00:00:00 2001 From: JSDurand Date: Mon, 9 Aug 2021 15:04:45 +0800 Subject: 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. --- ibuffer.el | 14 ++++++++------ 1 file 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) -- cgit v1.2.3-18-g5258