From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Xah Lee Newsgroups: gmane.emacs.help Subject: Re: how to do this transient mark trick Date: Mon, 29 Oct 2007 04:36:33 -0700 Organization: http://groups.google.com Message-ID: <1193657793.487396.153170@t8g2000prg.googlegroups.com> References: <5oln36Fnas00U1@mid.dfncis.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Trace: ger.gmane.org 1193658077 8122 80.91.229.12 (29 Oct 2007 11:41:17 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 29 Oct 2007 11:41:17 +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 12:41:19 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 1ImSzd-0007Wh-Vr for geh-help-gnu-emacs@m.gmane.org; Mon, 29 Oct 2007 12:41:18 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1ImSzU-0001AE-0X for geh-help-gnu-emacs@m.gmane.org; Mon, 29 Oct 2007 07:41:08 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!t8g2000prg.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 51 Original-NNTP-Posting-Host: 69.236.97.82 Original-X-Trace: posting.google.com 1193657794 17633 127.0.0.1 (29 Oct 2007 11:36:34 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Mon, 29 Oct 2007 11:36:34 +0000 (UTC) In-Reply-To: <5oln36Fnas00U1@mid.dfncis.de> User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/419.3 (KHTML, like Gecko) Safari/419.3,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: t8g2000prg.googlegroups.com; posting-host=69.236.97.82; posting-account=ps2QrAMAAAA6_jCuRt2JEIpn5Otqf_w0 Original-Xref: shelby.stanford.edu gnu.emacs.help:153413 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:48898 Archived-At: 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 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-. > 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