Using the Dired+ library, and running Emacs in a terminal, all arrow keys in dired buffers invoke M-O (which is bound to diredp-chown-this-file) instead of correct <left> <right> <up> <down> events.

Non-dired buffer types work as expected.

How to solve it?

  • Does this still happen if you run emacs -Q ?
    – phils
    Commented Dec 7, 2017 at 23:58
  • No, I think, dired+ is causing this (but GUI mode is OK).
    – dev1223
    Commented Dec 8, 2017 at 0:03
  • Do C-b, C-f, C-n, and C-p work?
    – choroba
    Commented Dec 8, 2017 at 0:06
  • C-n works (go one line down), rest is not working (as a navigation in buffer) becouse I remapped these keys to other functions (which are working in dired buffer).
    – dev1223
    Commented Dec 8, 2017 at 0:29
  • What does C-h k <left> report? (for both emacs -nw -Q where things are working normally, and emacs -nw where things are broken).
    – phils
    Commented Dec 8, 2017 at 0:41

3 Answers 3


See this part of the Commentary in [dired+.el(https://www.emacswiki.org/emacs/download/dired%2b.el):

;;  If You Use Dired+ in Terminal Mode
;;  ----------------------------------
;;  By default, Dired+ binds some keys that can be problematic in some
;;  terminals when you use Emacs in terminal mode (i.e., `emacs -nw').
;;  This is controlled by option
;;  `diredp-bind-problematic-terminal-keys'.
;;  In particular, keys that use modifiers Meta and Shift together can
;;  be problematic.  If you use Dired+ in terminal mode, and you find
;;  that your terminal does not support such keys then you might want
;;  to customize the option to set the value to `nil', and then bind
;;  the commands to some other keys, which your terminal supports.
;;  Regardless of the option value, unless Emacs is in terminal mode
;;  the keys are bound by default.  The problematic keys used by
;;  Dired+ include these:
;;    `M-M'   (aka `M-S-m')   - `diredp-chmod-this-file'
;;    `M-O'   (aka `M-S-o')   - `diredp-chown-this-file'
;;    `M-T'   (aka `M-S-t')   - `diredp-touch-this-file'
;;    `C-M-B' (aka `C-M-S-b') - `diredp-do-bookmark-in-bookmark-file'
;;    `C-M-G' (aka `C-M-S-g') - `diredp-chgrp-this-file'
;;    `C-M-R' (aka `C-M-S-r') - `diredp-toggle-find-file-reuse-dir'
;;    `C-M-T' (aka `C-M-S-t') - `dired-do-touch'
;;    `M-+ M-B'   (aka `M-+ M-S-b') -
;;        `diredp-do-bookmark-dirs-recursive'
;;    `M-+ C-M-B' (aka `M-+ C-M-S-b') -
;;        `diredp-do-bookmark-in-bookmark-file-recursive'
;;    `M-+ C-M-T' (aka `M-+ C-M-S-t') - `diredp-do-touch-recursive'
;;  (See also `(info "(org) TTY keys")' for more information about
;;  keys that can be problematic in terminal mode.)

According to Drew, I solved this issue by putting this to init:

(setq diredp-bind-problematic-terminal-keys nil)

Try one or all of this:

(require 'dired+)                                                              
(setq diredp-bind-problematic-terminal-keys nil)

(defun dired-custom()                                                          
  "conf dired-mode"
  (diredp-toggle-find-file-reuse-dir t)                                           
  (local-set-key (kbd "M-O") nil))                                             
(add-hook 'dired-mode-hook 'dired-custom)

(eval-after-load 'dired-mode '(define-key dired-mode-map (kbd "M-O") nil))

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.