From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: storm@cua.dk (Kim F. Storm) Newsgroups: gmane.emacs.devel Subject: Re: Shift selection using interactive spec Date: Fri, 14 Mar 2008 15:53:00 +0100 Message-ID: <87lk4lpdbn.fsf@kfs-lx.rd.rdm> 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 1205506430 22106 80.91.229.12 (14 Mar 2008 14:53:50 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 14 Mar 2008 14:53:50 +0000 (UTC) Cc: Dan Nicolaescu , emacs-devel@gnu.org To: Chong Yidong Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Mar 14 15:54:17 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 1JaBIQ-0006HB-Aw for ged-emacs-devel@m.gmane.org; Fri, 14 Mar 2008 15:54:10 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JaBHr-0005K7-3T for ged-emacs-devel@m.gmane.org; Fri, 14 Mar 2008 10:53:35 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JaBHT-000568-83 for emacs-devel@gnu.org; Fri, 14 Mar 2008 10:53:11 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JaBHS-000555-2b for emacs-devel@gnu.org; Fri, 14 Mar 2008 10:53:10 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JaBHR-00054r-U2 for emacs-devel@gnu.org; Fri, 14 Mar 2008 10:53:09 -0400 Original-Received: from mail-relay.sonofon.dk ([212.88.64.25]) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1JaBHR-0007c5-CO for emacs-devel@gnu.org; Fri, 14 Mar 2008 10:53:09 -0400 Original-Received: (qmail 97080 invoked from network); 14 Mar 2008 14:53:07 -0000 Original-Received: from unknown (HELO kfs-lx.rd.rdm.cua.dk) (213.83.150.21) by 0 with SMTP; 14 Mar 2008 14:53:07 -0000 In-Reply-To: <87abl11ilo.fsf@stupidchicken.com> (Chong Yidong's message of "Fri\, 14 Mar 2008 10\:32\:51 -0400") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1.92 (gnu/linux) 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:92566 Archived-At: Chong Yidong writes: > storm@cua.dk (Kim F. Storm) 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? Maybe not trivial commands, but I think a solution should not be limited to only trivial commands... > If these > are sufficiently rare, the command itself could simply be modified > directly. Then we need to make this_command_keys_shift_translated available to lisp. Maybe better would be to simply put the relevant code (below) into a DEFUN that could be called from such commands (and from Fcall_interactively of course). + else if (*string == '^') + { + Lisp_Object *key = XVECTOR (this_command_keys)->contents + + this_single_command_key_start; + Lisp_Object *key_max = XVECTOR (this_command_keys)->contents + + this_command_key_count; + Lisp_Object shift = intern ("shift"); + int shifted = this_command_keys_shift_translated; + + if (!shifted) + for (; key < key_max; ++key) + { + if (SYMBOLP (*key)) + shifted = !NILP (Fmemq (shift, + Fget (*key, Qevent_symbol_elements))); + if (!shifted) + break; + } + + if (shifted) + { + Lisp_Object push_mark_call[4] = { intern ("push-mark"), + Qnil, Qnil, Qt }; + if (!EQ (Vtransient_mark_mode, Qidentity)) + Ffuncall (4, push_mark_call); + if (EQ (Vtransient_mark_mode, Qidentity) + || NILP (Vtransient_mark_mode)) + Vtransient_mark_mode = Qonly; + } + + string++; + } > > Not that the @ and * interactive specs would also have problems with > interactive specs that are lisp forms. -- Kim F. Storm http://www.cua.dk