From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andreas =?iso-8859-1?q?R=F6hler?= Newsgroups: gmane.emacs.help Subject: Re: how to do this transient mark trick Date: Mon, 29 Oct 2007 11:35:21 +0100 Message-ID: <200710291135.22452.andreas.roehler@online.de> References: <5oln36Fnas00U1@mid.dfncis.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1193654110 27291 80.91.229.12 (29 Oct 2007 10:35:10 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 29 Oct 2007 10:35:10 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Oct 29 11:35:12 2007 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1ImRxd-0006vr-Fg for geh-help-gnu-emacs@m.gmane.org; Mon, 29 Oct 2007 11:35:09 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ImRxU-0000iF-9V for geh-help-gnu-emacs@m.gmane.org; Mon, 29 Oct 2007 06:35:00 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1ImRxA-0000ew-Ld for help-gnu-emacs@gnu.org; Mon, 29 Oct 2007 06:34:40 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1ImRx8-0000aa-OV for help-gnu-emacs@gnu.org; Mon, 29 Oct 2007 06:34:39 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ImRx8-0000aC-HX for help-gnu-emacs@gnu.org; Mon, 29 Oct 2007 06:34:38 -0400 Original-Received: from moutng.kundenserver.de ([212.227.126.174]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1ImRx4-000082-9g for help-gnu-emacs@gnu.org; Mon, 29 Oct 2007 06:34:34 -0400 Original-Received: from noname (p54BE9557.dip0.t-ipconnect.de [84.190.149.87]) by mrelayeu.kundenserver.de (node=mrelayeu5) with ESMTP (Nemesis) id 0ML25U-1ImRwu2amr-0004yx; Mon, 29 Oct 2007 11:34:33 +0100 User-Agent: KMail/1.9.5 In-Reply-To: <5oln36Fnas00U1@mid.dfncis.de> Content-Disposition: inline X-Provags-ID: V01U2FsdGVkX19EMemaz3gn093vGNReXS6NADxXoMq/fDy3PWf Lzm5fa6U8ZK+wmbqQ8Khr4DmsDqP8udzXwS+DCh8EgSHEumxud ggr8kS1Qbf366UALNvS+w== X-detected-kernel: by monty-python.gnu.org: Linux 2.6? (barebone, rare!) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:48895 Archived-At: 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-. > 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- > release shift already > press some 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- to set the mark and move cursor: region is displayed. Press C- again and region is gone. Andreas R=F6hler