[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!
-Miles
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.
- Re: position on changing defaults?, (continued)
- Re: position on changing defaults?, Lennart Borgman (gmail), 2008/03/05
- Re: position on changing defaults?, Bastien, 2008/03/05
- Re: position on changing defaults?, Richard Stallman, 2008/03/06
- Re: position on changing defaults?, Miles Bader, 2008/03/05
- Re: position on changing defaults?, Juri Linkov, 2008/03/05
- Re: position on changing defaults?, Kim F. Storm, 2008/03/06
- Re: position on changing defaults?, Richard Stallman, 2008/03/07
- Re: position on changing defaults?, Miles Bader, 2008/03/07
- Re: position on changing defaults?, Lennart Borgman (gmail), 2008/03/07
- Re: position on changing defaults?, Richard Stallman, 2008/03/08
- deactivation in "shift-select" mode,
Miles Bader <=
- Re: deactivation in "shift-select" mode, Chong Yidong, 2008/03/07
- Re: deactivation in "shift-select" mode, Miles Bader, 2008/03/07
- Re: deactivation in "shift-select" mode, Miles Bader, 2008/03/07
- Re: deactivation in "shift-select" mode, Kim F. Storm, 2008/03/08
- Re: position on changing defaults?, Richard Stallman, 2008/03/09
- Re: position on changing defaults?, Miles Bader, 2008/03/09
- Shift-movement selection (was: position on changing defaults?), Stefan Monnier, 2008/03/09
- Re: Shift-movement selection, Miles Bader, 2008/03/09
- Re: Shift-movement selection, Kim F. Storm, 2008/03/09
- Re: Shift-movement selection, Miles Bader, 2008/03/09