diff options
| author | Philipp Stephani | 2017-10-03 16:14:54 +0200 |
|---|---|---|
| committer | Philipp Stephani | 2017-12-09 21:24:05 +0100 |
| commit | 8b8197235f058276823832eadce66e2de2f9a9cf (patch) | |
| tree | cc1056b104b6a4835d243e1ca22776e083213018 /src | |
| parent | 6fc0397388c9e03a631806667570959a49b49763 (diff) | |
| download | emacs-8b8197235f058276823832eadce66e2de2f9a9cf.tar.gz emacs-8b8197235f058276823832eadce66e2de2f9a9cf.zip | |
Raise an error when detecting old-style backquotes.
They have been deprecated for a decade now.
* src/lread.c (Fload): Don't use record_unwind_protect to warn about
old-style backquotes any more. They now generate a hard error.
(read1): Signal an error when detecting old-style backquotes. Remove
unused label.
(syms_of_lread): Remove unused internal variable
'lread--old-style-backquotes'.
(load_error_old_style_backquotes): Rename from
'load_warn_oldstyle_backquotes'. Signal an error.
* lisp/emacs-lisp/bytecomp.el (byte-compile-from-buffer): Remove check
from byte compiler. It isn't triggered any more.
* test/src/lread-tests.el (lread-tests--old-style-backquotes): Adapt
unit test.
* test/lisp/emacs-lisp/bytecomp-tests.el
(bytecomp-tests--old-style-backquotes)
(bytecomp-tests-function-put): Adapt unit tests.
* etc/NEWS: Document change.
Diffstat (limited to 'src')
| -rw-r--r-- | src/lread.c | 32 |
1 files changed, 6 insertions, 26 deletions
diff --git a/src/lread.c b/src/lread.c index a8080876031..52897b4fccd 100644 --- a/src/lread.c +++ b/src/lread.c | |||
| @@ -1003,14 +1003,11 @@ load_error_handler (Lisp_Object data) | |||
| 1003 | return Qnil; | 1003 | return Qnil; |
| 1004 | } | 1004 | } |
| 1005 | 1005 | ||
| 1006 | static void | 1006 | static _Noreturn void |
| 1007 | load_warn_old_style_backquotes (Lisp_Object file) | 1007 | load_error_old_style_backquotes (void) |
| 1008 | { | 1008 | { |
| 1009 | if (!NILP (Vlread_old_style_backquotes)) | 1009 | AUTO_STRING (format, "Loading `%s': old-style backquotes detected!"); |
| 1010 | { | 1010 | xsignal1 (Qerror, CALLN (Fformat_message, format, Vload_file_name)); |
| 1011 | AUTO_STRING (format, "Loading `%s': old-style backquotes detected!"); | ||
| 1012 | CALLN (Fmessage, format, file); | ||
| 1013 | } | ||
| 1014 | } | 1011 | } |
| 1015 | 1012 | ||
| 1016 | static void | 1013 | static void |
| @@ -1282,10 +1279,6 @@ Return t if the file exists and loads successfully. */) | |||
| 1282 | 1279 | ||
| 1283 | version = -1; | 1280 | version = -1; |
| 1284 | 1281 | ||
| 1285 | /* Check for the presence of old-style quotes and warn about them. */ | ||
| 1286 | specbind (Qlread_old_style_backquotes, Qnil); | ||
| 1287 | record_unwind_protect (load_warn_old_style_backquotes, file); | ||
| 1288 | |||
| 1289 | /* Check for the presence of unescaped character literals and warn | 1282 | /* Check for the presence of unescaped character literals and warn |
| 1290 | about them. */ | 1283 | about them. */ |
| 1291 | specbind (Qlread_unescaped_character_literals, Qnil); | 1284 | specbind (Qlread_unescaped_character_literals, Qnil); |
| @@ -3178,10 +3171,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) | |||
| 3178 | first_in_list exception (old-style can still be obtained via | 3171 | first_in_list exception (old-style can still be obtained via |
| 3179 | "(\`" anyway). */ | 3172 | "(\`" anyway). */ |
| 3180 | if (!new_backquote_flag && first_in_list && next_char == ' ') | 3173 | if (!new_backquote_flag && first_in_list && next_char == ' ') |
| 3181 | { | 3174 | load_error_old_style_backquotes (); |
| 3182 | Vlread_old_style_backquotes = Qt; | ||
| 3183 | goto default_label; | ||
| 3184 | } | ||
| 3185 | else | 3175 | else |
| 3186 | { | 3176 | { |
| 3187 | Lisp_Object value; | 3177 | Lisp_Object value; |
| @@ -3232,10 +3222,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) | |||
| 3232 | return list2 (comma_type, value); | 3222 | return list2 (comma_type, value); |
| 3233 | } | 3223 | } |
| 3234 | else | 3224 | else |
| 3235 | { | 3225 | load_error_old_style_backquotes (); |
| 3236 | Vlread_old_style_backquotes = Qt; | ||
| 3237 | goto default_label; | ||
| 3238 | } | ||
| 3239 | } | 3226 | } |
| 3240 | case '?': | 3227 | case '?': |
| 3241 | { | 3228 | { |
| @@ -3423,7 +3410,6 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) | |||
| 3423 | row. */ | 3410 | row. */ |
| 3424 | FALLTHROUGH; | 3411 | FALLTHROUGH; |
| 3425 | default: | 3412 | default: |
| 3426 | default_label: | ||
| 3427 | if (c <= 040) goto retry; | 3413 | if (c <= 040) goto retry; |
| 3428 | if (c == NO_BREAK_SPACE) | 3414 | if (c == NO_BREAK_SPACE) |
| 3429 | goto retry; | 3415 | goto retry; |
| @@ -4996,12 +4982,6 @@ variables, this must be set in the first line of a file. */); | |||
| 4996 | doc: /* List of buffers being read from by calls to `eval-buffer' and `eval-region'. */); | 4982 | doc: /* List of buffers being read from by calls to `eval-buffer' and `eval-region'. */); |
| 4997 | Veval_buffer_list = Qnil; | 4983 | Veval_buffer_list = Qnil; |
| 4998 | 4984 | ||
| 4999 | DEFVAR_LISP ("lread--old-style-backquotes", Vlread_old_style_backquotes, | ||
| 5000 | doc: /* Set to non-nil when `read' encounters an old-style backquote. | ||
| 5001 | For internal use only. */); | ||
| 5002 | Vlread_old_style_backquotes = Qnil; | ||
| 5003 | DEFSYM (Qlread_old_style_backquotes, "lread--old-style-backquotes"); | ||
| 5004 | |||
| 5005 | DEFVAR_LISP ("lread--unescaped-character-literals", | 4985 | DEFVAR_LISP ("lread--unescaped-character-literals", |
| 5006 | Vlread_unescaped_character_literals, | 4986 | Vlread_unescaped_character_literals, |
| 5007 | doc: /* List of deprecated unescaped character literals encountered by `read'. | 4987 | doc: /* List of deprecated unescaped character literals encountered by `read'. |