diff options
| author | Philipp Stephani | 2017-10-09 16:08:15 +0200 |
|---|---|---|
| committer | Philipp Stephani | 2017-10-09 16:08:15 +0200 |
| commit | 6abff55b5514515c5a28397b34aee478926af232 (patch) | |
| tree | c7d722049149ad0182c86dc1ac20d72df74f4f7f | |
| parent | 2c39565dc046d428127735552db6e7814631d4d4 (diff) | |
| download | emacs-6abff55b5514515c5a28397b34aee478926af232.tar.gz emacs-6abff55b5514515c5a28397b34aee478926af232.zip | |
Revert "Raise an error when detecting old-style backquotes."
This reverts commit 9613690f6e51e2f2aa2bcbbede3e209d08cfaaad.
| -rw-r--r-- | etc/NEWS | 3 | ||||
| -rw-r--r-- | lisp/emacs-lisp/bytecomp.el | 8 | ||||
| -rw-r--r-- | src/lread.c | 32 | ||||
| -rw-r--r-- | test/lisp/emacs-lisp/bytecomp-tests.el | 11 | ||||
| -rw-r--r-- | test/src/lread-tests.el | 10 |
5 files changed, 46 insertions, 18 deletions
| @@ -87,9 +87,6 @@ them through 'format' first. Even that is discouraged: for ElDoc | |||
| 87 | support, you should set 'eldoc-documentation-function' instead of | 87 | support, you should set 'eldoc-documentation-function' instead of |
| 88 | calling 'eldoc-message' directly. | 88 | calling 'eldoc-message' directly. |
| 89 | 89 | ||
| 90 | ** Old-style backquotes now generate an error. They have been | ||
| 91 | generating warnings for a decade. | ||
| 92 | |||
| 93 | 90 | ||
| 94 | * Lisp Changes in Emacs 27.1 | 91 | * Lisp Changes in Emacs 27.1 |
| 95 | 92 | ||
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 45fa188d6c8..590db570c56 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el | |||
| @@ -2048,8 +2048,14 @@ With argument ARG, insert value in current buffer after the form." | |||
| 2048 | (not (eobp))) | 2048 | (not (eobp))) |
| 2049 | (setq byte-compile-read-position (point) | 2049 | (setq byte-compile-read-position (point) |
| 2050 | byte-compile-last-position byte-compile-read-position) | 2050 | byte-compile-last-position byte-compile-read-position) |
| 2051 | (let* ((lread--unescaped-character-literals nil) | 2051 | (let* ((lread--old-style-backquotes nil) |
| 2052 | (lread--unescaped-character-literals nil) | ||
| 2052 | (form (read inbuffer))) | 2053 | (form (read inbuffer))) |
| 2054 | ;; Warn about the use of old-style backquotes. | ||
| 2055 | (when lread--old-style-backquotes | ||
| 2056 | (byte-compile-warn "!! The file uses old-style backquotes !! | ||
| 2057 | This functionality has been obsolete for more than 10 years already | ||
| 2058 | and will be removed soon. See (elisp)Backquote in the manual.")) | ||
| 2053 | (when lread--unescaped-character-literals | 2059 | (when lread--unescaped-character-literals |
| 2054 | (byte-compile-warn | 2060 | (byte-compile-warn |
| 2055 | "unescaped character literals %s detected!" | 2061 | "unescaped character literals %s detected!" |
diff --git a/src/lread.c b/src/lread.c index c073fc4ce6d..6bc93b14817 100644 --- a/src/lread.c +++ b/src/lread.c | |||
| @@ -1003,11 +1003,14 @@ load_error_handler (Lisp_Object data) | |||
| 1003 | return Qnil; | 1003 | return Qnil; |
| 1004 | } | 1004 | } |
| 1005 | 1005 | ||
| 1006 | static _Noreturn void | 1006 | static void |
| 1007 | load_error_old_style_backquotes (void) | 1007 | load_warn_old_style_backquotes (Lisp_Object file) |
| 1008 | { | 1008 | { |
| 1009 | AUTO_STRING (format, "Loading `%s': old-style backquotes detected!"); | 1009 | if (!NILP (Vlread_old_style_backquotes)) |
| 1010 | xsignal1 (Qerror, CALLN (Fformat_message, format, Vload_file_name)); | 1010 | { |
| 1011 | AUTO_STRING (format, "Loading `%s': old-style backquotes detected!"); | ||
| 1012 | CALLN (Fmessage, format, file); | ||
| 1013 | } | ||
| 1011 | } | 1014 | } |
| 1012 | 1015 | ||
| 1013 | static void | 1016 | static void |
| @@ -1279,6 +1282,10 @@ Return t if the file exists and loads successfully. */) | |||
| 1279 | 1282 | ||
| 1280 | version = -1; | 1283 | version = -1; |
| 1281 | 1284 | ||
| 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 | |||
| 1282 | /* Check for the presence of unescaped character literals and warn | 1289 | /* Check for the presence of unescaped character literals and warn |
| 1283 | about them. */ | 1290 | about them. */ |
| 1284 | specbind (Qlread_unescaped_character_literals, Qnil); | 1291 | specbind (Qlread_unescaped_character_literals, Qnil); |
| @@ -3171,7 +3178,10 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) | |||
| 3171 | first_in_list exception (old-style can still be obtained via | 3178 | first_in_list exception (old-style can still be obtained via |
| 3172 | "(\`" anyway). */ | 3179 | "(\`" anyway). */ |
| 3173 | if (!new_backquote_flag && first_in_list && next_char == ' ') | 3180 | if (!new_backquote_flag && first_in_list && next_char == ' ') |
| 3174 | load_error_old_style_backquotes (); | 3181 | { |
| 3182 | Vlread_old_style_backquotes = Qt; | ||
| 3183 | goto default_label; | ||
| 3184 | } | ||
| 3175 | else | 3185 | else |
| 3176 | { | 3186 | { |
| 3177 | Lisp_Object value; | 3187 | Lisp_Object value; |
| @@ -3222,7 +3232,10 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) | |||
| 3222 | return list2 (comma_type, value); | 3232 | return list2 (comma_type, value); |
| 3223 | } | 3233 | } |
| 3224 | else | 3234 | else |
| 3225 | load_error_old_style_backquotes (); | 3235 | { |
| 3236 | Vlread_old_style_backquotes = Qt; | ||
| 3237 | goto default_label; | ||
| 3238 | } | ||
| 3226 | } | 3239 | } |
| 3227 | case '?': | 3240 | case '?': |
| 3228 | { | 3241 | { |
| @@ -3410,6 +3423,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) | |||
| 3410 | row. */ | 3423 | row. */ |
| 3411 | FALLTHROUGH; | 3424 | FALLTHROUGH; |
| 3412 | default: | 3425 | default: |
| 3426 | default_label: | ||
| 3413 | if (c <= 040) goto retry; | 3427 | if (c <= 040) goto retry; |
| 3414 | if (c == NO_BREAK_SPACE) | 3428 | if (c == NO_BREAK_SPACE) |
| 3415 | goto retry; | 3429 | goto retry; |
| @@ -4982,6 +4996,12 @@ variables, this must be set in the first line of a file. */); | |||
| 4982 | doc: /* List of buffers being read from by calls to `eval-buffer' and `eval-region'. */); | 4996 | doc: /* List of buffers being read from by calls to `eval-buffer' and `eval-region'. */); |
| 4983 | Veval_buffer_list = Qnil; | 4997 | Veval_buffer_list = Qnil; |
| 4984 | 4998 | ||
| 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 | |||
| 4985 | DEFVAR_LISP ("lread--unescaped-character-literals", | 5005 | DEFVAR_LISP ("lread--unescaped-character-literals", |
| 4986 | Vlread_unescaped_character_literals, | 5006 | Vlread_unescaped_character_literals, |
| 4987 | doc: /* List of deprecated unescaped character literals encountered by `read'. | 5007 | doc: /* List of deprecated unescaped character literals encountered by `read'. |
diff --git a/test/lisp/emacs-lisp/bytecomp-tests.el b/test/lisp/emacs-lisp/bytecomp-tests.el index 1f85c269780..30d2a4753cf 100644 --- a/test/lisp/emacs-lisp/bytecomp-tests.el +++ b/test/lisp/emacs-lisp/bytecomp-tests.el | |||
| @@ -534,18 +534,23 @@ literals (Bug#20852)." | |||
| 534 | 534 | ||
| 535 | (ert-deftest bytecomp-tests--old-style-backquotes () | 535 | (ert-deftest bytecomp-tests--old-style-backquotes () |
| 536 | "Check that byte compiling warns about old-style backquotes." | 536 | "Check that byte compiling warns about old-style backquotes." |
| 537 | (should (boundp 'lread--old-style-backquotes)) | ||
| 537 | (bytecomp-tests--with-temp-file source | 538 | (bytecomp-tests--with-temp-file source |
| 538 | (write-region "(` (a b))" nil source) | 539 | (write-region "(` (a b))" nil source) |
| 539 | (bytecomp-tests--with-temp-file destination | 540 | (bytecomp-tests--with-temp-file destination |
| 540 | (let* ((byte-compile-dest-file-function (lambda (_) destination)) | 541 | (let* ((byte-compile-dest-file-function (lambda (_) destination)) |
| 541 | (byte-compile-debug t) | 542 | (byte-compile-error-on-warn t) |
| 542 | (err (should-error (byte-compile-file source)))) | 543 | (byte-compile-debug t) |
| 544 | (err (should-error (byte-compile-file source)))) | ||
| 543 | (should (equal (cdr err) | 545 | (should (equal (cdr err) |
| 544 | '("Loading `nil': old-style backquotes detected!"))))))) | 546 | (list "!! The file uses old-style backquotes !! |
| 547 | This functionality has been obsolete for more than 10 years already | ||
| 548 | and will be removed soon. See (elisp)Backquote in the manual."))))))) | ||
| 545 | 549 | ||
| 546 | 550 | ||
| 547 | (ert-deftest bytecomp-tests-function-put () | 551 | (ert-deftest bytecomp-tests-function-put () |
| 548 | "Check `function-put' operates during compilation." | 552 | "Check `function-put' operates during compilation." |
| 553 | (should (boundp 'lread--old-style-backquotes)) | ||
| 549 | (bytecomp-tests--with-temp-file source | 554 | (bytecomp-tests--with-temp-file source |
| 550 | (dolist (form '((function-put 'bytecomp-tests--foo 'foo 1) | 555 | (dolist (form '((function-put 'bytecomp-tests--foo 'foo 1) |
| 551 | (function-put 'bytecomp-tests--foo 'bar 2) | 556 | (function-put 'bytecomp-tests--foo 'bar 2) |
diff --git a/test/src/lread-tests.el b/test/src/lread-tests.el index 3f41982eba1..ac730b4f005 100644 --- a/test/src/lread-tests.el +++ b/test/src/lread-tests.el | |||
| @@ -173,13 +173,13 @@ literals (Bug#20852)." | |||
| 173 | (should (string-suffix-p "/somelib.el" (caar load-history))))) | 173 | (should (string-suffix-p "/somelib.el" (caar load-history))))) |
| 174 | 174 | ||
| 175 | (ert-deftest lread-tests--old-style-backquotes () | 175 | (ert-deftest lread-tests--old-style-backquotes () |
| 176 | "Check that loading doesn't accept old-style backquotes." | 176 | "Check that loading warns about old-style backquotes." |
| 177 | (lread-tests--with-temp-file file-name | 177 | (lread-tests--with-temp-file file-name |
| 178 | (write-region "(` (a b))" nil file-name) | 178 | (write-region "(` (a b))" nil file-name) |
| 179 | (let ((data (should-error (load file-name nil :nomessage :nosuffix)))) | 179 | (should (equal (load file-name nil :nomessage :nosuffix) t)) |
| 180 | (should (equal (cdr data) | 180 | (should (equal (lread-tests--last-message) |
| 181 | (list (concat (format-message "Loading `%s': " file-name) | 181 | (concat (format-message "Loading `%s': " file-name) |
| 182 | "old-style backquotes detected!"))))))) | 182 | "old-style backquotes detected!"))))) |
| 183 | 183 | ||
| 184 | (ert-deftest lread-lread--substitute-object-in-subtree () | 184 | (ert-deftest lread-lread--substitute-object-in-subtree () |
| 185 | (let ((x (cons 0 1))) | 185 | (let ((x (cons 0 1))) |