emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 236457e 4/4: image-dired: Improve mouse behaviour


From: Stefan Kangas
Subject: master 236457e 4/4: image-dired: Improve mouse behaviour
Date: Tue, 26 Oct 2021 22:38:59 -0400 (EDT)

branch: master
commit 236457e05243f7d9acdbd0996076507c9134ce6d
Author: Stefan Kangas <stefan@marxist.se>
Commit: Stefan Kangas <stefan@marxist.se>

    image-dired: Improve mouse behaviour
    
    * lisp/image-dired.el (image-dired-thumbnail-mode-map): Improve mouse
    behaviour: ignore dragging, as it currently doesn't do anything
    useful, and make all clicks just select the thumbnail.
    (image-dired-mouse-display-image)
    (image-dired-mouse-select-thumbnail): Move point to closest image
    after clicking in buffer.
---
 lisp/image-dired.el | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/lisp/image-dired.el b/lisp/image-dired.el
index cc8b80d..37c324f 100644
--- a/lisp/image-dired.el
+++ b/lisp/image-dired.el
@@ -1657,6 +1657,15 @@ You probably want to use this together with
     ;; Mouse
     (define-key map [mouse-2] 'image-dired-mouse-display-image)
     (define-key map [mouse-1] 'image-dired-mouse-select-thumbnail)
+    (define-key map [mouse-3] #'image-dired-mouse-select-thumbnail)
+    (define-key map [down-mouse-1] #'image-dired-mouse-select-thumbnail)
+    (define-key map [down-mouse-2] #'image-dired-mouse-select-thumbnail)
+    (define-key map [down-mouse-3] #'image-dired-mouse-select-thumbnail)
+    ;; Let's disable mouse dragging, as it currently doesn't do
+    ;; anything useful.
+    (define-key map [drag-mouse-1] #'ignore)
+    (define-key map [drag-mouse-2] #'ignore)
+    (define-key map [drag-mouse-3] #'ignore)
     ;; Seems I must first set C-down-mouse-1 to undefined, or else it
     ;; will trigger the buffer menu. If I try to instead bind
     ;; C-down-mouse-1 to `image-dired-mouse-toggle-mark', I get a message
@@ -2410,6 +2419,8 @@ non-nil."
   (interactive "e")
   (mouse-set-point event)
   (goto-char (posn-point (event-end event)))
+  (unless (image-at-point-p)
+    (image-dired-backward-image))
   (let ((file (image-dired-original-file-name)))
     (when file
       (if image-dired-track-movement
@@ -2425,6 +2436,8 @@ non-nil."
   (interactive "e")
   (mouse-set-point event)
   (goto-char (posn-point (event-end event)))
+  (unless (image-at-point-p)
+    (image-dired-backward-image))
   (if image-dired-track-movement
       (image-dired-track-original-file))
   (image-dired-display-thumb-properties))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]