From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Re: Shift-movement selection Date: Tue, 11 Mar 2008 22:42:32 +0000 Message-ID: <20080311224232.GB4420@muc.de> References: <871w6ounk0.fsf@kfs-lx.rd.rdm> <87ablacdxt.fsf@catnip.gol.com> <87skyzzeng.fsf@catnip.gol.com> <87fxuyobxt.fsf@kfs-lx.rd.rdm> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1205274541 6559 80.91.229.12 (11 Mar 2008 22:29:01 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 11 Mar 2008 22:29:01 +0000 (UTC) Cc: rms@gnu.org, cyd@stupidchicken.com, emacs-devel@gnu.org, juri@jurta.org, Stefan Monnier , Miles Bader To: "Kim F. Storm" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Mar 11 23:29:26 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JZCy3-0006bo-05 for ged-emacs-devel@m.gmane.org; Tue, 11 Mar 2008 23:29:07 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JZCxU-0001bv-Je for ged-emacs-devel@m.gmane.org; Tue, 11 Mar 2008 18:28:32 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JZCxQ-0001bR-RL for emacs-devel@gnu.org; Tue, 11 Mar 2008 18:28:28 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JZCxQ-0001b3-9L for emacs-devel@gnu.org; Tue, 11 Mar 2008 18:28:28 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JZCxQ-0001b0-31 for emacs-devel@gnu.org; Tue, 11 Mar 2008 18:28:28 -0400 Original-Received: from colin.muc.de ([193.149.48.1] helo=mail.muc.de) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1JZCxP-0006kU-EW for emacs-devel@gnu.org; Tue, 11 Mar 2008 18:28:27 -0400 Original-Received: (qmail 8969 invoked by uid 3782); 11 Mar 2008 22:28:22 -0000 Original-Received: from acm.muc.de (p57AF4A75.dip.t-dialin.net [87.175.74.117]) by colin2.muc.de (tmda-ofmipd) with ESMTP; Tue, 11 Mar 2008 23:28:20 +0100 Original-Received: (qmail 4793 invoked by uid 1000); 11 Mar 2008 22:42:32 -0000 Content-Disposition: inline In-Reply-To: <87fxuyobxt.fsf@kfs-lx.rd.rdm> User-Agent: Mutt/1.5.9i X-Delivery-Agent: TMDA/1.1.5 (Fettercairn) X-Primary-Address: acm@muc.de X-detected-kernel: by monty-python.gnu.org: FreeBSD 4.6-4.9 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:92211 Archived-At: Hi, Kim! On Mon, Mar 10, 2008 at 04:06:54PM +0100, Kim F. Storm wrote: > Stefan Monnier writes: > >>>> So to make it work "correctly", you need to modify all commands in > >>>> emacs! [yikes!] > >>> Most commands already deactivate the mark. So which ones would be left? > >> Anything that doesn't modify the buffer -- e.g. all movement commands. > > Supposedly these will be changed to use the new function, so they will > > explicitly deactivate the mark if the mark was activated with shift and > > the movement is then performed without the shift. > One problem is that basic movement commands are in C, not in Lisp. Why not introduce an after-move-hook, somewhat akin to after-change-hook? Possibly as a normal hook, possibly one where each function takes a single parameter, the old value of point. > Another problem may be advise on functions - the "shift" handling > may then be performed too late. > Personally, I like my proposal of just setting a "shift" property > on the relevant commands, and do it by running a shifted-key-hook > in the command loop. Assuming Emacs knows whether the shift key is currently depressed (it does, doesn't it, by looking at the key sequence?) the after-move-hook could be ideal place to deal with "shift"-movement actions. > That method has proven to work excellent with CUA mode! > For one thing, it is trivial for a user to add shift-region support > for new movement commands in an external package - without modifying > the code of that package. > -- > Kim F. Storm http://www.cua.dk -- Alan Mackenzie (Nuremberg, Germany).