]> code.delx.au - gnu-emacs/blobdiff - src/eval.c
(syms_of_eval) <debug-on-error>: DOc fix.
[gnu-emacs] / src / eval.c
index f42ebc6979bd9f47757df4c971c136ae2e5e8be2..7ba6c3cdcde4eac7841c94b65402221d9568031f 100644 (file)
@@ -1,5 +1,5 @@
 /* Evaluator for GNU Emacs Lisp interpreter.
-   Copyright (C) 1985, 86, 87, 93, 94, 95, 99, 2000
+   Copyright (C) 1985, 86, 87, 93, 94, 95, 99, 2000, 2001
      Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -241,8 +241,8 @@ call_debugger (arg)
     max_specpdl_size = specpdl_size + 40;
   
 #ifdef HAVE_X_WINDOWS
-  if (display_busy_cursor_p)
-    cancel_busy_cursor ();
+  if (display_hourglass_p)
+    cancel_hourglass ();
 #endif
 
   debug_on_next_call = 0;
@@ -551,6 +551,7 @@ In byte compilation, `function' causes its argument to be compiled.\n\
   return Fcar (args);
 }
 
+
 DEFUN ("interactive-p", Finteractive_p, Sinteractive_p, 0, 0, 0,
   "Return t if function in which this appears was called interactively.\n\
 This means that the function was called with call-interactively (which\n\
@@ -558,16 +559,33 @@ includes being called as the binding of a key)\n\
 and input is currently coming from the keyboard (not in keyboard macro).")
   ()
 {
-  register struct backtrace *btp;
-  register Lisp_Object fun;
+  return interactive_p (1) ? Qt : Qnil;
+}
+
+
+/*  Return 1 if function in which this appears was called
+    interactively.  This means that the function was called with
+    call-interactively (which includes being called as the binding of
+    a key) and input is currently coming from the keyboard (not in
+    keyboard macro).
+
+    EXCLUDE_SUBRS_P non-zero means always return 0 if the function
+    called is a built-in.  */
+
+int
+interactive_p (exclude_subrs_p)
+     int exclude_subrs_p;
+{
+  struct backtrace *btp;
+  Lisp_Object fun;
 
   if (!INTERACTIVE)
-    return Qnil;
+    return 0;
 
   btp = backtrace_list;
 
   /* If this isn't a byte-compiled function, there may be a frame at
-     the top for Finteractive_p itself.  If so, skip it.  */
+     the top for Finteractive_p.  If so, skip it.  */
   fun = Findirect_function (*btp->function);
   if (SUBRP (fun) && XSUBR (fun) == &Sinteractive_p)
     btp = btp->next;
@@ -591,15 +609,17 @@ and input is currently coming from the keyboard (not in keyboard macro).")
      Fbytecode at the top.  If this frame is for a built-in function
      (such as load or eval-region) return nil.  */
   fun = Findirect_function (*btp->function);
-  if (SUBRP (fun))
-    return Qnil;
+  if (exclude_subrs_p && SUBRP (fun))
+    return 0;
+  
   /* btp points to the frame of a Lisp function that called interactive-p.
      Return t if that function was called interactively.  */
   if (btp && btp->next && EQ (*btp->next->function, Qcall_interactively))
-    return Qt;
-  return Qnil;
+    return 1;
+  return 0;
 }
 
+
 DEFUN ("defun", Fdefun, Sdefun, 2, UNEVALLED, 0,
   "Define NAME as a function.\n\
 The definition is (lambda ARGLIST [DOCSTRING] BODY...).\n\
@@ -1346,10 +1366,10 @@ See also the function `condition-case'.")
   Lisp_Object debugger_value;
   Lisp_Object string;
   Lisp_Object real_error_symbol;
-  extern int display_busy_cursor_p;
+  extern int display_hourglass_p;
   struct backtrace *bp;
 
-  immediate_quit = 0;
+  immediate_quit = handling_signal = 0;
   if (gc_in_progress || waiting_for_input)
     abort ();
 
@@ -1361,8 +1381,8 @@ See also the function `condition-case'.")
     real_error_symbol = error_symbol;
 
 #ifdef HAVE_X_WINDOWS
-  if (display_busy_cursor_p)
-    cancel_busy_cursor ();
+  if (display_hourglass_p)
+    cancel_hourglass ();
 #endif
 
   /* This hook is used by edebug.  */
@@ -2140,7 +2160,7 @@ Thus, (apply '+ 1 2 '(3 4)) returns 10.")
 
 enum run_hooks_condition {to_completion, until_success, until_failure};
 
-DEFUN ("run-hooks", Frun_hooks, Srun_hooks, 1, MANY, 0,
+DEFUN ("run-hooks", Frun_hooks, Srun_hooks, 0, MANY, 0,
   "Run each hook in HOOKS.  Major mode functions use this.\n\
 Each argument should be a symbol, a hook variable.\n\
 These symbols are processed in the order specified.\n\
@@ -2899,16 +2919,31 @@ specbind (symbol, value)
          || BUFFER_OBJFWDP (XSYMBOL (symbol)->value))
        {
          Lisp_Object current_buffer, binding_buffer;
+         
          /* For a local variable, record both the symbol and which
             buffer's value we are saving.  */
          current_buffer = Fcurrent_buffer ();
          binding_buffer = current_buffer;
+         
          /* If the variable is not local in this buffer,
             we are saving the global value, so restore that.  */
          if (NILP (Flocal_variable_p (symbol, binding_buffer)))
            binding_buffer = Qnil;
          specpdl_ptr->symbol
            = Fcons (symbol, Fcons (binding_buffer, current_buffer));
+
+         /* If SYMBOL is a per-buffer variable which doesn't have a
+            buffer-local value here, make the `let' change the global
+            value by changing the value of SYMBOL in all buffers not
+            having their own value.  This is consistent with what
+            happens with other buffer-local variables.  */
+         if (NILP (binding_buffer)
+             && BUFFER_OBJFWDP (XSYMBOL (symbol)->value))
+           {
+             ++specpdl_ptr;
+             Fset_default (symbol, value);
+             return;
+           }
        }
       else
        specpdl_ptr->symbol = symbol;
@@ -3220,7 +3255,8 @@ if one of its condition symbols appears in the list.");
 
   DEFVAR_LISP ("debug-on-error", &Vdebug_on_error,
     "*Non-nil means enter debugger if an error is signaled.\n\
-Does not apply to errors handled by `condition-case'.\n\
+Does not apply to errors handled by `condition-case' or those\n\
+matched by `debug-ignored-errors'.\n\
 If the value is a list, an error only means to enter the debugger\n\
 if one of its condition symbols appears in the list.\n\
 See also variable `debug-on-quit'.");