Reputation: 4181
In Emacs 23.2.1 in Dired mode the mouse-1 (left mouse button) performs visit file in other window
. It also changes shape to a finger and highlights the filename when cursor hovers over the filename. How do I disable both visit file
and filename highlighting ? I want mouse-1 to do its usual stuff: selecting text.
I can still select text if I start by clicking down in an area outside the filename or directory name. But I only want the filename marked, and not have a space in front included.
Upvotes: 3
Views: 593
Reputation: 3829
If you use use-package
, then simply bind the mouse-1
or down-mouse-1
to nil
:
(use-package dired
:ensure nil ;; Because dired is shipped with Emacs, it should be set to nil instead of t
:bind ( ;; Define keybindings
:map dired-mode-map ;; The mode that the next bindings should be applied to
("<down-mouse-1>" . nil) ;; The binding in (KEY . ACTION) format
)
)
Upvotes: 0
Reputation: 30701
I just turn off mouse-1-click-follows-link
by customizing it to nil
. (You can also set it to a long time-limit value.)
Or if you want to do that only for Dired buffers, you can do this:
(add-hook 'dired-mode-hook
(lambda ()
(set (make-local-variable 'mouse-1-click-follows-link) nil)))
But it is typically better to name a function that you use on a hook (it's easier to remove it, for one thing):
(defun foo ()
(set (make-local-variable 'mouse-1-click-follows-link) nil)))
(add-hook 'dired-mode-hook 'foo)
If you have a recent version of Emacs, where setq-local
is defined, then you can use just (setq-local mouse-1-click-follows-link nil)
in the hook function, in place of (set (make-local-variable 'mouse-1-click-follows-link) nil)
Upvotes: 3