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.
This commit is contained in:
Stephen Berman 2023-09-13 23:43:54 +02:00
parent 9838f786de
commit 9d9570bfbf
2 changed files with 12 additions and 4 deletions

View file

@ -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

View file

@ -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