diff options
| author | Andreas Schwab | 2011-07-28 22:23:19 +0200 |
|---|---|---|
| committer | Andreas Schwab | 2011-07-28 22:23:19 +0200 |
| commit | 9a79b20c28f48ff640df50d74185b39acf0850a7 (patch) | |
| tree | a19604e9095adde815f9bcd263dcba14570e174a /src | |
| parent | d55e9c533fececfe4a934fe5a770dbe259d478a0 (diff) | |
| download | emacs-9a79b20c28f48ff640df50d74185b39acf0850a7.tar.gz emacs-9a79b20c28f48ff640df50d74185b39acf0850a7.zip | |
Implement ## reader macro
* src/lread.c (read1): Read ## as empty symbol.
* src/print.c (print_object): Print empty symbol as ##.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 6 | ||||
| -rw-r--r-- | src/lread.c | 3 | ||||
| -rw-r--r-- | src/print.c | 12 |
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 @@ | |||
| 1 | 2011-07-28 Andreas Schwab <schwab@linux-m68k.org> | ||
| 2 | |||
| 3 | * print.c (print_object): Print empty symbol as ##. | ||
| 4 | |||
| 5 | * lread.c (read1): Read ## as empty symbol. | ||
| 6 | |||
| 1 | 2011-07-28 Alp Aker <alp.tekin.aker@gmail.com> | 7 | 2011-07-28 Alp Aker <alp.tekin.aker@gmail.com> |
| 2 | 8 | ||
| 3 | * nsfns.m (x_set_foreground_color): Set f->foreground_pixel when | 9 | * 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) | |||
| 2670 | } | 2670 | } |
| 2671 | goto read_symbol; | 2671 | goto read_symbol; |
| 2672 | } | 2672 | } |
| 2673 | /* ## is the empty symbol. */ | ||
| 2674 | if (c == '#') | ||
| 2675 | return Fintern (build_string (""), Qnil); | ||
| 2673 | /* Reader forms that can reuse previously read objects. */ | 2676 | /* Reader forms that can reuse previously read objects. */ |
| 2674 | if (c >= '0' && c <= '9') | 2677 | if (c >= '0' && c <= '9') |
| 2675 | { | 2678 | { |
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 | |||
| 1536 | else | 1536 | else |
| 1537 | confusing = 0; | 1537 | confusing = 0; |
| 1538 | 1538 | ||
| 1539 | size_byte = SBYTES (name); | ||
| 1540 | |||
| 1539 | if (! NILP (Vprint_gensym) && !SYMBOL_INTERNED_P (obj)) | 1541 | if (! NILP (Vprint_gensym) && !SYMBOL_INTERNED_P (obj)) |
| 1540 | { | 1542 | { |
| 1541 | PRINTCHAR ('#'); | 1543 | PRINTCHAR ('#'); |
| 1542 | PRINTCHAR (':'); | 1544 | PRINTCHAR (':'); |
| 1543 | } | 1545 | } |
| 1544 | 1546 | else if (size_byte == 0) | |
| 1545 | size_byte = SBYTES (name); | 1547 | { |
| 1548 | PRINTCHAR ('#'); | ||
| 1549 | PRINTCHAR ('#'); | ||
| 1550 | break; | ||
| 1551 | } | ||
| 1546 | 1552 | ||
| 1547 | for (i = 0, i_byte = 0; i_byte < size_byte;) | 1553 | for (i = 0, i_byte = 0; i_byte < size_byte;) |
| 1548 | { | 1554 | { |
| @@ -1555,7 +1561,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag | |||
| 1555 | { | 1561 | { |
| 1556 | if (c == '\"' || c == '\\' || c == '\'' | 1562 | if (c == '\"' || c == '\\' || c == '\'' |
| 1557 | || c == ';' || c == '#' || c == '(' || c == ')' | 1563 | || c == ';' || c == '#' || c == '(' || c == ')' |
| 1558 | || c == ',' || c =='.' || c == '`' | 1564 | || c == ',' || c == '.' || c == '`' |
| 1559 | || c == '[' || c == ']' || c == '?' || c <= 040 | 1565 | || c == '[' || c == ']' || c == '?' || c <= 040 |
| 1560 | || confusing) | 1566 | || confusing) |
| 1561 | PRINTCHAR ('\\'), confusing = 0; | 1567 | PRINTCHAR ('\\'), confusing = 0; |