From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chong Yidong Newsgroups: gmane.emacs.devel Subject: Re: Shift selection using interactive spec Date: Tue, 18 Mar 2008 14:28:46 -0400 Message-ID: <87skynrin5.fsf@stupidchicken.com> References: <87k5k69p92.fsf@stupidchicken.com> <200803140408.m2E47hPU014494@sallyv1.ics.uci.edu> <87prtxpekk.fsf@kfs-lx.rd.rdm> <87abl11ilo.fsf@stupidchicken.com> <874pb9koyw.fsf@stupidchicken.com> <87od9gzqv9.fsf@stupidchicken.com> <87bq5gytbi.fsf@stupidchicken.com> <8763vndi0r.fsf@kfs-lx.rd.rdm> <87hcf6ratt.fsf@stupidchicken.com> <878x0if9ul.fsf@stupidchicken.com> <87od9e9gnx.fsf@stupidchicken.com> <87skyo5bvk.fsf@stupidchicken.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1205865117 985 80.91.229.12 (18 Mar 2008 18:31:57 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 18 Mar 2008 18:31:57 +0000 (UTC) Cc: Dan Nicolaescu , emacs-devel@gnu.org, "Kim F. Storm" To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Mar 18 19:32:25 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 1Jbgba-0003WA-1u for ged-emacs-devel@m.gmane.org; Tue, 18 Mar 2008 19:32:10 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Jbgb0-0005ac-3q for ged-emacs-devel@m.gmane.org; Tue, 18 Mar 2008 14:31:34 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Jbgaw-0005aX-7P for emacs-devel@gnu.org; Tue, 18 Mar 2008 14:31:30 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Jbgau-0005aK-Ov for emacs-devel@gnu.org; Tue, 18 Mar 2008 14:31:29 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Jbgau-0005aH-If for emacs-devel@gnu.org; Tue, 18 Mar 2008 14:31:28 -0400 Original-Received: from cyd.mit.edu ([18.115.2.24]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Jbgau-0002cU-Ap for emacs-devel@gnu.org; Tue, 18 Mar 2008 14:31:28 -0400 Original-Received: by cyd.mit.edu (Postfix, from userid 1000) id 56E574E3B9; Tue, 18 Mar 2008 14:28:46 -0400 (EDT) In-Reply-To: (Stefan Monnier's message of "Tue\, 18 Mar 2008 12\:39\:16 -0400") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1.92 (gnu/linux) X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) 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:92914 Archived-At: Stefan Monnier writes: >> After playing around with an implementation of this, I feel that it is >> very problematic. > >> The trouble with using handle-shift-selection to explicitly >> unhighlight the region is that every single motion command needs to >> call handle-shift-selection, by adding the ^ interactive spec. For >> every motion comman (or command that moves point in addition to >> something else), there will be a bug: the shift-selected region won't >> be highlighted. This therefore breaks backward compatibility with all >> external packages that define their own motion commands. > > I do not understand what you mean. Could you give a sample case? Suppose we have an external package that defines the motion commands forward-section and backward-section, which move point forward and backward by mode-specific amount. (It might, for example, be rebound to M-right or M-left.) In shift selection mode, the first unshifted motion command must deactivate the mark. This is the expected behavior. Now suppose we make the motion commands responsible for deactivating the mark; for example, by adding an interactive spec code that calls a function `handle-shift-selection' that checks if the calling key sequence was shifted, and deactivates the mark if it was not. If we start to define a shift-selected region using a shifted forward-char command, and follow this with an unshifted forward-section command, the region won't get deactivated. Instead, it will extend the region. To fix this bug, we would have to change the external package. In contrast, it seems to me that there is only a small number of commands for which we *don't* want to deactivate a shift selection, e.g. switching windows. These commands are mostly built into Emacs, and could be easily modified to DTRT. That would fix the perceived fragility of `only' TMM.