emacs-devel
[Top][All Lists]
Advanced

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

Re: Old CUA and new keyboard.c (was: Problem with latest CVS version of


From: Kim F. Storm
Subject: Re: Old CUA and new keyboard.c (was: Problem with latest CVS version of keyboard.c (solved) )
Date: 13 Jun 2002 00:06:27 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

"Stefan Monnier" <monnier+gnu/address@hidden> writes:

> cua-2.10 puts a CUA-prefix-handler function on C-x in key-translation-map.
> This function will remap C-x to something else or to the same
> thing depending on the situation.  Problem is, this function
> is used for C-c as well (and maybe other keys), so it needs to be
> told what was the key that triggered it.
> It figures this out by using last-input-char (it also uses this-command-keys
> although I'm not quite sure why and what it does with it).

I don't quite remember why this-command-keys was used, but probably it had
something to do with only wanting to remap the first C-c or C-x in a key
sequence.  In any case, that's irrelevant now.

> 
> So the problem is that key-translation-map used to be applied immediately
> and thus CUA-prefix-handler was called as soon as the user hit C-x, whereas
> the new code waits to see whether this C-x starts a function-key
> sequence (in which case key-translation-map should not be applied yet)
> and thus CUA-prefix-handler is only called once the user hits the next key.


So the new code fundamentally changes the way key-translation-map works.
Before, it would be activated immediately, now it is delayed until the
next key is typed.

If I still had to rely on the key-translation-map for cua, I'd
definitely object to this change in behaviour, as it would make it
impossible to intercept the C-x and C-c prefix keys... which does
require the "immediate" activation (it obviously cannot wait for the
next key to be typed).

Since cua no longer depends on this behaviour, and since I'm not aware
of any other code which depends on this, I really don't care much
about the issue.  Also, I'm uncertain whether the behaviour that I
used in cua was actually documented, or it just worked that way by
chance.

But as we have seen, there may be some nasty effects experienced by
users which upgrade from, say, 21.1 to 21.4 if they already have the
old cua-mode in their load-path; in that case, emacs 21.4 will behave
very strange (read: buggy).  So we need to address that issue!

I was wondering why you need to wait for the next character after a
C-x or C-c to see if they start a function key...  I don't think those
specific keys will ever do that, so maybe you should only delay the
use of key-translation-map in case the key is actually a potential
candidate for starting a function key.

> 
> Let's say she wants to do C-x C-f so with the new keyboard.c code,
> when CUA-prefix-handler is called last-input-char is not C-x but C-f,
> so CUA gets all confused and we end up with C-f C-f whereas
> CUA thought it wasn't changing anything.
> 

That is another problem -- caused by key-translation-map not being
activated immediately; as explained above, that is necessary for
(old) cua to work properly.  So if it does that, last-input-char
would be correct again.

> Not knowing exactly what the semantics of last-input-char are supposed
> to be and how/if functions in key-translation-map should be allowed
> to use it or should use some other way to figure out what key sequence
> triggered them, I'm wondering if my fix introduced a "significant"
> incompatibility or not.

This is a major incompatibility, but whether it is "significant"
depends on whether we can find some way of preventing an existing old
cua-mode package from being loaded instead of the build-in package if
the user upgrades to 21.4.

> Also if it should be fixed, I'm not sure how to go about it.

See suggestion above.

-- 
Kim F. Storm <address@hidden> http://www.cua.dk




reply via email to

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