]> git.eshelyaron.com Git - emacs.git/commitdiff
Make it easier to select text inside dired when mouse dragging is on
authorPo Lu <luangruo@yahoo.com>
Fri, 25 Mar 2022 12:33:23 +0000 (20:33 +0800)
committerPo Lu <luangruo@yahoo.com>
Fri, 25 Mar 2022 12:34:18 +0000 (20:34 +0800)
* lisp/dired.el (dired-insert-set-properties): Only set drag
keymap on the filename itself.

lisp/dired.el

index 3790197f661a3972891e12af41f28316eec008b7..d6c5721ca284d5cdff40f6a8399cdf167f64f302 100644 (file)
@@ -1733,20 +1733,26 @@ see `dired-use-ls-dired' for more details.")
                                 'invisible 'dired-hide-details-information))
          (put-text-property (+ (line-beginning-position) 1) (1- (point))
                             'invisible 'dired-hide-details-detail)
+          (when dired-mouse-drag-files
+            (put-text-property (point)
+                              (save-excursion
+                                (dired-move-to-end-of-filename)
+                                 (backward-char)
+                                (point))
+                               'keymap
+                               dired-mouse-drag-files-map))
          (add-text-properties
           (point)
           (progn
             (dired-move-to-end-of-filename)
             (point))
-          (append `(mouse-face
-                    highlight
-                    dired-filename t
-                    help-echo ,(if dired-mouse-drag-files
-                                    "down-mouse-1: drag this file to another program
+          `(mouse-face
+            highlight
+            dired-filename t
+            help-echo ,(if dired-mouse-drag-files
+                            "down-mouse-1: drag this file to another program
 mouse-2: visit this file in other window"
-                                  "mouse-2: visit this file in other window"))
-                   (when dired-mouse-drag-files
-                     `(keymap ,dired-mouse-drag-files-map))))
+                          "mouse-2: visit this file in other window")))
          (when (< (+ (point) 4) (line-end-position))
            (put-text-property (+ (point) 4) (line-end-position)
                               'invisible 'dired-hide-details-link))))