1

For some reason when I press Up, Down, Left or Right keys on keyboard in dired+ mode, emacs reads them all as M-O key, which I found out by describe-key command in dired+ buffer. I have no config regarding diredp in my config, just that:

(use-package dired+
  :ensure t)

Also, when pressing arrow keys in diredp in minibuffer appears change owner of auto-save-list, and depending on Up, Down, Left, Right, character appear in input field are A, B, D, C, which is even more confusing.

In ordinary dired buffer arrow keys appears normally. Also I'm working in emacs-nox session.

Drew
  • 75,699
  • 9
  • 109
  • 225
sandric
  • 1,221
  • 9
  • 19
  • Can you reproduce this starting with `emacs -Q`? If so, please post a step-by-step recipe to repro the problem, starting with `emacs -Q` and loading `dired+.el` with just `M-x load-file`. If you don't see the problem with `emacs -Q`, even after loading `dired+.el`, then recursively bisect your init file to find the culprit. – Drew Nov 11 '17 at 16:59
  • Also, please mention your Emacs version: `M-x emacs-version`. (I don't know what `emacs-nox` means.) – Drew Nov 11 '17 at 17:01
  • Neither vanilla Dired nor Dired+ binds `M-O` (by which I guess you mean `M-S-o`) or `M-o` to `dired-do-chown`, which is sems to be the command that is getting invoked when you use an arrow key. They also do not bind arrow keys to that command. A guess is that something else in your init file is causing this. – Drew Nov 11 '17 at 17:06
  • @Drew yes, I checked with starting `emacs -Q` and loading one diredp.el file - problem reproduces identically. My emacs version is `GNU Emacs 25.3.1`, and `emacs-nox` is package for term-only emacs, its available for lots of platform, specifically mine is arch linux package. – sandric Nov 11 '17 at 17:20
  • It sounds like an `emacs-nox` problem, to me. But maybe someone else has something to offer here. I try `emacs -Q -nw`, which gives me Emacs in terminal mode. I load `dired+.el`. I see no problem with the keys. You can try commenting out sections of the Dired+ code, to narrow down the problem, if you want. Start with the code that binds keys: search for `;;; Key Bindings.` If commenting out all Dired+ key bindings fixes the problem then comment out 1/2 of them, then 1/4, 1/8, etc. until you find which bindings seem to interfere. – Drew Nov 11 '17 at 18:03
  • Do you start your `emacs-nox` using `emacs -Q -nw`? If not , try that. – Drew Nov 11 '17 at 18:07
  • `emacs -Q -nw` does nothing – sandric Nov 11 '17 at 18:26
  • 2
    I was bitten by this issue 3 years ago and [wrote briefly about it](https://www.reddit.com/r/emacs/comments/2m6nvu/dont_bind_mo_if_you_want_to_use_arrow_keys_in/) on reddit/r/emacs. – Omar Dec 16 '17 at 02:42
  • Is this a duplicate of https://emacs.stackexchange.com/questions/37368/dired-key-binding-issues-in-terminal-emacs ? – phils Dec 16 '17 at 02:58
  • 4
    Possible duplicate of [Dired+ key binding issues in terminal emacs](https://emacs.stackexchange.com/questions/37368/dired-key-binding-issues-in-terminal-emacs) – Stefan Dec 16 '17 at 03:14

2 Answers2

1

I was able to solve this by configuring dired+ followingly:

(use-package dired+
  :config
  ;; This binding messes with the arrow keys, for some reason.
  (unbind-key "M-O" dired-mode-map))
klutometis
  • 11
  • 1
  • That removes the Dired+ binding of `M-S-o` (aka `M-O`). It does not answer the question of why the arrow keys are getting redirected to `M-O`. – Drew Dec 16 '17 at 00:45
0

There is a user option, diredp-bind-problematic-terminal-keys, that has this effect:

diredp-bind-problematic-terminal-keys is a variable defined in dired+.el.

Its value is t

Documentation:

Non-nil means bind some keys that might not work in a text-only terminal.

This applies to keys that use modifiers Meta and Shift together. If you use Emacs in text-only terminal and your terminal does not support the use of such keys then customize this option to nil.

You can customize this variable.

You might try customizing that option to nil.

The Dired+ doc has this prominent section (in the Commentary of dired+.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 a text-only terminal, 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.

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 a text-only terminal.)

HTH. Sorry for any trouble.

Drew
  • 75,699
  • 9
  • 109
  • 225