changeset 10279:89cf458ed188

(Vmouse_leave_buffer_hook, Qmouse_leave_buffer_hook): New variables. (syms_of_callint): Set them up. (Fcall_interactively): Run the hook, for `@'.
author Richard M. Stallman <rms@gnu.org>
date Wed, 28 Dec 1994 23:28:10 +0000
parents 2b4365800d04
children ba09e85fa992
files src/callint.c
diffstat 1 files changed, 16 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/callint.c	Wed Dec 28 18:00:52 1994 +0000
+++ b/src/callint.c	Wed Dec 28 23:28:10 1994 +0000
@@ -39,6 +39,8 @@
    even if mark_active is 0.  */
 Lisp_Object Vmark_even_if_inactive;
 
+Lisp_Object Vmouse_leave_buffer_hook, Qmouse_leave_buffer_hook;
+
 Lisp_Object Qlist;
 Lisp_Object preserved_fns;
 
@@ -336,6 +338,11 @@
 	      if (MINI_WINDOW_P (XWINDOW (event))
 		  && ! (minibuf_level > 0 && EQ (event, minibuf_window)))
 		error ("Attempt to select inactive minibuffer window");
+
+	      /* If the current buffer wants to clean up, let it.  */
+	      if (!NILP (Vmouse_leave_buffer_hook))
+		call1 (Vrun_hooks, Qmouse_leave_buffer_hook);
+
 	      Fselect_window (event);
 	    }
 	  string++;
@@ -639,6 +646,9 @@
   Qenable_recursive_minibuffers = intern ("enable-recursive-minibuffers");
   staticpro (&Qenable_recursive_minibuffers);
 
+  Qmouse_leave_buffer_hook = intern ("mouse-leave-buffer-hook");
+  staticpro (&Qmouse_leave_buffer_hook);
+
   DEFVAR_LISP ("prefix-arg", &Vprefix_arg,
     "The value of the prefix argument for the next editing command.\n\
 It may be a number, or the symbol `-' for just a minus sign as arg,\n\
@@ -678,6 +688,12 @@
 behave as if the mark were still active.");
   Vmark_even_if_inactive = Qnil;
 
+  DEFVAR_LISP ("mouse-leave-buffer-hook", &Vmouse_leave_buffer_hook,
+    "Hook to run when about to switch windows with a mouse command.\n\
+Its purpose is to give temporary modes such as Isearch mode\n\
+a way to turn themselves off when a mouse command switches windows.");
+  Vmouse_leave_buffer_hook = Qnil;
+
   defsubr (&Sinteractive);
   defsubr (&Scall_interactively);
   defsubr (&Sprefix_numeric_value);