unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* C-Ret: cua and icicles
@ 2010-05-22 11:07 Dirk80
  2010-05-22 15:35 ` Drew Adams
  0 siblings, 1 reply; 10+ messages in thread
From: Dirk80 @ 2010-05-22 11:07 UTC (permalink / raw)
  To: Help-gnu-emacs


Hi,

I'm using cua and I started to use icicles which is really great. I know
that using cua and icicles at the same time is not really recommended. But
at the moment I only have problems with C-Ret. In Emacswiki I found the
following text:


6. I expect that you will need to bind one or more keys differently, to
accommodate both CUA mode and Icicles. At a minimum, you will need to either
(a) bind ‘cua-set-rectangle-mark’ to something besides ‘C-RET’ in CUA mode
or (b) bind ‘icicle-candidate-action’ to something besides ‘C-RET’ in each
of the minibuffer completion maps when you are in Icicle mode.

I'd like to have the following behaviour:
When I am in a normal buffer then I want that C-RET is bound to
‘cua-set-rectangle-mark’. When I'm in minibuffer or *completion* buffer then
I want that C-RET is bound to ‘icicle-candidate-action’.

Would be great if you can help me to get this desired behaviour.

And then another question to this topic:
Are there more key combination where cua and icicles conflict?

Thank you.

Greetings
Dirk
-- 
View this message in context: http://old.nabble.com/C-Ret%3A-cua-and-icicles-tp28642650p28642650.html
Sent from the Emacs - Help mailing list archive at Nabble.com.




^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: C-Ret: cua and icicles
  2010-05-22 11:07 C-Ret: cua and icicles Dirk80
@ 2010-05-22 15:35 ` Drew Adams
  2010-05-24 19:54   ` Dirk80
  0 siblings, 1 reply; 10+ messages in thread
From: Drew Adams @ 2010-05-22 15:35 UTC (permalink / raw)
  To: 'Dirk80', Help-gnu-emacs

Hi Dirk,

> I'm using cua and I started to use icicles which is really 
> great. I know that using cua and icicles at the same time
> is not really recommended. But at the moment I only have
> problems with C-Ret. In Emacswiki I found the following text:
> 
> 6. I expect that you will need to bind one or more keys 
> differently, to accommodate both CUA mode and Icicles.
> At a minimum, you will need to either (a) bind
> 'cua-set-rectangle-mark' to something besides 'C-RET' in
> CUA mode or (b) bind 'icicle-candidate-action' to something
> besides 'C-RET' in each of the minibuffer completion maps
> when you are in Icicle mode.
> 
> I'd like to have the following behaviour:
> When I am in a normal buffer then I want that C-RET is bound to
> 'cua-set-rectangle-mark'. When I'm in minibuffer or 
> *completion* buffer then I want that C-RET is bound to
> 'icicle-candidate-action'.
> 
> Would be great if you can help me to get this desired behaviour.
> 
> And then another question to this topic:
> Are there more key combination where cua and icicles conflict?

Starting with the last question first:
I don't know. I'm not very familiar with CUA-mode.

A good way to discover key conflicts is to load my library `help-fns+.el' and
use `C-h C-k' (`describe-keymap') to list the key bindings of any keymap you're
interested in, in a user-friendly format.

You can do that for the CUA-mode map and for `icicle-mode-map', to see where
there might be conflicts outside the minibuffer. You can do that for the
minibuffer maps with Icicle mode turned off and on, comparing the two, to see
whether CUA-mode has any minibuffer key conflicts. (To see the names of the
minibuffer keymaps, do `C-h v minibuffer.*-map S-TAB'.)


The most important things to know about Icicles key bindings are these:

0. The complete key-binding doc is here:
http://www.emacswiki.org/emacs/Icicles_-_Key_Bindings

