1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-18 18:05:07 +00:00

Let image-dired-mouse-toggle-mark act on active region

* lisp/image-dired.el (image-dired-mouse-toggle-mark): When region is
active, then toggle marks of all images within (bug#49987).
(image-dired-mouse-toggle-mark-1): Separated out into function.
This commit is contained in:
Peter Münster 2021-08-11 13:39:53 +02:00 committed by Lars Ingebrigtsen
parent fc174eb20b
commit c56e395edf
2 changed files with 23 additions and 5 deletions

View File

@ -2398,6 +2398,9 @@ This command, called interactively, toggles the local value of
** Miscellaneous
---
*** 'image-dired-mouse-toggle-mark' now toggles files in the active region.
---
*** 'shell-script-mode' now supports 'outline-minor-mode'.
The outline headings have lines that start with "###".

View File

@ -2311,16 +2311,31 @@ non-nil."
(image-dired-track-original-file))
(image-dired-display-thumb-properties))
(defun image-dired-mouse-toggle-mark-1 ()
"Toggle dired mark for current thumbnail.
Track this in associated dired buffer if `image-dired-track-movement' is
non-nil."
(when image-dired-track-movement
(image-dired-track-original-file))
(image-dired-toggle-mark-thumb-original-file))
(defun image-dired-mouse-toggle-mark (event)
"Use mouse EVENT to toggle dired mark for thumbnail.
Toggle marks of all thumbnails in region, if it's active.
Track this in associated dired buffer if `image-dired-track-movement' is
non-nil."
(interactive "e")
(mouse-set-point event)
(goto-char (posn-point (event-end event)))
(if image-dired-track-movement
(image-dired-track-original-file))
(image-dired-toggle-mark-thumb-original-file))
(if (use-region-p)
(let ((end (region-end)))
(save-excursion
(goto-char (region-beginning))
(while (<= (point) end)
(when (image-dired-image-at-point-p)
(image-dired-mouse-toggle-mark-1))
(forward-char))))
(mouse-set-point event)
(goto-char (posn-point (event-end event)))
(image-dired-mouse-toggle-mark-1)))
(defun image-dired-dired-display-properties ()
"Display properties for dired file in the echo area."