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: Thomas Lord
Subject: Re: Shift selection using interactive spec
Date: Sat, 15 Mar 2008 14:45:31 -0700
User-agent: Thunderbird 1.5.0.5 (X11/20060808)

Stefan Monnier wrote:
Calling the function just means "I'm a movement command and would like
to follow the new select-on-shift behavior".
  

It's a red herring to think in terms of movement commands.

For example, if C-t invokes transpose-chars then,
by default, S-C-t should also invoke transpose-chars
but override the default and make the new default to
preserve the transient mark.   S-C-f S-C-f S-C-t S-C-f
makes one modification to the buffer and leaves a
transient region of three characters.   (Hopefully
transpose-chars is already coded so as to make
its buffer changes under save-excursion.)



Then the function can decide on what actually happens when.

  

The default behavior is to remove the transient region.

The default treatment of a shift sequence with no other binding
is to run the unshifted sequence, but keep the transient region
(by default).

A tiny minority of commands need to behave differently
from that but that minority isn't identical to "motion commands"
and that minority isn't treated homogenously (e.g., yank and
replace-string are both exceptions but they are different kinds of
exceptions).






  
  "Extend the temporary region highlighting for the next command"
    

  
is a neater and more self-contained task for a function than
    

  
  "Extend the temporary region highlighting for the next command, but
   only if this-single-command-shift-translated is non-nil; otherwise,
   do nothing"
    

  

That's true but it can be even simpler than that by
setting the defaults properly, with regard to the
right model of select-shift state.


The docstring of the function would be more like

  "Handle the mark selection for movement commands."

  

"Movement commands" isn't the right concept.   The decision
to extend or not extend the transient region is more a matter of
how a command is invoked than what it does, usually.   (Again,
commands like yank are exceptions).

-t



reply via email to

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