This is more of an academic question than a practical one, as I've already worked around it. However, the curiosity / mystery is killing me. I'm about 10 days into emacs, so new to a lot of this.

As I've been experimenting and learning about keymaps, I've been trying to unbind [mouse-2] from dired without success. From the dired.el source, I see this:

    (defvar dired-mode-map
      ;; This looks ugly when substitute-command-keys uses C-d instead d:
      ;;  (define-key dired-mode-map "\C-d" 'dired-flag-file-deletion)
      (let ((map (make-keymap)))
        (set-keymap-parent map special-mode-map)
        (define-key map [mouse-2] 'dired-mouse-find-file-other-window)
        (define-key map [follow-link] 'mouse-face)

However, when I try to unbind it with:

    (define-key dired-mode-map [mouse-2] nil)

It remains bound. I've tried every method I can think of to unbind this, without success. I'm curious if someone can point me to what might be going on.

1 Answer 1


I don't see that. Did you start Emacs using emacs -Q (no init file)?

If I do that, and then I do what you tried:

(define-key dired-mode-map [mouse-2] nil)

Then mouse-2 is no longer bound in dired-mode-map.

To see that, you can load library help-fns+.el and use C-h M-k dired-mode-map before and after evaluating that sexp.

Or you can just try mouse-2 in a Dired buffer, or use C-h k and click mouse-2 -- its global binding is in effect.

  • Thank you Drew. I am still figuring things out (30 year tech veteran, but completely new to both emacs and lisp). I tried with a clean install and got the same results as you did. I now realize that I'm using evil mode (which I want), but didn't fully understand how all these things are interacting with each-other. It appears that key-binding can get complicated as different folks build different layers on top of basic functionality.
    – MT.
    Jul 1, 2021 at 16:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.