unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Re: how to do this transient mark trick
  2007-10-29 15:22 how to do this transient mark trick matthias
@ 2007-10-29 10:35 ` Andreas Röhler
  2007-10-29 11:36 ` Xah Lee
       [not found] ` <mailman.2705.1193654082.18990.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 4+ messages in thread
From: Andreas Röhler @ 2007-10-29 10:35 UTC (permalink / raw)
  To: help-gnu-emacs

Am Montag, 29. Oktober 2007 16:22 schrieb matthias:
> 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

AFAIU that's the usual behaviour if
`transient-mark-mode' is on.

BTW for practical purposes--beside of exercises--I
rather doubt such a construct being useful.

As your code shows already, just press C-<space> to set
the mark and move cursor: region is displayed.

Press C-<space> again and region is gone.

Andreas Röhler

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: how to do this transient mark trick
  2007-10-29 15:22 how to do this transient mark trick matthias
  2007-10-29 10:35 ` Andreas Röhler
@ 2007-10-29 11:36 ` Xah Lee
       [not found] ` <mailman.2705.1193654082.18990.help-gnu-emacs@gnu.org>
  2 siblings, 0 replies; 4+ messages in thread
From: Xah Lee @ 2007-10-29 11:36 UTC (permalink / raw)
  To: help-gnu-emacs

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

  Xah
  xah@xahlee.org
  http://xahlee.org/

On Oct 29, 8:22 am, matthias <pfe...@web.de> 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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* how to do this transient mark trick
@ 2007-10-29 15:22 matthias
  2007-10-29 10:35 ` Andreas Röhler
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: matthias @ 2007-10-29 15:22 UTC (permalink / raw)
  To: help-gnu-emacs

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: how to do this transient mark trick
       [not found] ` <mailman.2705.1193654082.18990.help-gnu-emacs@gnu.org>
@ 2007-10-29 16:25   ` matthias
  0 siblings, 0 replies; 4+ messages in thread
From: matthias @ 2007-10-29 16:25 UTC (permalink / raw)
  To: help-gnu-emacs

Andreas Röhler wrote:

> AFAIU that's the usual behaviour if
> `transient-mark-mode' is on.

not exactly. the difference is that the i am already used to the 
intended behavior. Only i can't exactly state from what editor (probably 
mostt of those i have ever used...)

> BTW for practical purposes--beside of exercises--I
> rather doubt such a construct being useful.

That should be a question of personal taste.

> As your code shows already, just press C-<space> to set
> the mark and move cursor: region is displayed.
> 
> Press C-<space> again and region is gone.

I can't follow here - what is your statement? I probably did not 
motivate my code enough. I know about C-<space> and i wanted to *change* 
to the proposed behavior for "usability"-reasons.

matthias

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-10-29 16:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-29 15:22 how to do this transient mark trick matthias
2007-10-29 10:35 ` Andreas Röhler
2007-10-29 11:36 ` Xah Lee
     [not found] ` <mailman.2705.1193654082.18990.help-gnu-emacs@gnu.org>
2007-10-29 16:25   ` matthias

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).