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: Fri, 14 Mar 2008 16:52:39 -0400 Message-ID: <874pb9koyw.fsf@stupidchicken.com> References: <87k5k69p92.fsf@stupidchicken.com> <200803140408.m2E47hPU014494@sallyv1.ics.uci.edu> <87prtxpekk.fsf@kfs-lx.rd.rdm> <87abl11ilo.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 1205528123 6289 80.91.229.12 (14 Mar 2008 20:55:23 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 14 Mar 2008 20:55:23 +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 Fri Mar 14 21:55:51 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 1JaGwQ-0004rc-GU for ged-emacs-devel@m.gmane.org; Fri, 14 Mar 2008 21:55:50 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JaGvr-0001Ag-4B for ged-emacs-devel@m.gmane.org; Fri, 14 Mar 2008 16:55:15 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JaGvn-0001AI-M7 for emacs-devel@gnu.org; Fri, 14 Mar 2008 16:55:11 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JaGvm-0001A4-Lx for emacs-devel@gnu.org; Fri, 14 Mar 2008 16:55:10 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JaGvm-0001A1-Gs for emacs-devel@gnu.org; Fri, 14 Mar 2008 16:55:10 -0400 Original-Received: from cyd.mit.edu ([18.115.2.24]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JaGvm-0007T7-C4 for emacs-devel@gnu.org; Fri, 14 Mar 2008 16:55:10 -0400 Original-Received: by cyd.mit.edu (Postfix, from userid 1000) id ABD704E3B9; Fri, 14 Mar 2008 16:52:39 -0400 (EDT) In-Reply-To: (Stefan Monnier's message of "Fri\, 14 Mar 2008 11\:54\:34 -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:92615 Archived-At: Stefan Monnier writes: >>> What if a movement command uses a lisp form rather than a string as >>> interactive spec? >>> >>> Then, how do you do the equivalent of '^' in that case? > >> Is there any movement command that uses a lisp form spec? If these >> are sufficiently rare, the command itself could simply be modified >> directly. > >> Not that the @ and * interactive specs would also have problems with >> interactive specs that are lisp forms. > > *Any* letter in `interactive' should have a simple Elisp equivalent. > I suggest you write the code directly in an elisp function to start > with, and then call that function from callint.c. The way I see it, there are a few ways we can go with this. 1. Add a new code LETTER for interactive specs, e.g. t This provides an argument that is t if the command was called by shift translation. In other words, read_key_sequence couldn't find a keybinding for the entered key sequence, so it tried removing the shift modifier and found the binding to this command. Then we modify the motion commands to accept the additional argument, e.g.: (forward-char &optional N) -> (forward-char &optional N shift-select) The body of each motion command is then changed to DTRT with the new argument. With this approach, there is the least amount of magic going on, but adding an argument to all motion commands may cause disruption and incompatibilities. How much disruption remains unclear to me. 1a. As above, but make the letter activate so long as the keybinding contains a shift (i.e. even if the command was found with a direct keybinding.) 2. Don't bother with interactive spec. Provide a built-in function that says whether a command has been run using shift translation. Call it, e.g., this-single-command-keys-shift-translated Directly modify the body of each motion command to call this-single-command-keys-shift-translated and DTRT. 2a. As above, but also for direct keybindings with the shift modifier. (This is the idea that Stefan has been pushing.) 3. Use a non-letter interactive code, analogous to @ and *, that causes Fcall_interactively to perform the handling of transient-mark-mode automagically. This was the code I showed. Because it's a non-letter code, we don't need to change the argument list. This approach needs the least new code, and might be less disruptive, but it's obviously a little magical. 3a. As above, but also for direct keybindings with the shift modifier.