1. When you exit Icicle mode (`M-x icy-mode') you get back your normal key
bindings again.

2. Icicle mode is a global minor mode. And in Emacs, minor-mode key bindings
take precedence over major-mode and global key bindings. So regardless of what
bindings you define globally or in a major mode, if Icicle mode binds the same
key, it wins (unless some other minor mode binds it...).

3. The Icicle-mode key bindings (`icicle-mode-map') are top-level bindings.
Besides these, Icicles also binds some keys in the standard minibuffer keymaps
(not in `icicle-mode-map').

4. *You* control the Icicle-mode bindings using user option
`icicle-top-level-key-bindings'. You can easily delete any default bindings you
do not want, change the default `icicle-mode' bindings, or add new ones. You do
not need to know Emacs Lisp to configure key bindings using this user option -
it is straightforward. And if you set option `icicle-top-level-key-bindings' to
nil, then Icicles binds *no* top-level keys (it binds only minibuffer keys).

6. In some cases, Icicle mode remaps some top-level keys only if they are bound
to certain functions provided other libraries (e.g. ibuffer, ess, dired). That
is, Icicles provides enhanced behavior for some commands from other libraries.
If you load such a library after turning on Icicle mode, you can toggle Icicle
mode twice to make Icicles recognize that the library has been loaded and remap
such keys to their Icicles enhancements. Again, whether Icicles remaps a given
key is controlled by option `icicle-top-level-key-bindings'.

7. There are also some Icicles user options that let you control some of the
Icicles minibuffer bindings. To change any other minibuffer bindings (not
associated with user options) you might need to resort to some Emacs-Lisp code.
Those user options all have `key' in their name, so `C-h v icicle-.*key S-TAB'
will show you all of them - just use `C-M-next' to see the doc string for each
in turn, etc.

For example, that will show that the (default) value of option
`icicle-apropos-cycle-next-keys' is the list ([next]), meaning that there is
only one key, `next' (PageDown) bound to cycle to the next candidate. You
customize these key options the same way you customize option
`icicle-top-level-key-bindings'. In this case, you could add more keys to the
list or change [next] to some other key.


Wrt your question about C-RET:

Icicles does not bind C-RET outside of the minibuffer, where you say you do want
Icicles to bind it anyway. So I do not see the problem you are having with
C-RET.  Please let me know just what happens that you would like to change -
give me a step-by-step description (recipe) so I can understand. You can mail me
off list.

HTH - Drew





^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: C-Ret: cua and icicles
  2010-05-22 15:35 ` Drew Adams
@ 2010-05-24 19:54   ` Dirk80
  2010-05-24 20:02     ` Lennart Borgman
  0 siblings, 1 reply; 10+ messages in thread
From: Dirk80 @ 2010-05-24 19:54 UTC (permalink / raw)
  To: Help-gnu-emacs


Hello,

Drew Adams helped me to find a solution.

When you use C-RET during completion, you are not in the *Completions*
buffer, you are in the Minibuffer.

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
http://www.emacswiki.org/emacs/IciclesIssuesClosed  (search this emacswiki
page for the function `my-c-return').

Greetings,
Dirk
-- 
View this message in context: http://old.nabble.com/C-Ret%3A-cua-and-icicles-tp28642650p28661114.html
Sent from the Emacs - Help mailing list archive at Nabble.com.




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: C-Ret: cua and icicles
  2010-05-24 19:54   ` Dirk80
@ 2010-05-24 20:02     ` Lennart Borgman
  2010-05-24 21:22       ` Drew Adams
  0 siblings, 1 reply; 10+ messages in thread
From: Lennart Borgman @ 2010-05-24 20:02 UTC (permalink / raw)
  To: Dirk80; +Cc: Help-gnu-emacs

On Mon, May 24, 2010 at 9:54 PM, Dirk80 <dirk@dirkundsari.de> wrote:
>
> Hello,
>
> Drew Adams helped me to find a solution.
>
> When you use C-RET during completion, you are not in the *Completions*
> buffer, you are in the Minibuffer.
>
> 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.



^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: C-Ret: cua and icicles
  2010-05-24 20:02     ` Lennart Borgman
@ 2010-05-24 21:22       ` Drew Adams
  2010-05-24 21:46         ` Lennart Borgman
  0 siblings, 1 reply; 10+ messages in thread
From: Drew Adams @ 2010-05-24 21:22 UTC (permalink / raw)
  To: 'Lennart Borgman', 'Dirk80'; +Cc: Help-gnu-emacs

> > 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.





^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: C-Ret: cua and icicles
  2010-05-24 21:22       ` Drew Adams
@ 2010-05-24 21:46         ` Lennart Borgman
  2010-05-24 22:08           ` Drew Adams
  0 siblings, 1 reply; 10+ messages in thread
From: Lennart Borgman @ 2010-05-24 21:46 UTC (permalink / raw)
  To: Drew Adams, Kim F. Storm; +Cc: Help-gnu-emacs, Dirk80

On Mon, May 24, 2010 at 11:22 PM, Drew Adams <drew.adams@oracle.com> wrote:
>> > 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.


It overrides more. It is an emulation minor mode. It therefore has a
special status and overrides also minor mode bindings.

If it did not do this it would be quite useless.


> Unlike CUA mode, Icicles uses the standard
> minibuffer keymaps to affect keys in the minibuffer, and there are reasons for
> that.


Icicles is a normal minor mode, yes.


> 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.


See above. It is not another (normal) minor mode. It is an emulating
minor mode. (Which just happens to be a minor mode because non-major
modes are called minor modes.)


> (since CUA-mode lays hold C-RET ubiquitously).


I think that is a problem. It is used to start rectangle editing which
surely is a nice feature for those who needs it, but it is IMO not
important enough to steel the C-RET key. You can customize it in cua,
but I think the default should be some less important key.

And this is part of cua-mode just because Kim wrote it ;-)

It is nice but not included in what I talk about when I mention
cua-mode. I think it should be moved to a global minor mode on its own
(not an emulation minor mode).


> 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.


You can customize the binding in cua-mode too. That is what I have done.


> If CUA mode did not fail itself to distinguish the minibuffer case, it would be
> even more trivial.


cua-mode should NOT do that but the key and command we are talking
about should not be in cua-mode.

I think all who knows about cua-mode on the devel list are aware of
this. It is just a matter of time, someone must have time to fix it. I
have included Kim in the receivers here if he has a different opinion.



^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: C-Ret: cua and icicles
  2010-05-24 21:46         ` Lennart Borgman
@ 2010-05-24 22:08           ` Drew Adams
  2010-05-24 22:33             ` Lennart Borgman
  0 siblings, 1 reply; 10+ messages in thread
From: Drew Adams @ 2010-05-24 22:08 UTC (permalink / raw)
  To: 'Lennart Borgman', 'Kim F. Storm'
  Cc: Help-gnu-emacs, 'Dirk80'

Listen, I am not trying to say anything about how CUA mode should be
implemented.  I only questioned whether it really should make C-RET in the
minibuffer be `cua-set-rectangle-mark' (which question you snipped).  I cannot
say it should or should not, since I don't use CUA mode and am no expert on it.
I just raised the question based on the command name: I don't imagine rectangles
in the minibuffer (but why not?).

> > (since CUA-mode lays hold C-RET ubiquitously).
> 
> I think that is a problem. It is used to start rectangle editing which
> surely is a nice feature for those who needs it, but it is IMO not
> important enough to steel the C-RET key. You can customize it in cua,
> but I think the default should be some less important key.
> 
> And this is part of cua-mode just because Kim wrote it ;-)
> 
> It is nice but not included in what I talk about when I mention
> cua-mode. I think it should be moved to a global minor mode on its own
> (not an emulation minor mode).

That may be (or not be).  It's not for me to say.  Whether C-RET should be bound
by CUA mode by default or included in CUA mode at all is a different question.
I did not question that.  That apparently is your topic (not mine or the OP's).

I just asked whether - assuming it _should_ bind C-RET in general, that binding
is also appropriate for the minibuffer.  And that too is not for me to say - I
do not know.

I am in no way objecting to the CUA design or how it is implemented.  I simply
tried to reply to your comment that Icicles should automatically take care of
the kind of customization that the user wanted.  I hope I was clear.

> > 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.
> 
> You can customize the binding in cua-mode too. That is what I 
> have done.

Your point was that users should not have to deal with such customization, that
"Icicles should of course try to do this, not you".  Now you are saying that a
user can take care of it himself by customizing cua-mode.  That's no doubt good
for users to know, but it does not speak to your point.

> cua-mode should NOT do that but the key and command we are talking
> about should not be in cua-mode.
> 
> I think all who knows about cua-mode on the devel list are aware of
> this. It is just a matter of time, someone must have time to fix it. I
> have included Kim in the receivers here if he has a different opinion.

Dunno, but it seems to me you've sidetracked the thread.  The OP just wanted to
let others know about a simple customization to be able to use C-RET for Icicles
in the minibuffer while still using CUA mode.  You stated that Icicles should do
that for him.  I tried to explain the interaction among the keymaps etc.  Now
you're onto another question for CUA development of whether C-RET should even be
part of CUA mode.  What's next?




^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: C-Ret: cua and icicles
  2010-05-24 22:08           ` Drew Adams
@ 2010-05-24 22:33             ` Lennart Borgman
  2010-05-24 22:53               ` Drew Adams
  0 siblings, 1 reply; 10+ messages in thread
From: Lennart Borgman @ 2010-05-24 22:33 UTC (permalink / raw)
  To: Drew Adams; +Cc: Help-gnu-emacs, Dirk80, Kim F. Storm

On Tue, May 25, 2010 at 12:08 AM, Drew Adams <drew.adams@oracle.com> wrote:
>
> Your point was that users should not have to deal with such customization, that
> "Icicles should of course try to do this, not you".  Now you are saying that a
> user can take care of it himself by customizing cua-mode.  That's no doubt good
> for users to know, but it does not speak to your point.


Yes, maybe I went to far but I felt I have to clear up some
misunderstandings in what you wrote. User will have to deal with it.

But this information was mainly meant for you. You can detect this bad
situation and tell the user how to overcome it. If you are want to
grab a key that is used by a major component in Emacs that many users
are using I think that helps quite a bit.


> I tried to explain the interaction among the keymaps etc.


Yes, but you did not get it right. Your description that cua-mode "is
just one mode among a
multitude of possible modes" is highly misleading. It is an emulation
mode and that is very important.

However the rectangle thing is not part of the emulation of CUA and
should IMO not be in that keymap. It should rather be a separate,
normal minor mode.



^ permalink raw reply	[flat|nested] 10+ messages in thread

* RE: C-Ret: cua and icicles
  2010-05-24 22:33             ` Lennart Borgman
@ 2010-05-24 22:53               ` Drew Adams
  2010-05-24 23:06                 ` Lennart Borgman
  0 siblings, 1 reply; 10+ messages in thread
From: Drew Adams @ 2010-05-24 22:53 UTC (permalink / raw)
  To: 'Lennart Borgman'
  Cc: Help-gnu-emacs, 'Dirk80', 'Kim F. Storm'

> Yes, maybe I went to far but I felt I have to clear up some
> misunderstandings in what you wrote. User will have to deal with it.
> 
> But this information was mainly meant for you. You can detect this bad
> situation and tell the user how to overcome it. If you are want to
> grab a key that is used by a major component in Emacs that many users
> are using I think that helps quite a bit.

I give up.  Fuggedabowdit.

> > I tried to explain the interaction among the keymaps etc.
> 
> Yes, but you did not get it right. Your description that
> cua-mode "is just one mode among a multitude of possible modes"
> is highly misleading. It is an emulation mode and that is very
> important.

That was not a description of cua mode.
It was an expression of _my opinion_:

 "To me, it is just one mode among a multitude of possible modes."
  ^^^^^

Am I not being clear, or are you willfully misreading and snipping the meaning
out of what I write?

We apparently agree on one thing, however.  As I said:

 "You feel that CUA mode is extremely important, and everything
  in Emacs should bend over backwards to cater to CUA mode."

That extreme importance (for you) follows, you say, from CUA mode being an
emulation mode.

We can perhaps agree to disagree about the extreme importance.  That is a matter
of _opinion_.  It is not that you or I "did not get it right" or is
"misunderstanding".  It is that we have different opinions.  Please do not
confuse making your opinion known with helping someone "get it right".

> However the rectangle thing is not part of the emulation of CUA and
> should IMO not be in that keymap. It should rather be a separate,
> normal minor mode.

Tell it to emacs-dev.





^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: C-Ret: cua and icicles
  2010-05-24 22:53               ` Drew Adams
@ 2010-05-24 23:06                 ` Lennart Borgman
  0 siblings, 0 replies; 10+ messages in thread
From: Lennart Borgman @ 2010-05-24 23:06 UTC (permalink / raw)
  To: Drew Adams; +Cc: Help-gnu-emacs, Dirk80, Kim F. Storm

On Tue, May 25, 2010 at 12:53 AM, Drew Adams <drew.adams@oracle.com> wrote:
>>
>> Yes, but you did not get it right. Your description that
>> cua-mode "is just one mode among a multitude of possible modes"
>> is highly misleading. It is an emulation mode and that is very
>> important.
>
> That was not a description of cua mode.
> It was an expression of _my opinion_:
>
>  "To me, it is just one mode among a multitude of possible modes."
>  ^^^^^


Then I think you are missing something. Emulation modes are meant to
work always. They are more in the body memory of the user because they
are used so often.



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2010-05-24 23:06 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-22 11:07 C-Ret: cua and icicles Dirk80
2010-05-22 15:35 ` Drew Adams
2010-05-24 19:54   ` Dirk80
2010-05-24 20:02     ` Lennart Borgman
2010-05-24 21:22       ` Drew Adams
2010-05-24 21:46         ` Lennart Borgman
2010-05-24 22:08           ` Drew Adams
2010-05-24 22:33             ` Lennart Borgman
2010-05-24 22:53               ` Drew Adams
2010-05-24 23:06                 ` Lennart Borgman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).