Subject: bug#42210: Add -other-window variants of project-prefix-map commands

From: Juri Linkov <[email-masked]>
Date: Tue, 07 Jul 2020 01:59:25 +0300

>> Thanks for the patch.  On emacs-devel you said that rather than add
>> definitions of project-find-file-other-window, etc.
>> display-buffer-override-next-command could be used.  But there is no
>> display-buffer-override-next-command in your patch, and definitions of
>> project-find-file-other-window etc. are still added (with the help of macro).
>
> Yeah.  After thinking about it a bit more I thought that this would be
> more consistent with both the way the other C-x 4 commands work and how
> the C-x p subcommands work -- i.e., it's just an ordinary keymap.
>
> Additionally, my approach means that the -other-window functions are
> available to be called from lisp, just as switch-to-buffer-other-window
> and find-file-other-window already are, which might be useful.

Actually, keeping consistency with existing C-x 4 commands
is not a requirement.  It's quite possible that existing commands
will be declared deprecated as currently is discussed on emacs-devel.

>> Would it be possible to define the 'C-x 4 p' map the same way as
>> 'C-x p p' is defined?  There is a patch in https://debbugs.gnu.org/41890#127
>> to use the default project keymap 'C-x p' in 'C-x p p'.  You could try to
>> use the same keymap in 'C-x 4 p', and wrap the command call with
>> display-buffer-override-next-command.
>
> I could give it a shot, but wouldn't it be less useful, since the
> -other-window functions would no longer be available to be called from
> lisp?

I see it as an advantage that makes the namespace cleaner - there will be
no more such useless duplicates as

switch-to-buffer
switch-to-buffer-other-frame
switch-to-buffer-other-tab
switch-to-buffer-other-window

and similarly for dozens of other commands.  When browsing command names
e.g. in command completions of M-x or C-h f this will reduce the mess.

For a rare case when the users might want to bind an other-window command
directly to a non-prefix key in an init file, then maybe it's possible
to provide a macro or better a wrapper function that could be used like

(global-set-key (kbd "C-x w b") (with-other-window 'switch-to-buffer))

> Maybe you could explain why you think doing it like C-x p p would be
> better.  Thanks again.

Let's see what the emacs-devel discussion will bring, maybe C-x 4
will be bound to a command like C-x p p is implemented in
https://debbugs.gnu.org/41890#50