# HG changeset patch # User Aidan Kehoe # Date 1344254875 -3600 # Node ID febc025c4e0c6f95a8adc7995a072205e56cdf07 # Parent dede3f658f8e3c3299aaf47157a0569abc28e231 Adopt GNU's ## syntax for the interned symbol with name "". src/ChangeLog addition: 2012-08-06 Aidan Kehoe * 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 * lispref/symbols.texi (Symbol Components): Document the new syntax of ## for the symbol with name "" interned in obarray. diff -r dede3f658f8e -r febc025c4e0c man/ChangeLog --- a/man/ChangeLog Sat Aug 04 23:26:26 2012 +0900 +++ b/man/ChangeLog Mon Aug 06 13:07:55 2012 +0100 @@ -1,3 +1,9 @@ +2012-08-06 Aidan Kehoe + + * lispref/symbols.texi (Symbol Components): + Document the new syntax of ## for the symbol with name "" interned + in obarray. + 2012-08-02 Stephen J. Turnbull * XEmacs 21.5.32 "habanero" is released. diff -r dede3f658f8e -r febc025c4e0c man/lispref/symbols.texi --- a/man/lispref/symbols.texi Sat Aug 04 23:26:26 2012 +0900 +++ b/man/lispref/symbols.texi Mon Aug 06 13:07:55 2012 +0100 @@ -73,9 +73,15 @@ Since symbols are represented textually by their names, it is important not to have two symbols with the same name. The Lisp reader ensures this: every time it reads a symbol, it looks for an existing symbol with -the specified name before it creates a new one. (In XEmacs Lisp, -this lookup uses a hashing algorithm and an obarray; see @ref{Creating -Symbols}.) +the specified name before it creates a new one. In XEmacs Lisp, +this lookup uses an hashing algorithm and an obarray; see @ref{Creating +Symbols}. In Emacs Lisp, the symbol with the zero-length name has the +special print syntax @code{##}: + +@example +(intern "") + @result{} ## +@end example In normal usage, the function cell usually contains a function or macro, as that is what the Lisp interpreter expects to see there diff -r dede3f658f8e -r febc025c4e0c src/ChangeLog --- a/src/ChangeLog Sat Aug 04 23:26:26 2012 +0900 +++ b/src/ChangeLog Mon Aug 06 13:07:55 2012 +0100 @@ -1,3 +1,10 @@ +2012-08-06 Aidan Kehoe + + * lread.c (read1): + * print.c (print_symbol): + Adopt GNU's ## syntax for the interned symbol with the zero-length + name. + 2012-08-02 Stephen J. Turnbull * XEmacs 21.5.32 "habanero" is released. diff -r dede3f658f8e -r febc025c4e0c src/lread.c --- a/src/lread.c Sat Aug 04 23:26:26 2012 +0900 +++ b/src/lread.c Mon Aug 06 13:07:55 2012 +0100 @@ -2654,6 +2654,8 @@ goto retry; } + /* The interned symbol with the empty name. */ + case '#': return intern (""); case '$': return Vload_file_name_internal; /* bit vectors */ case '*': return read_bit_vector (readcharfun); diff -r dede3f658f8e -r febc025c4e0c src/print.c --- 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? */