changeset 93542:5dd7fdf8c27e

(Vshift_select_mode): New var. (Finteractive): Document new ^ spec. (Fcall_interactively): Call handle-shift-selection if the ^ spec is present.
author Chong Yidong <cyd@stupidchicken.com>
date Wed, 02 Apr 2008 20:14:40 +0000
parents f924a28b09bd
children ae83caf43667
files src/callint.c
diffstat 1 files changed, 35 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/callint.c	Wed Apr 02 20:14:17 2008 +0000
+++ b/src/callint.c	Wed Apr 02 20:14:40 2008 +0000
@@ -51,6 +51,8 @@
    even if mark_active is 0.  */
 Lisp_Object Vmark_even_if_inactive;
 
+Lisp_Object Vshift_select_mode, Qhandle_shift_selection;
+
 Lisp_Object Vmouse_leave_buffer_hook, Qmouse_leave_buffer_hook;
 
 Lisp_Object Qlist, Qlet, Qletx, Qsave_excursion, Qprogn, Qif, Qwhen;
@@ -115,14 +117,16 @@
 X -- Lisp expression read and evaluated.
 z -- Coding system.
 Z -- Coding system, nil if no prefix arg.
-In addition, if the string begins with `*'
- then an error is signaled if the buffer is read-only.
- This happens before reading any arguments.
-If the string begins with `@', then Emacs searches the key sequence
- which invoked the command for its first mouse click (or any other
- event which specifies a window), and selects that window before
- reading any arguments.  You may use both `@' and `*'; they are
- processed in the order that they appear.
+
+In addition, if the string begins with `*', an error is signaled if
+  the buffer is read-only.
+If the string begins with `@', Emacs searches the key sequence which
+ invoked the command for its first mouse click (or any other event
+ which specifies a window).
+If the string begins with `^' and `shift-select-mode' is non-nil,
+ Emacs first calls the function `handle-shift-select'.
+You may use `@', `*', and `^' together.  They are processed in the
+ order that they appear, before reading any arguments.
 usage: (interactive ARGS)  */)
      (args)
      Lisp_Object args;
@@ -447,6 +451,12 @@
 	    }
 	  string++;
 	}
+      else if (*string == '^')
+	{
+	  if (! NILP (Vshift_select_mode))
+	    call0 (Qhandle_shift_selection);
+	  string++;
+	}
       else break;
     }
 
@@ -905,6 +915,9 @@
   Qplus = intern ("+");
   staticpro (&Qplus);
 
+  Qhandle_shift_selection = intern ("handle-shift-selection");
+  staticpro (&Qhandle_shift_selection);
+
   Qcall_interactively = intern ("call-interactively");
   staticpro (&Qcall_interactively);
 
@@ -962,6 +975,20 @@
 behave as if the mark were still active.  */);
   Vmark_even_if_inactive = Qt;
 
+  DEFVAR_LISP ("shift-select-mode", &Vshift_select_mode,
+	       doc: /* When non-nil, shifted motion keys activate the mark momentarily.
+
+While the mark is activated in this way, any shift-translated point
+motion key extends the region, and if Transient Mark mode was off, it
+is temporarily turned on.  Furthermore, the mark will be deactivated
+by any subsequent point motion key that was not shift-translated, or
+by any action that normally deactivates the mark in Transient Mark
+mode.
+
+See `this-command-keys-shift-translated' for the meaning of
+shift-translation.  */);
+  Vshift_select_mode = Qt;
+
   DEFVAR_LISP ("mouse-leave-buffer-hook", &Vmouse_leave_buffer_hook,
 	       doc: /* Hook to run when about to switch windows with a mouse command.
 Its purpose is to give temporary modes such as Isearch mode