summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@linux-m68k.org>2011-07-28 22:23:19 +0200
committerAndreas Schwab <schwab@linux-m68k.org>2011-07-28 22:23:19 +0200
commit9a79b20c28f48ff640df50d74185b39acf0850a7 (patch)
treea19604e9095adde815f9bcd263dcba14570e174a
parentd55e9c533fececfe4a934fe5a770dbe259d478a0 (diff)
downloademacs-9a79b20c28f48ff640df50d74185b39acf0850a7.tar.gz
emacs-9a79b20c28f48ff640df50d74185b39acf0850a7.tar.bz2
emacs-9a79b20c28f48ff640df50d74185b39acf0850a7.zip
Implement ## reader macro
* src/lread.c (read1): Read ## as empty symbol. * src/print.c (print_object): Print empty symbol as ##.
-rw-r--r--src/ChangeLog6
-rw-r--r--src/lread.c3
-rw-r--r--src/print.c12
3 files changed, 18 insertions, 3 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index f6f64f4211d..3eaa3d5eadd 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,9 @@
+2011-07-28 Andreas Schwab <schwab@linux-m68k.org>
+
+ * print.c (print_object): Print empty symbol as ##.
+
+ * lread.c (read1): Read ## as empty symbol.
+
2011-07-28 Alp Aker <alp.tekin.aker@gmail.com>
* nsfns.m (x_set_foreground_color): Set f->foreground_pixel when
diff --git a/src/lread.c b/src/lread.c
index 0613ad037bf..78ff195e990 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -2670,6 +2670,9 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
}
goto read_symbol;
}
+ /* ## is the empty symbol. */
+ if (c == '#')
+ return Fintern (build_string (""), Qnil);
/* Reader forms that can reuse previously read objects. */
if (c >= '0' && c <= '9')
{
diff --git a/src/print.c b/src/print.c
index f1907a31465..35f89860843 100644
--- a/src/print.c
+++ b/src/print.c
@@ -1536,13 +1536,19 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
else
confusing = 0;
+ size_byte = SBYTES (name);
+
if (! NILP (Vprint_gensym) && !SYMBOL_INTERNED_P (obj))
{
PRINTCHAR ('#');
PRINTCHAR (':');
}
-
- size_byte = SBYTES (name);
+ else if (size_byte == 0)
+ {
+ PRINTCHAR ('#');
+ PRINTCHAR ('#');
+ break;
+ }
for (i = 0, i_byte = 0; i_byte < size_byte;)
{
@@ -1555,7 +1561,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag
{
if (c == '\"' || c == '\\' || c == '\''
|| c == ';' || c == '#' || c == '(' || c == ')'
- || c == ',' || c =='.' || c == '`'
+ || c == ',' || c == '.' || c == '`'
|| c == '[' || c == ']' || c == '?' || c <= 040
|| confusing)
PRINTCHAR ('\\'), confusing = 0;