/* 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.
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;
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\
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;
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\
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 ();
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. */
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\
|| 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;
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'.");