From a8a7c5f651cd9c3d354a4cb4938e5289d4cbbe4b Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Mon, 3 Jun 2013 11:18:18 -0400 Subject: [PATCH] * src/eval.c (backtrace_p, backtrace_top, backtrace_next): Export them to .gdbinit. * src/data.c (pure_write_error): Add `object' argument. * src/puresize.h (CHECK_IMPURE): Use it. * src/keyboard.c (safe_run_hooks_error): Improve error message. --- src/ChangeLog | 10 ++++++++++ src/data.c | 5 +++-- src/eval.c | 10 ++++++---- src/keyboard.c | 2 +- src/puresize.h | 4 ++-- 5 files changed, 22 insertions(+), 9 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index fce07f9db1a..2b719b068ae 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,13 @@ +2013-06-03 Stefan Monnier + + * eval.c (backtrace_p, backtrace_top, backtrace_next): Export them to + .gdbinit. + + * keyboard.c (safe_run_hooks_error): Improve error message. + + * data.c (pure_write_error): Add `object' argument. + * puresize.h (CHECK_IMPURE): Use it. + 2013-06-03 Michael Albinus * Makefile.in (NOTIFY_OBJ): New variable. diff --git a/src/data.c b/src/data.c index b33d9656d57..fc66cea6497 100644 --- a/src/data.c +++ b/src/data.c @@ -100,9 +100,10 @@ wrong_type_argument (register Lisp_Object predicate, register Lisp_Object value) } void -pure_write_error (void) +pure_write_error (Lisp_Object obj) { - error ("Attempt to modify read-only object"); + Fsignal (Qerror, Fcons (build_string ("Attempt to modify read-only object"), + Fcons (obj, Qnil))); } void diff --git a/src/eval.c b/src/eval.c index fac71e34a22..d6236b6edf2 100644 --- a/src/eval.c +++ b/src/eval.c @@ -128,16 +128,18 @@ void set_backtrace_debug_on_exit (struct specbinding *pdl, bool doe) /* Helper functions to scan the backtrace. */ -LISP_INLINE bool backtrace_p (struct specbinding *pdl) +EXTERN_INLINE bool backtrace_p (struct specbinding *pdl) { return pdl >= specpdl; } -LISP_INLINE struct specbinding *backtrace_top (void) + +EXTERN_INLINE struct specbinding *backtrace_top (void) { struct specbinding *pdl = specpdl_ptr - 1; - while (backtrace_p (pdl) && pdl->kind != SPECPDL_BACKTRACE) \ + while (backtrace_p (pdl) && pdl->kind != SPECPDL_BACKTRACE) pdl--; return pdl; } -LISP_INLINE struct specbinding *backtrace_next (struct specbinding *pdl) + +EXTERN_INLINE struct specbinding *backtrace_next (struct specbinding *pdl) { pdl--; while (backtrace_p (pdl) && pdl->kind != SPECPDL_BACKTRACE) diff --git a/src/keyboard.c b/src/keyboard.c index a243b95470a..8dd109d252d 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -1882,7 +1882,7 @@ safe_run_hooks_error (Lisp_Object error_data) = CONSP (Vinhibit_quit) ? XCAR (Vinhibit_quit) : Vinhibit_quit; Lisp_Object fun = CONSP (Vinhibit_quit) ? XCDR (Vinhibit_quit) : Qnil; Lisp_Object args[4]; - args[0] = build_string ("Error in %s (%s): %S"); + args[0] = build_string ("Error in %s (%S): %S"); args[1] = hook; args[2] = fun; args[3] = error_data; diff --git a/src/puresize.h b/src/puresize.h index 2f717571c7c..25a11aafbcc 100644 --- a/src/puresize.h +++ b/src/puresize.h @@ -73,9 +73,9 @@ along with GNU Emacs. If not, see . */ /* Signal an error if OBJ is pure. */ #define CHECK_IMPURE(obj) \ { if (PURE_P (obj)) \ - pure_write_error (); } + pure_write_error (obj); } -extern _Noreturn void pure_write_error (void); +extern _Noreturn void pure_write_error (Lisp_Object); /* Define PURE_P. */ -- 2.39.2