emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Shift selection using interactive spec


From: Kim F. Storm
Subject: Re: Shift selection using interactive spec
Date: Fri, 14 Mar 2008 15:53:00 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1.92 (gnu/linux)

Chong Yidong <address@hidden> writes:

> address@hidden (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 <address@hidden> http://www.cua.dk





reply via email to

[Prev in Thread] Current Thread [Next in Thread]