unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: matthias <pfemat@web.de>
To: help-gnu-emacs@gnu.org
Subject: how to do this transient mark trick
Date: Mon, 29 Oct 2007 11:22:25 -0400	[thread overview]
Message-ID: <5oln36Fnas00U1@mid.dfncis.de> (raw)

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	other threads:[~2007-10-29 15:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-29 15:22 matthias [this message]
2007-10-29 10:35 ` how to do this transient mark trick 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5oln36Fnas00U1@mid.dfncis.de \
    --to=pfemat@web.de \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).