Subject: bug#10375: 24.0.92; `cua-rectangle-mark-key' bindings and the minibuffer

From: "Drew Adams" <[email-masked]>
Date: Mon, 26 Dec 2011 14:09:11 -0800

This is an enhancement request.  Caveat: I'm no expert on CUA mode or
CUA rectangle commands.  I took a quick look at some of the code.
 
CUA mode is a minor mode, so its key bindings take precedence over
local-map bindings and global-map bindings.  The minibuffer keymaps are
local maps.
 
IIUC, some CUA keys don't make much (any?) sense in the minibuffer.  I'm
guessing that `C-RET' is one that makes little or no sense there.
 
The enhancement would be to change the command that CUA binds `C-RET'
to, so that it checks whether the current buffer is the active
minibuffer and, if so, looks up the binding of `C-RET' (actually, the
key that is the value of `cua-rectangle-mark-key') in the current
minibuffer keymap.  If the key is bound in the minibuffer map then the
command would invoke the command it is bound to there.
 
That would respect the CUA behavior of the key outside the minibuffer,
and yet respect any bindings for the key in the minibuffer keymaps.
 
This would give CUA users who also use packages that bind `C-RET' in the
minibuffer (e.g. Icicles does that, by default) an alternative to
customizing or juggling key bindings.  They might well like to keep
`C-RET' for CUA outside the minibuffer, and so would not want to
customize option `cua-rectangle-mark-key'.
 
In CUA mode, whatever key they choose for `cua-rectangle-mark-key' the
behavior is currently all-or-nothing: the key is used equally in the
minibuffer and outside, even if the key's behavior makes no sense in the
minibuffer.
 
(In Icicles, users can easily customize the key to use in the minibuffer
to something other than `C-RET'.  This enhancement request is not
particularly for Icicles users (but is also for Icicles users who want
to keep CUA's `C-RET' outside the minibuffer and Icicles's `C-RET' in
the minibuffer))
 
If I'm mistaken and the use of CUA's `C-RET' behavior in the minibuffer
*is* useful, then please ignore.  That's not my impression, but again,
I'm no expert on CUA mode.
 
The same idea would apply to any other CUA keys that are not
particularly useful in the minibuffer: have CUA take a hands-off policy
toward the minibuffer whenever it adds nothing to the party.
 
In GNU Emacs 24.0.92.1 (i386-mingw-nt5.1.2600) of 2011-12-06 on MARVIN
 Windowing system distributor `Microsoft Corp.', version 5.1.2600
 configured using `configure --with-gcc (4.6) --no-opt --cflags
 -ID:/devel/emacs/libs/libXpm-3.5.8/include
 -ID:/devel/emacs/libs/libXpm-3.5.8/src
 -ID:/devel/emacs/libs/libpng-dev_1.4.3-1/include
 -ID:/devel/emacs/libs/zlib-dev_1.2.5-2/include
 -ID:/devel/emacs/libs/giflib-4.1.4-1/include
 -ID:/devel/emacs/libs/jpeg-6b-4/include
 -ID:/devel/emacs/libs/tiff-3.8.2-1/include
 -ID:/devel/emacs/libs/gnutls-2.10.1/include --ldflags
 -LD:/devel/emacs/libs/gnutls-2.10.1/lib'