emacs-devel
[Top][All Lists]
Advanced

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

Re: Shift selection using interactive spec


From: Chong Yidong
Subject: Re: Shift selection using interactive spec
Date: Fri, 14 Mar 2008 16:52:39 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1.92 (gnu/linux)

Stefan Monnier <address@hidden> writes:

>>> What if a movement command uses a lisp form rather than a string as
>>> interactive spec?  
>>> 
>>> Then, how do you do the equivalent of '^' in that case?
>
>> Is there any movement command that uses a lisp form spec?  If these
>> are sufficiently rare, the command itself could simply be modified
>> directly.
>
>> Not that the @ and * interactive specs would also have problems with
>> interactive specs that are lisp forms.
>
> *Any* letter in `interactive' should have a simple Elisp equivalent.
> I suggest you write the code directly in an elisp function to start
> with, and then call that function from callint.c.

The way I see it, there are a few ways we can go with this.

1. Add a new code LETTER for interactive specs, e.g. t

   This provides an argument that is t if the command was called by
   shift translation.  In other words, read_key_sequence couldn't find
   a keybinding for the entered key sequence, so it tried removing the
   shift modifier and found the binding to this command.

   Then we modify the motion commands to accept the additional
   argument, e.g.:

   (forward-char &optional N) -> (forward-char &optional N shift-select)

   The body of each motion command is then changed to DTRT with the
   new argument.

   With this approach, there is the least amount of magic going on,
   but adding an argument to all motion commands may cause disruption
   and incompatibilities.  How much disruption remains unclear to me.

1a. As above, but make the letter activate so long as the keybinding
    contains a shift (i.e. even if the command was found with a direct
    keybinding.)

2. Don't bother with interactive spec.  Provide a built-in function
   that says whether a command has been run using shift translation.
   Call it, e.g.,

      this-single-command-keys-shift-translated

   Directly modify the body of each motion command to call
   this-single-command-keys-shift-translated and DTRT.

2a. As above, but also for direct keybindings with the shift modifier.
    (This is the idea that Stefan has been pushing.)

3. Use a non-letter interactive code, analogous to @ and *, that
   causes Fcall_interactively to perform the handling of
   transient-mark-mode automagically.  This was the code I showed.
   Because it's a non-letter code, we don't need to change the
   argument list.  This approach needs the least new code, and might
   be less disruptive, but it's obviously a little magical.

3a. As above, but also for direct keybindings with the shift modifier.




reply via email to

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