emacs-devel
[Top][All Lists]
Advanced

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

Re: Shift-movement selection


From: Thomas Lord
Subject: Re: Shift-movement selection
Date: Wed, 12 Mar 2008 16:59:35 -0700
User-agent: Thunderbird 1.5.0.5 (X11/20060808)

Maybe it's even simpler than an i-search-like recursive
edit:

I'm not certain how CUA mode works in particular but
"shift-mark mode" in the abstract is a very logical
extension of Emacs' mark-stack model with the added
benefit that it "works like Windows users expect":

Emacs by default lets you push and pop marks on
the stack.

The shift-mark mode concept seems to me to be the
idea of "tentatively" pushing a mark on the mark stack.
It requires a two-phase commit from the user to turn
that into a first-class mark and the default outcome is
to abandon the tentative mark.

To "enter shift-mark mode" is to push a tentative mark.
From this point on, commands behave as if a mark was
pushed -- but this is a tentative mark and could go away
easily between any two commands.

After pushing a tentative mark, the user edits as normal
with that mark in effect -- but with a catch.   There is
a post-command hook installed that, unless some flag
is flipped by the last command, will discard the tentative
mark.

By default, we want a shifted key-sequence to mean
the same thing as the un-shifted sequence, except that
the flag is flipped and so the tentative mark stays on
the stack.   A single command used as the default binding
of many shifted keys can accomplish that.   That same
command can also arrange to implicitly push a tentative
mark, if invoked when not already in shift-mode.

This saves keystrokes even for hard-core emacs users:
With tentative marks, the default is to discard the mark.
That's very convenient when copying to the kill ring.
Set a tentative mark at one end of what to copy.  Shiftedly
navigate to the other end.  Copy to the kill ring discarding
the tentative mark (or, S-M-w to copy but keep the tentative
mark).  You've added to the kill ring without needing to
clear an item from your mark stack.

Finally, use S-C-space to convert a tentative mark to a
permanent one, when you want.

Implementing this requires a strange function to serve as
the default binding of relevant shifted keys, plus some
hook functions and tweaks to the mark stack to manage
"tentative marks".  Not much else.

-t






reply via email to

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