简体   繁体   中英

Emacs disable mouse-1 in dired

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.

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)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM