diff src/print.c @ 5677:febc025c4e0c

Adopt GNU's ## syntax for the interned symbol with name "". src/ChangeLog addition: 2012-08-06 Aidan Kehoe <kehoea@parhasard.net> * lread.c (read1): * print.c (print_symbol): Adopt GNU's ## syntax for the interned symbol with the zero-length name. man/ChangeLog addition: 2012-08-06 Aidan Kehoe <kehoea@parhasard.net> * lispref/symbols.texi (Symbol Components): Document the new syntax of ## for the symbol with name "" interned in obarray.
author Aidan Kehoe <kehoea@parhasard.net>
date Mon, 06 Aug 2012 13:07:55 +0100
parents 56144c8593a8
children cd4f5f1f1f4c
line wrap: on
line diff
--- a/src/print.c	Sat Aug 04 23:26:26 2012 +0900
+++ b/src/print.c	Mon Aug 06 13:07:55 2012 +0100
@@ -2375,8 +2375,6 @@
 print_symbol (Lisp_Object obj, Lisp_Object printcharfun, int escapeflag)
 {
   /* This function can GC */
-  /* #### Bug!! (intern "") isn't printed in some distinguished way */
-  /* ####  (the reader also loses on it) */
   Lisp_Object name = symbol_name (XSYMBOL (obj));
   Bytecount size = XSTRING_LENGTH (name);
   struct gcpro gcpro1, gcpro2;
@@ -2390,12 +2388,15 @@
 
   GCPRO2 (obj, printcharfun);
 
-  if (print_gensym)
+  if (print_gensym && !IN_OBARRAY (obj))
     {
-      if (!IN_OBARRAY (obj))
-        {
-          write_ascstring (printcharfun, "#:");
-        }
+      write_ascstring (printcharfun, "#:");
+    }
+  else if (0 == size)
+    {
+      /* Compatible with GNU, but not with Common Lisp, where the syntax for
+         this symbol is ||. */
+      write_ascstring (printcharfun, "##");
     }
 
   /* Does it look like an integer or a float? */