help-gnu-emacs
[Top][All Lists]
Advanced

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

RE: C-Ret: cua and icicles


From: Drew Adams
Subject: RE: C-Ret: cua and icicles
Date: Mon, 24 May 2010 14:22:08 -0700

> > So the desired behaviour is when cua mode and icy mode are 
> > active at the same time: When you press C-RET in minibuffer
> > then use `icicle-candidate-action', otherwise use
> > `cua-set-rectangle-mark'.
> >
> > The solution is in the EmacsWiki:
> > http://www.emacswiki.org/emacs/IciclesIssuesClosed  (search 
> > this emacswiki page for the function `my-c-return').
> 
> That is good, but Icicles should of course try to do this, not you.

CUA is a minor mode. Its key bindings therefore override all local bindings,
including minibuffer bindings.  Unlike CUA mode, Icicles uses the standard
minibuffer keymaps to affect keys in the minibuffer, and there are reasons for
that.

Icicles should not be worrying about each mode that might bind some key in its
minor-mode map and thus override a binding in a minibuffer keymap.  I know you
feel that CUA mode is extremely important, and everything in Emacs should bend
over backwards to cater to CUA mode.  To me, it is just one mode among a
multitude of possible modes.

Icicles could offer a user option for this particular key, so you could more
easily choose a different key than C-RET for Icicles (since CUA-mode lays hold
of C-RET ubiquitously).  But no, I don't bother to do that.  Icicles has user
options for top-level keys and for many of the Icicles minibuffer keys, but not
for that one.

Besides, Dirk wanted to be able to use C-RET itself, not some other key, for
Icicles.  There is no way for a local keymap (such as a minibuffer map) to
override a minor-mode map, so CUA's binding for C-RET wins (command
`cua-set-rectangle-mark').

The only way to take back C-RET for the minibuffer is to remap the CUA-imposed
command to a command that DTRT, distinguishing the minibuffer.  Fortunately, it
is trivial for an Icicles user to do that using Customize.

If CUA mode did not fail itself to distinguish the minibuffer case, it would be
even more trivial.  You could then just remap whatever command CUA mode used for
C-RET in the minibuffer directly to the existing Icicles command for C-RET in
the minibuffer.  Since CUA mode does not distinguish the minibuffer case, you
need to define a little command that does distinguish it and calls either the
CUA-mode command or the Icicles command.

A reasonable question is why CUA-mode makes C-RET in the minibuffer be
`cua-set-rectangle-mark'?  Is that command really useful in the minibuffer?
Dunno - I don't use CUA mode.  But I suspect this is only out of negligence or
laziness in coding: one size fits all.  Once you turn on the CUA minor mode,
C-RET is bound to that command everywhere, even if it might not be appropriate
everywhere.





reply via email to

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