From: "Peter Münster" <pm@a16n.net>
To: 49987@debbugs.gnu.org
Subject: bug#49987: 27.2; Let image-dired-mouse-toggle-mark act on active region
Date: Tue, 10 Aug 2021 22:27:41 +0200 [thread overview]
Message-ID: <87pmulkptu.fsf@a16n.net> (raw)
[-- Attachment #1: Type: text/plain, Size: 1891 bytes --]
Hi,
It would be nice, if one can toggle marks of all thumbnails in the
active region.
Here is a patch:
* lisp/image-dired.el (image-dired-mouse-toggle-mark): When region is
active, then toggle marks of all images within.
diff --git a/lisp/image-dired.el b/lisp/image-dired.el
index 2509ecf8f8..8a065f2e6f 100644
--- a/lisp/image-dired.el
+++ b/lisp/image-dired.el
@@ -2311,17 +2311,32 @@ non-nil."
(image-dired-track-original-file))
(image-dired-display-thumb-properties))
-(defun image-dired-mouse-toggle-mark (event)
- "Use mouse EVENT to toggle dired mark for thumbnail.
+(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."
- (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))
+(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")
+ (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."
(interactive)
What do think about that?
--
Peter
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 211 bytes --]
next reply other threads:[~2021-08-10 20:27 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-10 20:27 Peter Münster [this message]
2021-08-11 11:40 ` bug#49987: 27.2; Let image-dired-mouse-toggle-mark act on active region Lars Ingebrigtsen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87pmulkptu.fsf@a16n.net \
--to=pm@a16n.net \
--cc=49987@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.