diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2016-10-27 01:18:16 -0400 |
---|---|---|
committer | Ken Raeburn <raeburn@raeburn.org> | 2017-06-21 22:34:32 -0400 |
commit | 6af67b4a8842fd3b949fa5bfb68811f62a521ae2 (patch) | |
tree | 329ca3eab319f05102060c3f938d5b19c961d334 | |
parent | 0b3a0f30b288945e739f1ac7c2f9d8a2fdd352ac (diff) | |
download | emacs-6af67b4a8842fd3b949fa5bfb68811f62a521ae2.tar.gz |
Reduce lread substitutions.
* src/lread.c (read1): After reading an object using the "#n=" syntax,
if the read object is a cons cell, instead of recursively substituting
the placeholder with the new object, mutate the placeholder cons cell
itself to have the correct car and cdr values.
-rw-r--r-- | src/lread.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/lread.c b/src/lread.c index 263638651db..a6d04ec5af7 100644 --- a/src/lread.c +++ b/src/lread.c @@ -2990,12 +2990,21 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) tem = read0 (readcharfun); /* Now put it everywhere the placeholder was... */ - Fsubstitute_object_in_subtree (tem, placeholder); + if (CONSP (tem)) + { + Fsetcar (placeholder, XCAR (tem)); + Fsetcdr (placeholder, XCDR (tem)); + return placeholder; + } + else + { + Fsubstitute_object_in_subtree (tem, placeholder); - /* ...and #n# will use the real value from now on. */ - Fsetcdr (cell, tem); + /* ...and #n# will use the real value from now on. */ + Fsetcdr (cell, tem); - return tem; + return tem; + } } /* #n# returns a previously read object. */ |