aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorStefan Monnier2017-02-23 21:06:54 -0500
committerStefan Monnier2017-02-23 21:06:54 -0500
commit407e650413c0296f5873a1399c2306b25f81f310 (patch)
tree7ef40c77b1a38cf127c07cf4662497b8170a658b /src
parentf6d2ba74f80b9a055a3d8072d49475aec45c2dbe (diff)
downloademacs-407e650413c0296f5873a1399c2306b25f81f310.tar.gz
emacs-407e650413c0296f5873a1399c2306b25f81f310.zip
* lisp/emacs-lisp/cl-print.el: New file
* lisp/emacs-lisp/nadvice.el (advice--where): New function. (advice--make-docstring): Use it. * src/print.c (print_number_index): Don't declare here any more. (Fprint_preprocess): New function. * test/lisp/emacs-lisp/cl-print-tests.el: New file.
Diffstat (limited to 'src')
-rw-r--r--src/print.c32
1 files changed, 22 insertions, 10 deletions
diff --git a/src/print.c b/src/print.c
index 8c4bb24555e..d8acf838749 100644
--- a/src/print.c
+++ b/src/print.c
@@ -640,7 +640,7 @@ is used instead. */)
640 return object; 640 return object;
641} 641}
642 642
643/* a buffer which is used to hold output being built by prin1-to-string */ 643/* A buffer which is used to hold output being built by prin1-to-string. */
644Lisp_Object Vprin1_to_string_buffer; 644Lisp_Object Vprin1_to_string_buffer;
645 645
646DEFUN ("prin1-to-string", Fprin1_to_string, Sprin1_to_string, 1, 2, 0, 646DEFUN ("prin1-to-string", Fprin1_to_string, Sprin1_to_string, 1, 2, 0,
@@ -1140,14 +1140,14 @@ print (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag)
1140 print_object (obj, printcharfun, escapeflag); 1140 print_object (obj, printcharfun, escapeflag);
1141} 1141}
1142 1142
1143#define PRINT_CIRCLE_CANDIDATE_P(obj) \ 1143#define PRINT_CIRCLE_CANDIDATE_P(obj) \
1144 (STRINGP (obj) || CONSP (obj) \ 1144 (STRINGP (obj) || CONSP (obj) \
1145 || (VECTORLIKEP (obj) \ 1145 || (VECTORLIKEP (obj) \
1146 && (VECTORP (obj) || COMPILEDP (obj) \ 1146 && (VECTORP (obj) || COMPILEDP (obj) \
1147 || CHAR_TABLE_P (obj) || SUB_CHAR_TABLE_P (obj) \ 1147 || CHAR_TABLE_P (obj) || SUB_CHAR_TABLE_P (obj) \
1148 || HASH_TABLE_P (obj) || FONTP (obj))) \ 1148 || HASH_TABLE_P (obj) || FONTP (obj))) \
1149 || (! NILP (Vprint_gensym) \ 1149 || (! NILP (Vprint_gensym) \
1150 && SYMBOLP (obj) \ 1150 && SYMBOLP (obj) \
1151 && !SYMBOL_INTERNED_P (obj))) 1151 && !SYMBOL_INTERNED_P (obj)))
1152 1152
1153/* Construct Vprint_number_table according to the structure of OBJ. 1153/* Construct Vprint_number_table according to the structure of OBJ.
@@ -1260,6 +1260,16 @@ print_preprocess (Lisp_Object obj)
1260 print_depth--; 1260 print_depth--;
1261} 1261}
1262 1262
1263DEFUN ("print--preprocess", Fprint_preprocess, Sprint_preprocess, 1, 1, 0,
1264 doc: /* Extract sharing info from OBJECT needed to print it.
1265Fills `print-number-table'. */)
1266 (Lisp_Object object)
1267{
1268 print_number_index = 0;
1269 print_preprocess (object);
1270 return Qnil;
1271}
1272
1263static void 1273static void
1264print_preprocess_string (INTERVAL interval, Lisp_Object arg) 1274print_preprocess_string (INTERVAL interval, Lisp_Object arg)
1265{ 1275{
@@ -1537,7 +1547,8 @@ print_object (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag)
1537 1547
1538 size_byte = SBYTES (name); 1548 size_byte = SBYTES (name);
1539 1549
1540 if (! NILP (Vprint_gensym) && !SYMBOL_INTERNED_P (obj)) 1550 if (! NILP (Vprint_gensym)
1551 && !SYMBOL_INTERNED_IN_INITIAL_OBARRAY_P (obj))
1541 print_c_string ("#:", printcharfun); 1552 print_c_string ("#:", printcharfun);
1542 else if (size_byte == 0) 1553 else if (size_byte == 0)
1543 { 1554 {
@@ -2344,6 +2355,7 @@ priorities. */);
2344 defsubr (&Sterpri); 2355 defsubr (&Sterpri);
2345 defsubr (&Swrite_char); 2356 defsubr (&Swrite_char);
2346 defsubr (&Sredirect_debugging_output); 2357 defsubr (&Sredirect_debugging_output);
2358 defsubr (&Sprint_preprocess);
2347 2359
2348 DEFSYM (Qprint_escape_newlines, "print-escape-newlines"); 2360 DEFSYM (Qprint_escape_newlines, "print-escape-newlines");
2349 DEFSYM (Qprint_escape_multibyte, "print-escape-multibyte"); 2361 DEFSYM (Qprint_escape_multibyte, "print-escape-multibyte");