* [PATCH] Make `old-style-backquotes' variable internal
[not found] <jwvk2uivag9.fsf-monnier+emacsbugs@gnu.org>
@ 2017-05-06 21:14 ` Philipp
2017-05-07 2:31 ` Eli Zaretskii
0 siblings, 1 reply; 4+ messages in thread
From: Philipp @ 2017-05-06 21:14 UTC (permalink / raw)
To: monnier, emacs-devel; +Cc: Philipp
* 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.
---
lisp/emacs-lisp/bytecomp.el | 4 ++--
src/lread.c | 17 +++++++++--------
test/lisp/emacs-lisp/bytecomp-tests.el | 15 +++++++++++++++
test/src/lread-tests.el | 9 +++++++++
4 files changed, 35 insertions(+), 10 deletions(-)
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 25102548a9..3fd3f5a1b8 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -2026,11 +2026,11 @@ byte-compile-from-buffer
(not (eobp)))
(setq byte-compile-read-position (point)
byte-compile-last-position byte-compile-read-position)
- (let* ((old-style-backquotes nil)
+ (let* ((lread--old-style-backquotes nil)
(lread--unescaped-character-literals nil)
(form (read inbuffer)))
;; Warn about the use of old-style backquotes.
- (when old-style-backquotes
+ (when lread--old-style-backquotes
(byte-compile-warn "!! The file uses old-style backquotes !!
This functionality has been obsolete for more than 10 years already
and will be removed soon. See (elisp)Backquote in the manual."))
diff --git a/src/lread.c b/src/lread.c
index 6467043b1d..3cf8ef5a4e 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -948,7 +948,7 @@ load_error_handler (Lisp_Object data)
static void
load_warn_old_style_backquotes (Lisp_Object file)
{
- if (!NILP (Vold_style_backquotes))
+ if (!NILP (Vlread_old_style_backquotes))
{
AUTO_STRING (format, "Loading `%s': old-style backquotes detected!");
CALLN (Fmessage, format, file);
@@ -1214,7 +1214,7 @@ Return t if the file exists and loads successfully. */)
version = -1;
/* Check for the presence of old-style quotes and warn about them. */
- specbind (Qold_style_backquotes, Qnil);
+ specbind (Qlread_old_style_backquotes, Qnil);
record_unwind_protect (load_warn_old_style_backquotes, file);
/* Check for the presence of unescaped character literals and warn
@@ -3037,7 +3037,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list)
"(\`" anyway). */
if (!new_backquote_flag && first_in_list && next_char == ' ')
{
- Vold_style_backquotes = Qt;
+ Vlread_old_style_backquotes = Qt;
goto default_label;
}
else
@@ -3091,7 +3091,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list)
}
else
{
- Vold_style_backquotes = Qt;
+ Vlread_old_style_backquotes = Qt;
goto default_label;
}
}
@@ -4840,10 +4840,11 @@ variables, this must be set in the first line of a file. */);
doc: /* List of buffers being read from by calls to `eval-buffer' and `eval-region'. */);
Veval_buffer_list = Qnil;
- DEFVAR_LISP ("old-style-backquotes", Vold_style_backquotes,
- doc: /* Set to non-nil when `read' encounters an old-style backquote. */);
- Vold_style_backquotes = Qnil;
- DEFSYM (Qold_style_backquotes, "old-style-backquotes");
+ DEFVAR_LISP ("lread--old-style-backquotes", Vlread_old_style_backquotes,
+ doc: /* Set to non-nil when `read' encounters an old-style backquote.
+For internal use only. */);
+ Vlread_old_style_backquotes = Qnil;
+ DEFSYM (Qlread_old_style_backquotes, "lread--old-style-backquotes");
DEFVAR_LISP ("lread--unescaped-character-literals",
Vlread_unescaped_character_literals,
diff --git a/test/lisp/emacs-lisp/bytecomp-tests.el b/test/lisp/emacs-lisp/bytecomp-tests.el
index 3624904753..a83c998a59 100644
--- a/test/lisp/emacs-lisp/bytecomp-tests.el
+++ b/test/lisp/emacs-lisp/bytecomp-tests.el
@@ -529,6 +529,21 @@ bytecomp-tests--with-temp-file
(list (concat "unescaped character literals "
"\", (, ), ;, [, ] detected!"))))))))
+(ert-deftest bytecomp-tests--old-style-backquotes ()
+ "Check that byte compiling warns about old-style backquotes."
+ (should (boundp 'lread--old-style-backquotes))
+ (bytecomp-tests--with-temp-file source
+ (write-region "(` (a b))" nil source)
+ (bytecomp-tests--with-temp-file destination
+ (let* ((byte-compile-dest-file-function (lambda (_) destination))
+ (byte-compile-error-on-warn t)
+ (byte-compile-debug t)
+ (err (should-error (byte-compile-file source))))
+ (should (equal (cdr err)
+ (list "!! The file uses old-style backquotes !!
+This functionality has been obsolete for more than 10 years already
+and will be removed soon. See (elisp)Backquote in the manual.")))))))
+
;; Local Variables:
;; no-byte-compile: t
;; End:
diff --git a/test/src/lread-tests.el b/test/src/lread-tests.el
index 84342348d4..e45d184cad 100644
--- a/test/src/lread-tests.el
+++ b/test/src/lread-tests.el
@@ -142,4 +142,13 @@ lread-tests--last-message
"unescaped character literals "
"\", (, ), ;, [, ] detected!")))))
+(ert-deftest lread-tests--old-style-backquotes ()
+ "Check that loading warns about old-style backquotes."
+ (lread-tests--with-temp-file file-name
+ (write-region "(` (a b))" nil file-name)
+ (should (equal (load file-name nil :nomessage :nosuffix) t))
+ (should (equal (lread-tests--last-message)
+ (concat (format-message "Loading `%s': " file-name)
+ "old-style backquotes detected!")))))
+
;;; lread-tests.el ends here
--
2.12.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] Make `old-style-backquotes' variable internal
2017-05-06 21:14 ` [PATCH] Make `old-style-backquotes' variable internal Philipp
@ 2017-05-07 2:31 ` Eli Zaretskii
2017-05-07 11:49 ` Philipp
0 siblings, 1 reply; 4+ messages in thread
From: Eli Zaretskii @ 2017-05-07 2:31 UTC (permalink / raw)
To: Philipp; +Cc: phst, monnier, emacs-devel
> From: Philipp <phil07c1@gmail.com>
> Date: Sat, 6 May 2017 23:14:20 +0200
> Cc: Philipp <phst@google.com>
>
> * 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.
Should this be in NEWS?
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] Make `old-style-backquotes' variable internal
2017-05-07 2:31 ` Eli Zaretskii
@ 2017-05-07 11:49 ` Philipp
2017-05-13 10:35 ` Philipp Stephani
0 siblings, 1 reply; 4+ messages in thread
From: Philipp @ 2017-05-07 11:49 UTC (permalink / raw)
To: eliz, monnier, emacs-devel; +Cc: Philipp
* 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.
---
etc/NEWS | 5 +++++
lisp/emacs-lisp/bytecomp.el | 4 ++--
src/lread.c | 17 +++++++++--------
test/lisp/emacs-lisp/bytecomp-tests.el | 15 +++++++++++++++
test/src/lread-tests.el | 9 +++++++++
5 files changed, 40 insertions(+), 10 deletions(-)
diff --git a/etc/NEWS b/etc/NEWS
index 1f1f4b4b4b..166744b848 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -896,6 +896,11 @@ which was sometimes numerically incorrect. For example, on a 64-bit
host (max 1e16 10000000000000001) now returns its second argument
instead of its first.
++++
+** The variable 'old-style-backquotes' has been made internal and
+renamed to 'lread--old-style-backquotes'. No user code should use
+this variable.
+
\f
* Lisp Changes in Emacs 26.1
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 201733ff03..04335ffbfe 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -2021,11 +2021,11 @@ byte-compile-from-buffer
(not (eobp)))
(setq byte-compile-read-position (point)
byte-compile-last-position byte-compile-read-position)
- (let* ((old-style-backquotes nil)
+ (let* ((lread--old-style-backquotes nil)
(lread--unescaped-character-literals nil)
(form (read inbuffer)))
;; Warn about the use of old-style backquotes.
- (when old-style-backquotes
+ (when lread--old-style-backquotes
(byte-compile-warn "!! The file uses old-style backquotes !!
This functionality has been obsolete for more than 10 years already
and will be removed soon. See (elisp)Backquote in the manual."))
diff --git a/src/lread.c b/src/lread.c
index 6467043b1d..3cf8ef5a4e 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -948,7 +948,7 @@ load_error_handler (Lisp_Object data)
static void
load_warn_old_style_backquotes (Lisp_Object file)
{
- if (!NILP (Vold_style_backquotes))
+ if (!NILP (Vlread_old_style_backquotes))
{
AUTO_STRING (format, "Loading `%s': old-style backquotes detected!");
CALLN (Fmessage, format, file);
@@ -1214,7 +1214,7 @@ Return t if the file exists and loads successfully. */)
version = -1;
/* Check for the presence of old-style quotes and warn about them. */
- specbind (Qold_style_backquotes, Qnil);
+ specbind (Qlread_old_style_backquotes, Qnil);
record_unwind_protect (load_warn_old_style_backquotes, file);
/* Check for the presence of unescaped character literals and warn
@@ -3037,7 +3037,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list)
"(\`" anyway). */
if (!new_backquote_flag && first_in_list && next_char == ' ')
{
- Vold_style_backquotes = Qt;
+ Vlread_old_style_backquotes = Qt;
goto default_label;
}
else
@@ -3091,7 +3091,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list)
}
else
{
- Vold_style_backquotes = Qt;
+ Vlread_old_style_backquotes = Qt;
goto default_label;
}
}
@@ -4840,10 +4840,11 @@ variables, this must be set in the first line of a file. */);
doc: /* List of buffers being read from by calls to `eval-buffer' and `eval-region'. */);
Veval_buffer_list = Qnil;
- DEFVAR_LISP ("old-style-backquotes", Vold_style_backquotes,
- doc: /* Set to non-nil when `read' encounters an old-style backquote. */);
- Vold_style_backquotes = Qnil;
- DEFSYM (Qold_style_backquotes, "old-style-backquotes");
+ DEFVAR_LISP ("lread--old-style-backquotes", Vlread_old_style_backquotes,
+ doc: /* Set to non-nil when `read' encounters an old-style backquote.
+For internal use only. */);
+ Vlread_old_style_backquotes = Qnil;
+ DEFSYM (Qlread_old_style_backquotes, "lread--old-style-backquotes");
DEFVAR_LISP ("lread--unescaped-character-literals",
Vlread_unescaped_character_literals,
diff --git a/test/lisp/emacs-lisp/bytecomp-tests.el b/test/lisp/emacs-lisp/bytecomp-tests.el
index 3624904753..a83c998a59 100644
--- a/test/lisp/emacs-lisp/bytecomp-tests.el
+++ b/test/lisp/emacs-lisp/bytecomp-tests.el
@@ -529,6 +529,21 @@ bytecomp-tests--with-temp-file
(list (concat "unescaped character literals "
"\", (, ), ;, [, ] detected!"))))))))
+(ert-deftest bytecomp-tests--old-style-backquotes ()
+ "Check that byte compiling warns about old-style backquotes."
+ (should (boundp 'lread--old-style-backquotes))
+ (bytecomp-tests--with-temp-file source
+ (write-region "(` (a b))" nil source)
+ (bytecomp-tests--with-temp-file destination
+ (let* ((byte-compile-dest-file-function (lambda (_) destination))
+ (byte-compile-error-on-warn t)
+ (byte-compile-debug t)
+ (err (should-error (byte-compile-file source))))
+ (should (equal (cdr err)
+ (list "!! The file uses old-style backquotes !!
+This functionality has been obsolete for more than 10 years already
+and will be removed soon. See (elisp)Backquote in the manual.")))))))
+
;; Local Variables:
;; no-byte-compile: t
;; End:
diff --git a/test/src/lread-tests.el b/test/src/lread-tests.el
index 84342348d4..e45d184cad 100644
--- a/test/src/lread-tests.el
+++ b/test/src/lread-tests.el
@@ -142,4 +142,13 @@ lread-tests--last-message
"unescaped character literals "
"\", (, ), ;, [, ] detected!")))))
+(ert-deftest lread-tests--old-style-backquotes ()
+ "Check that loading warns about old-style backquotes."
+ (lread-tests--with-temp-file file-name
+ (write-region "(` (a b))" nil file-name)
+ (should (equal (load file-name nil :nomessage :nosuffix) t))
+ (should (equal (lread-tests--last-message)
+ (concat (format-message "Loading `%s': " file-name)
+ "old-style backquotes detected!")))))
+
;;; lread-tests.el ends here
--
2.12.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] Make `old-style-backquotes' variable internal
2017-05-07 11:49 ` Philipp
@ 2017-05-13 10:35 ` Philipp Stephani
0 siblings, 0 replies; 4+ messages in thread
From: Philipp Stephani @ 2017-05-13 10:35 UTC (permalink / raw)
To: eliz, monnier, emacs-devel; +Cc: Philipp
[-- Attachment #1: Type: text/plain, Size: 6959 bytes --]
Philipp <phil07c1@gmail.com> schrieb am So., 7. Mai 2017 um 13:49 Uhr:
> * 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.
> ---
> etc/NEWS | 5 +++++
> lisp/emacs-lisp/bytecomp.el | 4 ++--
> src/lread.c | 17 +++++++++--------
> test/lisp/emacs-lisp/bytecomp-tests.el | 15 +++++++++++++++
> test/src/lread-tests.el | 9 +++++++++
> 5 files changed, 40 insertions(+), 10 deletions(-)
>
> diff --git a/etc/NEWS b/etc/NEWS
> index 1f1f4b4b4b..166744b848 100644
> --- a/etc/NEWS
> +++ b/etc/NEWS
> @@ -896,6 +896,11 @@ which was sometimes numerically incorrect. For
> example, on a 64-bit
> host (max 1e16 10000000000000001) now returns its second argument
> instead of its first.
>
> ++++
> +** The variable 'old-style-backquotes' has been made internal and
> +renamed to 'lread--old-style-backquotes'. No user code should use
> +this variable.
> +
>
> * Lisp Changes in Emacs 26.1
>
> diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
> index 201733ff03..04335ffbfe 100644
> --- a/lisp/emacs-lisp/bytecomp.el
> +++ b/lisp/emacs-lisp/bytecomp.el
> @@ -2021,11 +2021,11 @@ byte-compile-from-buffer
> (not (eobp)))
> (setq byte-compile-read-position (point)
> byte-compile-last-position byte-compile-read-position)
> - (let* ((old-style-backquotes nil)
> + (let* ((lread--old-style-backquotes nil)
> (lread--unescaped-character-literals nil)
> (form (read inbuffer)))
> ;; Warn about the use of old-style backquotes.
> - (when old-style-backquotes
> + (when lread--old-style-backquotes
> (byte-compile-warn "!! The file uses old-style backquotes !!
> This functionality has been obsolete for more than 10 years already
> and will be removed soon. See (elisp)Backquote in the manual."))
> diff --git a/src/lread.c b/src/lread.c
> index 6467043b1d..3cf8ef5a4e 100644
> --- a/src/lread.c
> +++ b/src/lread.c
> @@ -948,7 +948,7 @@ load_error_handler (Lisp_Object data)
> static void
> load_warn_old_style_backquotes (Lisp_Object file)
> {
> - if (!NILP (Vold_style_backquotes))
> + if (!NILP (Vlread_old_style_backquotes))
> {
> AUTO_STRING (format, "Loading `%s': old-style backquotes
> detected!");
> CALLN (Fmessage, format, file);
> @@ -1214,7 +1214,7 @@ Return t if the file exists and loads successfully.
> */)
> version = -1;
>
> /* Check for the presence of old-style quotes and warn about them. */
> - specbind (Qold_style_backquotes, Qnil);
> + specbind (Qlread_old_style_backquotes, Qnil);
> record_unwind_protect (load_warn_old_style_backquotes, file);
>
> /* Check for the presence of unescaped character literals and warn
> @@ -3037,7 +3037,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool
> first_in_list)
> "(\`" anyway). */
> if (!new_backquote_flag && first_in_list && next_char == ' ')
> {
> - Vold_style_backquotes = Qt;
> + Vlread_old_style_backquotes = Qt;
> goto default_label;
> }
> else
> @@ -3091,7 +3091,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool
> first_in_list)
> }
> else
> {
> - Vold_style_backquotes = Qt;
> + Vlread_old_style_backquotes = Qt;
> goto default_label;
> }
> }
> @@ -4840,10 +4840,11 @@ variables, this must be set in the first line of a
> file. */);
> doc: /* List of buffers being read from by calls to
> `eval-buffer' and `eval-region'. */);
> Veval_buffer_list = Qnil;
>
> - DEFVAR_LISP ("old-style-backquotes", Vold_style_backquotes,
> - doc: /* Set to non-nil when `read' encounters an old-style
> backquote. */);
> - Vold_style_backquotes = Qnil;
> - DEFSYM (Qold_style_backquotes, "old-style-backquotes");
> + DEFVAR_LISP ("lread--old-style-backquotes", Vlread_old_style_backquotes,
> + doc: /* Set to non-nil when `read' encounters an old-style
> backquote.
> +For internal use only. */);
> + Vlread_old_style_backquotes = Qnil;
> + DEFSYM (Qlread_old_style_backquotes, "lread--old-style-backquotes");
>
> DEFVAR_LISP ("lread--unescaped-character-literals",
> Vlread_unescaped_character_literals,
> diff --git a/test/lisp/emacs-lisp/bytecomp-tests.el
> b/test/lisp/emacs-lisp/bytecomp-tests.el
> index 3624904753..a83c998a59 100644
> --- a/test/lisp/emacs-lisp/bytecomp-tests.el
> +++ b/test/lisp/emacs-lisp/bytecomp-tests.el
> @@ -529,6 +529,21 @@ bytecomp-tests--with-temp-file
> (list (concat "unescaped character literals "
> "\", (, ), ;, [, ] detected!"))))))))
>
> +(ert-deftest bytecomp-tests--old-style-backquotes ()
> + "Check that byte compiling warns about old-style backquotes."
> + (should (boundp 'lread--old-style-backquotes))
> + (bytecomp-tests--with-temp-file source
> + (write-region "(` (a b))" nil source)
> + (bytecomp-tests--with-temp-file destination
> + (let* ((byte-compile-dest-file-function (lambda (_) destination))
> + (byte-compile-error-on-warn t)
> + (byte-compile-debug t)
> + (err (should-error (byte-compile-file source))))
> + (should (equal (cdr err)
> + (list "!! The file uses old-style backquotes !!
> +This functionality has been obsolete for more than 10 years already
> +and will be removed soon. See (elisp)Backquote in the manual.")))))))
> +
> ;; Local Variables:
> ;; no-byte-compile: t
> ;; End:
> diff --git a/test/src/lread-tests.el b/test/src/lread-tests.el
> index 84342348d4..e45d184cad 100644
> --- a/test/src/lread-tests.el
> +++ b/test/src/lread-tests.el
> @@ -142,4 +142,13 @@ lread-tests--last-message
> "unescaped character literals "
> "\", (, ), ;, [, ] detected!")))))
>
> +(ert-deftest lread-tests--old-style-backquotes ()
> + "Check that loading warns about old-style backquotes."
> + (lread-tests--with-temp-file file-name
> + (write-region "(` (a b))" nil file-name)
> + (should (equal (load file-name nil :nomessage :nosuffix) t))
> + (should (equal (lread-tests--last-message)
> + (concat (format-message "Loading `%s': " file-name)
> + "old-style backquotes detected!")))))
> +
> ;;; lread-tests.el ends here
> --
> 2.12.2
>
>
Pushed as a1d4615921.
[-- Attachment #2: Type: text/html, Size: 8412 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-05-13 10:35 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <jwvk2uivag9.fsf-monnier+emacsbugs@gnu.org>
2017-05-06 21:14 ` [PATCH] Make `old-style-backquotes' variable internal Philipp
2017-05-07 2:31 ` Eli Zaretskii
2017-05-07 11:49 ` Philipp
2017-05-13 10:35 ` Philipp Stephani
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).