From: Stephen Berman Date: Wed, 13 Sep 2023 21:43:54 +0000 (+0200) Subject: Fix last Ibuffer change and improve feedback messages X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=9d9570bfbf5c820e096d3821a6bc041ef5af4645;p=emacs.git Fix last Ibuffer change and improve feedback messages * lisp/ibuf-macs.el (define-ibuffer-op): Emit grammatically correct message on finishing operation, and don't operate when there are no marked buffer lines and point is not on a buffer line. (bug#64230, Message #21) * lisp/ibuffer.el (ibuffer-map-lines): Take acting on only one buffer line and using non-nil 'ibuffer-expert' into account. --- diff --git a/lisp/ibuf-macs.el b/lisp/ibuf-macs.el index c38dfefe0c5..36616389f99 100644 --- a/lisp/ibuf-macs.el +++ b/lisp/ibuf-macs.el @@ -230,6 +230,9 @@ buffer object. (_ 'ibuffer-marked-buffer-names))))) (when (null marked-names) + (cl-assert (get-text-property (line-beginning-position) + 'ibuffer-properties) + nil "No buffer on this line") (setq marked-names (list (buffer-name (ibuffer-current-buffer)))) (ibuffer-set-mark ,(pcase mark (:deletion @@ -243,7 +246,9 @@ buffer object. ()) (and after `(,after)) ; post-operation form. `((ibuffer-redisplay t) - (message ,(concat "Operation finished; " opstring " %s buffers") count)))) + (message ,(concat "Operation finished; " opstring + " %s %s") + count (ngettext "buffer" "buffers" count))))) (inner-body (if complex `(progn ,@body) `(progn diff --git a/lisp/ibuffer.el b/lisp/ibuffer.el index b5a7f2d04e0..1368a62d87b 100644 --- a/lisp/ibuffer.el +++ b/lisp/ibuffer.el @@ -1898,14 +1898,17 @@ the buffer object itself and the current mark symbol." (t (cl-incf ibuffer-map-lines-count) (forward-line 1))))) - ;; With `ibuffer-auto-mode' enabled, the preceding loop + ;; With `ibuffer-auto-mode' enabled, `ibuffer-expert' nil + ;; and more than one marked buffer lines, the preceding loop ;; counts the automatically popped up (and hence not ;; user-marked) buffer "*Ibuffer confirmation*". Since - ;; Ibuffer reports how many user-marked buffers were acted + ;; Ibuffer reports how many marked buffers lines were acted ;; upon, and in this case the reported count would be too ;; high by one, we decrement the count to avoid the ;; confusing message (see bug#64230). - (if (and (featurep 'ibuf-ext) ibuffer-auto-mode) + (if (and (featurep 'ibuf-ext) ibuffer-auto-mode + (> ibuffer-map-lines-count 1) + (not ibuffer-expert)) (1- ibuffer-map-lines-count) ibuffer-map-lines-count)) (progn