I find myself accidentally clicking the mode line when trying to focus a buffer with the mouse. This causes the buffer to change. I don't want that behavior. I want nothing to happen.

The culprit is this guy here, the part of the mode line that says the buffer's name (e.g. *shell*):

enter image description here

How can I disable it's behavior when it clicked?

I am told it is <down-mouse-1> by C-h k. However, this corresponds to mouse-drag-mode-line which resizes. This is not the behavior I observe. I cannot locate the appropriate key to override.

  • Good question. The mode-line is always difficult to ask Emacs about. Here, C-h k is not so useful.
    – Drew
    Commented Jun 3, 2020 at 16:26
  • It may have gotten better: when doing C-h k and clicking on the buffer name in the mode-line, I get a *Help* screen with two key sequences described: one is the mouse-drag-mode-line from global-map as above; the other is mode-line-previous-buffer which also identifies the mode-line-buffer-identification-keymap as described in @lawlist's answer. I'm on GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.13, cairo version 1.16.0).
    – NickD
    Commented Jun 3, 2020 at 16:47

1 Answer 1


Try using:

(define-key mode-line-buffer-identification-keymap [mode-line mouse-1] nil)

(define-key mode-line-buffer-identification-keymap [mode-line mouse-3] nil)

The variable mode-line-buffer-identification-keymap is defined within bindings.el.

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.