emacs-devel
[Top][All Lists]
Advanced

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

Re: position on changing defaults?


From: Lennart Borgman (gmail)
Subject: Re: position on changing defaults?
Date: Mon, 10 Mar 2008 00:17:50 +0100
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9) Gecko/20071031 Thunderbird/2.0.0.9 Mnenhy/0.7.5.666

Kim F. Storm wrote:
Richard Stallman <address@hidden> writes:

Binding some set of shifted keys to a command that says "run the
equivalent non-shifted character but do this other special thing"
seems better, because you could override that for individual shifted
keys if you wish.

The problem is that running something based on the key - rather
than on the command bound to that key is a bad road to take.

CUA mode looks for a 'CUA property with value 'move to detect what
keys are movements to which the shift modifier may apply.
This has the advantage that unrelated modes simply set that property
to make them "CUA aware".
A generic solution could be to look for a non-nil 'shift property on
the command and run a shifted-key-hook prior to running the command,
i.e. something like this in the command loop just before running the
command:

          if (!NILP (Vshifted_key_hook) && key_shifted_p
             && !NILP (Vthis_command)
             && SYMBOLP (Vthis_command)
             && !NILP (Fget (Vthis_command, Qshift))
             && !NILP (Vrun_hooks))
            safe_run_hooks (Qshifted_key_hook);
This could be combined with the delayed deactivate-mark hack
we discussed earlier to deactivate the mark on non-shifted movement...

I can make a patch to do this...

Maybe this could be done using a pre-emulation-command-hook run before pre-command-hook? (Compare emulation-mode-maps.)

Then some code similar to the code Stefan just sent could be used. That code could look for the CUA property. Maybe it also could look in a table when deciding whether to deactivate the mark.




reply via email to

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