aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilipp2017-05-06 22:23:03 +0200
committerPhilipp Stephani2017-05-13 12:32:29 +0200
commita1d461592172ca4c8aac0e4e923ef5e909cfb361 (patch)
tree7d972dbecad74eab4f7dfb37969ab0170c2870e1
parent16004397f40d15d9db6b90632c236c804f38fc40 (diff)
downloademacs-a1d461592172ca4c8aac0e4e923ef5e909cfb361.tar.gz
emacs-a1d461592172ca4c8aac0e4e923ef5e909cfb361.zip
Make `old-style-backquotes' variable internal
* src/lread.c (load_warn_old_style_backquotes, Fload, read1) (syms_of_lread): Rename `old-style-backquotes' to `lread--old-style-backquotes', and clarify that it's for internal use only. * lisp/emacs-lisp/bytecomp.el (byte-compile-from-buffer): Rename variable. * test/src/lread-tests.el (lread-tests--old-style-backquotes): Add unit test. * emacs-lisp/bytecomp-tests.el (bytecomp-tests--old-style-backquotes): Add unit test.
-rw-r--r--etc/NEWS5
-rw-r--r--lisp/emacs-lisp/bytecomp.el4
-rw-r--r--src/lread.c17
-rw-r--r--test/lisp/emacs-lisp/bytecomp-tests.el15
-rw-r--r--test/src/lread-tests.el9
5 files changed, 40 insertions, 10 deletions
diff --git a/etc/NEWS b/etc/NEWS
index 9be6ee0f3f7..380ce710130 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -907,6 +907,11 @@ which was sometimes numerically incorrect. For example, on a 64-bit
907host (max 1e16 10000000000000001) now returns its second argument 907host (max 1e16 10000000000000001) now returns its second argument
908instead of its first. 908instead of its first.
909 909
910+++
911** The variable 'old-style-backquotes' has been made internal and
912renamed to 'lread--old-style-backquotes'. No user code should use
913this variable.
914
910 915
911* Lisp Changes in Emacs 26.1 916* Lisp Changes in Emacs 26.1
912 917
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index daad93de182..e716eef10ad 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -2021,11 +2021,11 @@ With argument ARG, insert value in current buffer after the form."
2021 (not (eobp))) 2021 (not (eobp)))
2022 (setq byte-compile-read-position (point) 2022 (setq byte-compile-read-position (point)
2023 byte-compile-last-position byte-compile-read-position) 2023 byte-compile-last-position byte-compile-read-position)
2024 (let* ((old-style-backquotes nil) 2024 (let* ((lread--old-style-backquotes nil)
2025 (lread--unescaped-character-literals nil) 2025 (lread--unescaped-character-literals nil)
2026 (form (read inbuffer))) 2026 (form (read inbuffer)))
2027 ;; Warn about the use of old-style backquotes. 2027 ;; Warn about the use of old-style backquotes.
2028 (when old-style-backquotes 2028 (when lread--old-style-backquotes
2029 (byte-compile-warn "!! The file uses old-style backquotes !! 2029 (byte-compile-warn "!! The file uses old-style backquotes !!
2030This functionality has been obsolete for more than 10 years already 2030This functionality has been obsolete for more than 10 years already
2031and will be removed soon. See (elisp)Backquote in the manual.")) 2031and will be removed soon. See (elisp)Backquote in the manual."))
diff --git a/src/lread.c b/src/lread.c
index 0e5b476a9a2..c03aad4f722 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -948,7 +948,7 @@ load_error_handler (Lisp_Object data)
948static void 948static void
949load_warn_old_style_backquotes (Lisp_Object file) 949load_warn_old_style_backquotes (Lisp_Object file)
950{ 950{
951 if (!NILP (Vold_style_backquotes)) 951 if (!NILP (Vlread_old_style_backquotes))
952 { 952 {
953 AUTO_STRING (format, "Loading `%s': old-style backquotes detected!"); 953 AUTO_STRING (format, "Loading `%s': old-style backquotes detected!");
954 CALLN (Fmessage, format, file); 954 CALLN (Fmessage, format, file);
@@ -1216,7 +1216,7 @@ Return t if the file exists and loads successfully. */)
1216 version = -1; 1216 version = -1;
1217 1217
1218 /* Check for the presence of old-style quotes and warn about them. */ 1218 /* Check for the presence of old-style quotes and warn about them. */
1219 specbind (Qold_style_backquotes, Qnil); 1219 specbind (Qlread_old_style_backquotes, Qnil);
1220 record_unwind_protect (load_warn_old_style_backquotes, file); 1220 record_unwind_protect (load_warn_old_style_backquotes, file);
1221 1221
1222 /* Check for the presence of unescaped character literals and warn 1222 /* Check for the presence of unescaped character literals and warn
@@ -3040,7 +3040,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list)
3040 "(\`" anyway). */ 3040 "(\`" anyway). */
3041 if (!new_backquote_flag && first_in_list && next_char == ' ') 3041 if (!new_backquote_flag && first_in_list && next_char == ' ')
3042 { 3042 {
3043 Vold_style_backquotes = Qt; 3043 Vlread_old_style_backquotes = Qt;
3044 goto default_label; 3044 goto default_label;
3045 } 3045 }
3046 else 3046 else
@@ -3094,7 +3094,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list)
3094 } 3094 }
3095 else 3095 else
3096 { 3096 {
3097 Vold_style_backquotes = Qt; 3097 Vlread_old_style_backquotes = Qt;
3098 goto default_label; 3098 goto default_label;
3099 } 3099 }
3100 } 3100 }
@@ -4843,10 +4843,11 @@ variables, this must be set in the first line of a file. */);
4843 doc: /* List of buffers being read from by calls to `eval-buffer' and `eval-region'. */); 4843 doc: /* List of buffers being read from by calls to `eval-buffer' and `eval-region'. */);
4844 Veval_buffer_list = Qnil; 4844 Veval_buffer_list = Qnil;
4845 4845
4846 DEFVAR_LISP ("old-style-backquotes", Vold_style_backquotes, 4846 DEFVAR_LISP ("lread--old-style-backquotes", Vlread_old_style_backquotes,
4847 doc: /* Set to non-nil when `read' encounters an old-style backquote. */); 4847 doc: /* Set to non-nil when `read' encounters an old-style backquote.
4848 Vold_style_backquotes = Qnil; 4848For internal use only. */);
4849 DEFSYM (Qold_style_backquotes, "old-style-backquotes"); 4849 Vlread_old_style_backquotes = Qnil;
4850 DEFSYM (Qlread_old_style_backquotes, "lread--old-style-backquotes");
4850 4851
4851 DEFVAR_LISP ("lread--unescaped-character-literals", 4852 DEFVAR_LISP ("lread--unescaped-character-literals",
4852 Vlread_unescaped_character_literals, 4853 Vlread_unescaped_character_literals,
diff --git a/test/lisp/emacs-lisp/bytecomp-tests.el b/test/lisp/emacs-lisp/bytecomp-tests.el
index 84004a9264a..d15bd8b6e65 100644
--- a/test/lisp/emacs-lisp/bytecomp-tests.el
+++ b/test/lisp/emacs-lisp/bytecomp-tests.el
@@ -530,6 +530,21 @@ literals (Bug#20852)."
530 "`?\"', `?(', `?)', `?;', `?[', `?]' " 530 "`?\"', `?(', `?)', `?;', `?[', `?]' "
531 "detected!")))))))) 531 "detected!"))))))))
532 532
533(ert-deftest bytecomp-tests--old-style-backquotes ()
534 "Check that byte compiling warns about old-style backquotes."
535 (should (boundp 'lread--old-style-backquotes))
536 (bytecomp-tests--with-temp-file source
537 (write-region "(` (a b))" nil source)
538 (bytecomp-tests--with-temp-file destination
539 (let* ((byte-compile-dest-file-function (lambda (_) destination))
540 (byte-compile-error-on-warn t)
541 (byte-compile-debug t)
542 (err (should-error (byte-compile-file source))))
543 (should (equal (cdr err)
544 (list "!! The file uses old-style backquotes !!
545This functionality has been obsolete for more than 10 years already
546and will be removed soon. See (elisp)Backquote in the manual.")))))))
547
533;; Local Variables: 548;; Local Variables:
534;; no-byte-compile: t 549;; no-byte-compile: t
535;; End: 550;; End:
diff --git a/test/src/lread-tests.el b/test/src/lread-tests.el
index 685ea682e29..98cbb6a301d 100644
--- a/test/src/lread-tests.el
+++ b/test/src/lread-tests.el
@@ -155,4 +155,13 @@ literals (Bug#20852)."
155 (load "somelib" nil t) 155 (load "somelib" nil t)
156 (should (string-suffix-p "/somelib.el" (caar load-history))))) 156 (should (string-suffix-p "/somelib.el" (caar load-history)))))
157 157
158(ert-deftest lread-tests--old-style-backquotes ()
159 "Check that loading warns about old-style backquotes."
160 (lread-tests--with-temp-file file-name
161 (write-region "(` (a b))" nil file-name)
162 (should (equal (load file-name nil :nomessage :nosuffix) t))
163 (should (equal (lread-tests--last-message)
164 (concat (format-message "Loading `%s': " file-name)
165 "old-style backquotes detected!")))))
166
158;;; lread-tests.el ends here 167;;; lread-tests.el ends here