diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2011-07-19 13:33:28 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2011-07-19 13:33:28 -0700 |
commit | 0d8de0fd0a5a63cc9558b5c99f9c7f1ddcaf338a (patch) | |
tree | 31cf6b0a22ba1ee37fef321a296eb288828dc4c6 /src/lread.c | |
parent | c2216f8e3a2a17ba5b843f0329ce52c920a336b2 (diff) | |
parent | 590bd46743151a55ba68a7d211f82b2485c57d3a (diff) | |
download | emacs-0d8de0fd0a5a63cc9558b5c99f9c7f1ddcaf338a.tar.gz |
Merge from trunk.
Diffstat (limited to 'src/lread.c')
-rw-r--r-- | src/lread.c | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/src/lread.c b/src/lread.c index c80ac430671..0613ad037bf 100644 --- a/src/lread.c +++ b/src/lread.c @@ -2327,8 +2327,7 @@ read_integer (Lisp_Object readcharfun, EMACS_INT radix) c = READCHAR; } - if (c >= 0) - UNREAD (c); + UNREAD (c); *p = '\0'; } @@ -2583,8 +2582,7 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list) nskip *= 10; nskip += c - '0'; } - if (c >= 0) - UNREAD (c); + UNREAD (c); if (load_force_doc_strings && (EQ (readcharfun, Qget_file_char) @@ -2660,7 +2658,17 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list) { uninterned_symbol = 1; c = READCHAR; - goto default_label; + if (!(c > 040 + && c != 0x8a0 + && (c >= 0200 + || strchr ("\"';()[]#`,", c) == NULL))) + { + /* No symbol character follows, this is the empty + symbol. */ + UNREAD (c); + return Fmake_symbol (build_string ("")); + } + goto read_symbol; } /* Reader forms that can reuse previously read objects. */ if (c >= '0' && c <= '9') @@ -2841,7 +2849,7 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list) next_char = READCHAR; ok = (next_char <= 040 || (next_char < 0200 - && (strchr ("\"';()[]#?`,.", next_char)))); + && strchr ("\"';()[]#?`,.", next_char) != NULL)); UNREAD (next_char); if (ok) return make_number (c); @@ -2966,11 +2974,6 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list) /* Otherwise, READ_BUFFER contains only ASCII. */ } - /* We want readchar_count to be the number of characters, not - bytes. Hence we adjust for multibyte characters in the - string. ... But it doesn't seem to be necessary, because - READCHAR *does* read multibyte characters from buffers. */ - /* readchar_count -= (p - read_buffer) - nchars; */ if (read_pure) return make_pure_string (read_buffer, nchars, p - read_buffer, (force_multibyte @@ -2987,7 +2990,7 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list) if (next_char <= 040 || (next_char < 0200 - && (strchr ("\"';([#?`,", next_char)))) + && strchr ("\"';([#?`,", next_char) != NULL)) { *pch = c; return Qnil; @@ -3002,9 +3005,12 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list) if (c <= 040) goto retry; if (c == 0x8a0) /* NBSP */ goto retry; + + read_symbol: { char *p = read_buffer; int quoted = 0; + EMACS_INT start_position = readchar_count - 1; { char *end = read_buffer + read_buffer_size; @@ -3035,10 +3041,11 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list) else *p++ = c; c = READCHAR; - } while (c > 040 - && c != 0x8a0 /* NBSP */ - && (c >= 0200 - || !(strchr ("\"';()[]#`,", c)))); + } + while (c > 040 + && c != 0x8a0 /* NBSP */ + && (c >= 0200 + || strchr ("\"';()[]#`,", c) == NULL)); if (p == end) { @@ -3051,8 +3058,7 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list) end = read_buffer + read_buffer_size; } *p = 0; - if (c >= 0) - UNREAD (c); + UNREAD (c); } if (!quoted && !uninterned_symbol) @@ -3080,12 +3086,7 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list) if (EQ (Vread_with_symbol_positions, Qt) || EQ (Vread_with_symbol_positions, readcharfun)) Vread_symbol_positions_list = - /* Kind of a hack; this will probably fail if characters - in the symbol name were escaped. Not really a big - deal, though. */ - Fcons (Fcons (result, - make_number (readchar_count - - XFASTINT (Flength (Fsymbol_name (result))))), + Fcons (Fcons (result, make_number (start_position)), Vread_symbol_positions_list); return result; } @@ -4490,10 +4491,9 @@ to load. See also `load-dangerous-libraries'. */); Qlexical_binding = intern ("lexical-binding"); staticpro (&Qlexical_binding); DEFVAR_LISP ("lexical-binding", Vlexical_binding, - doc: /* If non-nil, use lexical binding when evaluating code. -This applies to code evaluated by `eval-buffer' and `eval-region' and -other commands that call these functions, like `eval-defun' and -the like. + doc: /* Whether to use lexical binding when evaluating code. +Non-nil means that the code in the current buffer should be evaluated +with lexical binding. This variable is automatically set from the file variables of an interpreted Lisp file read using `load'. */); Fmake_variable_buffer_local (Qlexical_binding); |