[Top][All Lists]

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

deactivation in "shift-select" mode

From: Miles Bader
Subject: deactivation in "shift-select" mode
Date: Sat, 08 Mar 2008 10:24:37 +0900

Johan Bockgård pointed out (on the #emacs irc channel) that
transient-mark-mode actually _already_ has enough functionality to
allow implementing the desired "deactivation" behavior for
shift-select (where non-shifted movement keys automatically deactivate
any mark which was activated by shifted movement keys), without using
post-command-hook at all!

Basically his idea is to use the "only mode" feature of
transient-mark-mode (setting the transient-mark-mode variable to 'only
instead of t).

I've attached a proof-of-concept that shows how it works; this code
only implements shift-select for the basic cursor movement keys plus
forward/backward-word, but it's obviously trivial to extend to any
other commands desired.

This implementation only works if transient-mark-mode is disabled,
because of the way the transient-mark-mode "only mode" works; my guess
is that this restriction would probably be pretty easy to remove by
simply having a separate variable to enable "only mode" instead of
overloading the meaning of the basic transient-mark-mode variable.

Anyway, here's the example code, which is very simple and seems to
work quite nicely; check it!


Attachment: shift-mark.el
Description: proof-of-concept for \"shift-select\" without post-command-hook

Genealogy, n. An account of one's descent from an ancestor who did not
particularly care to trace his own.

reply via email to

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