]> git.eshelyaron.com Git - emacs.git/commitdiff
(Vmouse_leave_buffer_hook, Qmouse_leave_buffer_hook): New variables.
authorRichard M. Stallman <rms@gnu.org>
Wed, 28 Dec 1994 23:28:10 +0000 (23:28 +0000)
committerRichard M. Stallman <rms@gnu.org>
Wed, 28 Dec 1994 23:28:10 +0000 (23:28 +0000)
(syms_of_callint): Set them up.
(Fcall_interactively): Run the hook, for `@'.

src/callint.c

index b2efb64f6eda7225db34af5b0a527c9185f59a5e..d8e48752b7665b6c8313510773de4be321604756 100644 (file)
@@ -39,6 +39,8 @@ Lisp_Object Qenable_recursive_minibuffers;
    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 @@ Otherwise, this is done only if an arg is read using the minibuffer.")
              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 @@ syms_of_callint ()
   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 @@ turns off region highlighting, but commands that use the mark\n\
 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);