aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGemini Lasswell2017-02-16 22:08:03 -0800
committerNoam Postavsky2017-02-23 20:21:11 -0500
commit8b912ab47bc91f54565f127abf24c97e5d46a1ba (patch)
tree107d90118764ae7df4fe0957bb01846ad1a5c858 /src
parentba6c382404a9fe598be72e64beb21a90161ebb91 (diff)
downloademacs-8b912ab47bc91f54565f127abf24c97e5d46a1ba.tar.gz
emacs-8b912ab47bc91f54565f127abf24c97e5d46a1ba.zip
Support read syntax for circular objects in Edebug (Bug#23660)
* lisp/emacs-lisp/edebug.el (edebug-read-special): New name for edebug-read-function. Handle the read syntax for circular objects. (edebug-read-objects): New variable. (edebug-read-and-maybe-wrap-form1): Reset edebug-read-objects. * src/lread.c (Fsubstitute_object_in_subtree): Make substitute_object_in_subtree into a Lisp primitive.
Diffstat (limited to 'src')
-rw-r--r--src/lread.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/lread.c b/src/lread.c
index 094aa628eec..1b154b7326e 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -558,8 +558,6 @@ static Lisp_Object read_vector (Lisp_Object, bool);
558 558
559static Lisp_Object substitute_object_recurse (Lisp_Object, Lisp_Object, 559static Lisp_Object substitute_object_recurse (Lisp_Object, Lisp_Object,
560 Lisp_Object); 560 Lisp_Object);
561static void substitute_object_in_subtree (Lisp_Object,
562 Lisp_Object);
563static void substitute_in_interval (INTERVAL, Lisp_Object); 561static void substitute_in_interval (INTERVAL, Lisp_Object);
564 562
565 563
@@ -2957,7 +2955,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list)
2957 tem = read0 (readcharfun); 2955 tem = read0 (readcharfun);
2958 2956
2959 /* Now put it everywhere the placeholder was... */ 2957 /* Now put it everywhere the placeholder was... */
2960 substitute_object_in_subtree (tem, placeholder); 2958 Fsubstitute_object_in_subtree (tem, placeholder);
2961 2959
2962 /* ...and #n# will use the real value from now on. */ 2960 /* ...and #n# will use the real value from now on. */
2963 Fsetcdr (cell, tem); 2961 Fsetcdr (cell, tem);
@@ -3326,8 +3324,10 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list)
3326/* List of nodes we've seen during substitute_object_in_subtree. */ 3324/* List of nodes we've seen during substitute_object_in_subtree. */
3327static Lisp_Object seen_list; 3325static Lisp_Object seen_list;
3328 3326
3329static void 3327DEFUN ("substitute-object-in-subtree", Fsubstitute_object_in_subtree,
3330substitute_object_in_subtree (Lisp_Object object, Lisp_Object placeholder) 3328 Ssubstitute_object_in_subtree, 2, 2, 0,
3329 doc: /* Replace every reference to PLACEHOLDER in OBJECT with OBJECT. */)
3330 (Lisp_Object object, Lisp_Object placeholder)
3331{ 3331{
3332 Lisp_Object check_object; 3332 Lisp_Object check_object;
3333 3333
@@ -3345,6 +3345,7 @@ substitute_object_in_subtree (Lisp_Object object, Lisp_Object placeholder)
3345 original. */ 3345 original. */
3346 if (!EQ (check_object, object)) 3346 if (!EQ (check_object, object))
3347 error ("Unexpected mutation error in reader"); 3347 error ("Unexpected mutation error in reader");
3348 return Qnil;
3348} 3349}
3349 3350
3350/* Feval doesn't get called from here, so no gc protection is needed. */ 3351/* Feval doesn't get called from here, so no gc protection is needed. */
@@ -4548,6 +4549,7 @@ syms_of_lread (void)
4548{ 4549{
4549 defsubr (&Sread); 4550 defsubr (&Sread);
4550 defsubr (&Sread_from_string); 4551 defsubr (&Sread_from_string);
4552 defsubr (&Ssubstitute_object_in_subtree);
4551 defsubr (&Sintern); 4553 defsubr (&Sintern);
4552 defsubr (&Sintern_soft); 4554 defsubr (&Sintern_soft);
4553 defsubr (&Sunintern); 4555 defsubr (&Sunintern);