emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: "whether the global keymap C-x 4 will be replaced by a command,"


From: Juri Linkov
Subject: Re: "whether the global keymap C-x 4 will be replaced by a command,"
Date: Sun, 19 Jul 2020 02:21:27 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (x86_64-pc-linux-gnu)

> So I think there needs to be a exception list, a way of defining a few
> key sequences starting with C-x 4 so that they depart from the usual
> rule and maintain backwards compatibility instead.

I propose the following design:

1. keep the existing 'C-x 4' bindings and other-window commands
   unchanged to maintain backwards compatibility;

2. add a catch-all fallback to ctl-x-4-map and bind it to the command
   invoked when an unbound key is typed after 'C-x 4'.

There are 2 possibilities what to do with an unbound key in this command:

2.1. define a new keymap with mappings from such unbound keys to commands.

For example, using project-prefix-map where "f" is bound to 'project-find-file'
and while project-prefix-map itself is bound to "p" would enable such
key sequences 'C-x 4 p f' to find a project file in another window.

There is no need to add all -other-window variants in such additional keymap,
it should handle the existing no-window commands, and display their buffers
in another window.

2.2. another possibility is when the above keymap doesn't match
     an unbound key then run its global keybinding.

For example, typing 'C-x 4 C-h i' will display the Info manual
in another window.

Now I tried to implement this, but the problem is that the fallback
'[remap t]' doesn't work, for example in:

  (define-key ctl-x-4-map [remap t] 'other-window-prefix)

it has no effect.  Then I discovered this explanation in
(info "(elisp) Remapping Commands"):

     Note that remapping only takes place through active keymaps; for
  example, putting a remapping in a prefix keymap like 'ctl-x-map'
  typically has no effect, as such keymaps are not themselves active.

So it seems remapping in ctl-x-4-map has no effect.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]