help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: how to do this transient mark trick


From: Xah Lee
Subject: Re: how to do this transient mark trick
Date: Mon, 29 Oct 2007 04:36:33 -0700
User-agent: G2/1.0

with CUA mode one, shift-arrow will select (and highlight) text.

  Xah
  address@hidden
  http://xahlee.org/

On Oct 29, 8:22 am, matthias <address@hidden> wrote:
> Hi there,
>
> I have
>
>   '(transient-mark-mode t)
>
> in my custom-set-variables and for each of the four arrow-keys of my
> keyboard i have a function of the following kind in my .emacs file and i
> bind the according function to the corresponding arrow-key:
>
> (defun set-mark-and-move-point-right ()
>    "sets mark if mark is not set and move point one line up"
>    (interactive)
>    (when (not (region-active-p))
>      (call-interactively 'set-mark-command)
>      )
>    (forward-char 1))
>
> region-active-p looks like that
>
> (defun region-active-p ()
>    "Say whether the region is active or not."
>    (and (boundp 'transient-mark-mode)
>         transient-mark-mode
>         (boundp 'mark-active)
>         mark-active))
>
> i achieve the desired behavior that the region is activated and
> colorized by transient-mark-mode when i press shift-<some_arrow>.
> However i have the feeling that this is not a clean way to achieve this
> since using these functions I a can also
>
> press shift-<arrow>
> release shift already
> press some <arrow>s and region is still colorized
>
> call for help is like this: Can it be done better? Is it possible to
> de-activate the region when shift is released?
>
> thanks for your help.
>
> matthias




reply via email to

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