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: Cua-mode makes active region disappear in transient-mark-mode Date: Mon, 24 Nov 2008 05:16:02 -0800 (PST) Organization: http://groups.google.com Message-ID: <7e703639-ea41-4d64-b73c-e0f93e415d89@v39g2000pro.googlegroups.com> References: <871vx1o4sh.fsf@iki.fi> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1227536448 669 80.91.229.12 (24 Nov 2008 14:20:48 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 24 Nov 2008 14:20:48 +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 Nov 24 15:21:50 2008 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 1L4cJy-0003Sw-BV for geh-help-gnu-emacs@m.gmane.org; Mon, 24 Nov 2008 15:21:50 +0100 Original-Received: from localhost ([127.0.0.1]:55613 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1L4cIo-0004vJ-WC for geh-help-gnu-emacs@m.gmane.org; Mon, 24 Nov 2008 09:20:39 -0500 Original-Path: news.stanford.edu!newsfeed.stanford.edu!postnews.google.com!v39g2000pro.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 86 Original-NNTP-Posting-Host: 24.6.185.159 Original-X-Trace: posting.google.com 1227532562 6074 127.0.0.1 (24 Nov 2008 13:16:02 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Mon, 24 Nov 2008 13:16:02 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: v39g2000pro.googlegroups.com; posting-host=24.6.185.159; posting-account=bRPKjQoAAACxZsR8_VPXCX27T2YcsyMA User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10_4_11; en) AppleWebKit/525.26.2 (KHTML, like Gecko) Version/3.2 Safari/525.26.12, gzip(gfe), gzip(gfe) Original-Xref: news.stanford.edu gnu.emacs.help:164720 X-Mailman-Approved-At: Mon, 24 Nov 2008 09:18:42 -0500 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:60051 Archived-At: On Nov 24, 1:24 am, Teemu Likonen wrote: > I like cua-selection-mode for its rectangle support. Still, there is a > serious annoyance to which I haven't found a solution. This affects > region behavior in transient-mark-mode which I also use. > > When I select a paragraph with M-h (mark-paragraph) and move the point > the region disappears if cua-mode is switched on. Without cua-mode I can > move the edges of the region and it stays visible. This is the only > reason why I don't keep cua-(selection-)mode on by default. Can I make > cua-mode to not make active region disappear? on my machine, with cua-mode on, arrow keys or any cursor moving commands don't deactivate the region. i did spend maybe 30 min answering this post... scratched several times on what i wrote about the var deactivate-mark and modern UI ... so i got curious... if i started emacs with -q and then it does. So, something's in my emacs init file did some magic... but i can't think of any... O, ok, i think i found it! ;; prevent cua-mode from going into selection mode when commands with Shift key is used. (add-hook 'cua-mode-hook (lambda () (put 'cua-scroll-down 'CUA nil) (put 'cua-scroll-up 'CUA nil) (put 'backward-paragraph 'CUA nil) (put 'forward-paragraph 'CUA nil) (put 'beginning-of-buffer 'CUA nil) (put 'end-of-buffer 'CUA nil) (put 'move-end-of-line 'CUA nil) ) ) from: =E2=80=A2 A Ergonomic Keyboard Shortcut Layout For Emacs http://xahlee.org/emacs/ergonomic_emacs_keybinding.html ... oh wait but the hook doesn't have any cursor moving commands... note that i also have (delete-selection-mode t) but i don't think this matters. (Note that delete-selection-mode automatically sets transient-mark- mode to t, however, cua mode does not actually call transient-mark- mode, but does emulate its behavior in its own implementation, and actually set transient-mark-mode to t for display purposes) OK, now i found it for sure. Basically, if you remap your cursor moving keys, then it won't deactivate selection. For example, do a text selection, then type M-x backward-word, you'll see that your region remains active. Since i have all my cursor moving shortcuts different from default, so they don't deactivate region for me. Perhaps cua mode is checking actual keypresses. Ok, i try this: set the cursor moving commands's property CUA to nil, like in the above hook. cua mode is quite complex with respect to elisp coding ... -------------- ... i didn't know what cua rectangle features do, and did read up. It is very nice. I wonder if it should be a separate package from cua. (for those don't want to bother looking up, just turn cua-mode on, then press Ctrl+Enter, then move arrow keys, then see that a real rectangular highlighting is done, implemented using overlay.) i've always been using kill-rectangle and string-rectangle for like 10 years. One thing i missed is how to actually copy and paste a column of text. Never did bother to read the proper manual... and i suppose now cua mode does it. Cua mode does support copying/pasting a column of text right? is it possible to do this with rectangle* commands? Xah =E2=88=91 http://xahlee.org/ =E2=98=84