* Old-style backquotes @ 2017-10-03 13:51 Philipp Stephani 2017-10-03 14:12 ` Paul Eggert 0 siblings, 1 reply; 24+ messages in thread From: Philipp Stephani @ 2017-10-03 13:51 UTC (permalink / raw) To: Emacs developers [-- Attachment #1: Type: text/plain, Size: 196 bytes --] Hi, old-style backquotes were deprecated ten years ago (1d06469794a66d6c8b424e6f17da029ebc5bb295). Is it time to finally turn them into errors for Emacs 26, and remove them in Emacs 27? Philipp [-- Attachment #2: Type: text/html, Size: 266 bytes --] ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: Old-style backquotes 2017-10-03 13:51 Old-style backquotes Philipp Stephani @ 2017-10-03 14:12 ` Paul Eggert 2017-10-03 14:17 ` [PATCH] Raise an error when detecting old-style backquotes Philipp Stephani 2017-10-03 15:02 ` Old-style backquotes Eli Zaretskii 0 siblings, 2 replies; 24+ messages in thread From: Paul Eggert @ 2017-10-03 14:12 UTC (permalink / raw) To: Philipp Stephani, Emacs developers On 10/03/2017 06:51 AM, Philipp Stephani wrote: > old-style backquotes were deprecated ten years ago > (1d06469794a66d6c8b424e6f17da029ebc5bb295). Is it time to finally turn > them into errors for Emacs 26, and remove them in Emacs 27? Ten years is long enough, so I'd say it's time. ^ permalink raw reply [flat|nested] 24+ messages in thread
* [PATCH] Raise an error when detecting old-style backquotes. 2017-10-03 14:12 ` Paul Eggert @ 2017-10-03 14:17 ` Philipp Stephani 2017-10-03 17:43 ` Stefan Monnier 2017-10-03 15:02 ` Old-style backquotes Eli Zaretskii 1 sibling, 1 reply; 24+ messages in thread From: Philipp Stephani @ 2017-10-03 14:17 UTC (permalink / raw) To: Paul Eggert, Philipp Stephani, Emacs developers; +Cc: Philipp Stephani 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. * test/src/lread-tests.el (lread-tests--old-style-backquotes): Adapt unit test. --- src/lread.c | 32 ++++++-------------------------- test/src/lread-tests.el | 10 +++++----- 2 files changed, 11 insertions(+), 31 deletions(-) diff --git a/src/lread.c b/src/lread.c index 6bc93b1481..44953baa77 100644 --- a/src/lread.c +++ b/src/lread.c @@ -1003,14 +1003,11 @@ load_error_handler (Lisp_Object data) return Qnil; } -static void -load_warn_old_style_backquotes (Lisp_Object file) +static _Noreturn void +load_error_old_style_backquotes (void) { - if (!NILP (Vlread_old_style_backquotes)) - { - AUTO_STRING (format, "Loading `%s': old-style backquotes detected!"); - CALLN (Fmessage, format, file); - } + AUTO_STRING (format, "Loading `%s': old-style backquotes detected!"); + xsignal1 (Qerror, CALLN (Fformat_message, format, Vload_file_name)); } static void @@ -1282,10 +1279,6 @@ Return t if the file exists and loads successfully. */) version = -1; - /* Check for the presence of old-style quotes and warn about them. */ - 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 about them. */ specbind (Qlread_unescaped_character_literals, Qnil); @@ -3178,10 +3171,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) first_in_list exception (old-style can still be obtained via "(\`" anyway). */ if (!new_backquote_flag && first_in_list && next_char == ' ') - { - Vlread_old_style_backquotes = Qt; - goto default_label; - } + load_error_old_style_backquotes (); else { Lisp_Object value; @@ -3232,10 +3222,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) return list2 (comma_type, value); } else - { - Vlread_old_style_backquotes = Qt; - goto default_label; - } + load_error_old_style_backquotes (); } case '?': { @@ -3423,7 +3410,6 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) row. */ FALLTHROUGH; default: - default_label: if (c <= 040) goto retry; if (c == NO_BREAK_SPACE) goto retry; @@ -4996,12 +4982,6 @@ 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 ("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, doc: /* List of deprecated unescaped character literals encountered by `read'. diff --git a/test/src/lread-tests.el b/test/src/lread-tests.el index ac730b4f00..241cebb6b1 100644 --- a/test/src/lread-tests.el +++ b/test/src/lread-tests.el @@ -173,13 +173,13 @@ lread-tests--last-message (should (string-suffix-p "/somelib.el" (caar load-history))))) (ert-deftest lread-tests--old-style-backquotes () - "Check that loading warns about old-style backquotes." + "Check that loading doesn’t accept 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!"))))) + (let ((data (should-error (load file-name nil :nomessage :nosuffix)))) + (should (equal (cdr data) + (list (concat (format-message "Loading `%s': " file-name) + "old-style backquotes detected!"))))))) (ert-deftest lread-lread--substitute-object-in-subtree () (let ((x (cons 0 1))) -- 2.14.2 ^ permalink raw reply related [flat|nested] 24+ messages in thread
* Re: [PATCH] Raise an error when detecting old-style backquotes. 2017-10-03 14:17 ` [PATCH] Raise an error when detecting old-style backquotes Philipp Stephani @ 2017-10-03 17:43 ` Stefan Monnier 2017-10-03 18:36 ` Philipp Stephani 2017-10-04 14:12 ` Richard Stallman 0 siblings, 2 replies; 24+ messages in thread From: Stefan Monnier @ 2017-10-03 17:43 UTC (permalink / raw) To: emacs-devel > * src/lread.c (Fload): Don’t use record_unwind_protect to warn about > old-style backquotes any more. They now generate a hard error. Not sure what's the benefit of raising a hard error, over just removing the obsolete feature altogether. Stefan ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH] Raise an error when detecting old-style backquotes. 2017-10-03 17:43 ` Stefan Monnier @ 2017-10-03 18:36 ` Philipp Stephani 2017-10-03 18:52 ` Stefan Monnier 2017-10-04 14:12 ` Richard Stallman 1 sibling, 1 reply; 24+ messages in thread From: Philipp Stephani @ 2017-10-03 18:36 UTC (permalink / raw) To: Stefan Monnier, emacs-devel [-- Attachment #1: Type: text/plain, Size: 518 bytes --] Stefan Monnier <monnier@iro.umontreal.ca> schrieb am Di., 3. Okt. 2017 um 19:44 Uhr: > > * src/lread.c (Fload): Don’t use record_unwind_protect to warn about > > old-style backquotes any more. They now generate a hard error. > > Not sure what's the benefit of raising a hard error, over just removing > the obsolete feature altogether. > > Removing the special treatment would change the behavior. I'd rather have a time span where developers would get hard errors instead of subtle behavior changes. [-- Attachment #2: Type: text/html, Size: 818 bytes --] ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH] Raise an error when detecting old-style backquotes. 2017-10-03 18:36 ` Philipp Stephani @ 2017-10-03 18:52 ` Stefan Monnier 2017-10-08 16:03 ` Philipp Stephani 0 siblings, 1 reply; 24+ messages in thread From: Stefan Monnier @ 2017-10-03 18:52 UTC (permalink / raw) To: emacs-devel > Removing the special treatment would change the behavior. I'd rather have a > time span where developers would get hard errors instead of subtle behavior > changes. I don't think it'll make any real difference: in both cases the old code won't work anymore: I'm hard pressed to think of a scenario where the "subtle" behavior change is subtle enough not to be detected fairly quickly. Stefan ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH] Raise an error when detecting old-style backquotes. 2017-10-03 18:52 ` Stefan Monnier @ 2017-10-08 16:03 ` Philipp Stephani 2017-10-08 19:14 ` Stefan Monnier 0 siblings, 1 reply; 24+ messages in thread From: Philipp Stephani @ 2017-10-08 16:03 UTC (permalink / raw) To: Stefan Monnier, emacs-devel [-- Attachment #1: Type: text/plain, Size: 625 bytes --] Stefan Monnier <monnier@iro.umontreal.ca> schrieb am Di., 3. Okt. 2017 um 20:52 Uhr: > > Removing the special treatment would change the behavior. I'd rather > have a > > time span where developers would get hard errors instead of subtle > behavior > > changes. > > I don't think it'll make any real difference: in both cases the old code > won't work anymore: I'm hard pressed to think of a scenario where the > "subtle" behavior change is subtle enough not to be detected > fairly quickly. > > For example, code such as '(` foo) would change behavior. Whether a certain list is nested or not is definitely subtle enough. [-- Attachment #2: Type: text/html, Size: 972 bytes --] ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH] Raise an error when detecting old-style backquotes. 2017-10-08 16:03 ` Philipp Stephani @ 2017-10-08 19:14 ` Stefan Monnier 0 siblings, 0 replies; 24+ messages in thread From: Stefan Monnier @ 2017-10-08 19:14 UTC (permalink / raw) To: emacs-devel >> I don't think it'll make any real difference: in both cases the old code >> won't work anymore: I'm hard pressed to think of a scenario where the >> "subtle" behavior change is subtle enough not to be detected >> fairly quickly. > For example, code such as '(` foo) would change behavior. Whether a certain > list is nested or not is definitely subtle enough. But this is not a complete scenario. You'd need to give additional context: - why is there '(` foo) in the source code (it seems already contrived)? - How is the result used (it's important that the result be used in a way which works differently but without signaling an error in both cases)? Stefan ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH] Raise an error when detecting old-style backquotes. 2017-10-03 17:43 ` Stefan Monnier 2017-10-03 18:36 ` Philipp Stephani @ 2017-10-04 14:12 ` Richard Stallman 2017-10-04 15:30 ` Stefan Monnier 1 sibling, 1 reply; 24+ messages in thread From: Richard Stallman @ 2017-10-04 14:12 UTC (permalink / raw) To: Stefan Monnier; +Cc: emacs-devel [[[ To any NSA and FBI agents reading my email: please consider ]]] [[[ whether defending the US Constitution against all enemies, ]]] [[[ foreign or domestic, requires you to follow Snowden's example. ]]] > > * src/lread.c (Fload): Don’t use record_unwind_protect to warn about > > old-style backquotes any more. They now generate a hard error. > Not sure what's the benefit of raising a hard error, over just removing > the obsolete feature altogether. The hard error could have a specific error message to inform users of where to look to find out what to change. -- Dr Richard Stallman President, Free Software Foundation (gnu.org, fsf.org) Internet Hall-of-Famer (internethalloffame.org) Skype: No way! See stallman.org/skype.html. ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH] Raise an error when detecting old-style backquotes. 2017-10-04 14:12 ` Richard Stallman @ 2017-10-04 15:30 ` Stefan Monnier 2017-10-05 7:03 ` Richard Stallman 0 siblings, 1 reply; 24+ messages in thread From: Stefan Monnier @ 2017-10-04 15:30 UTC (permalink / raw) To: Richard Stallman; +Cc: emacs-devel > The hard error could have a specific error message > to inform users of where to look to find out what to change. We've had such a specific warning (instead of error) for the last 10 years. Stefan ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH] Raise an error when detecting old-style backquotes. 2017-10-04 15:30 ` Stefan Monnier @ 2017-10-05 7:03 ` Richard Stallman 2017-10-06 4:04 ` Stefan Monnier 0 siblings, 1 reply; 24+ messages in thread From: Richard Stallman @ 2017-10-05 7:03 UTC (permalink / raw) To: Stefan Monnier; +Cc: emacs-devel [[[ To any NSA and FBI agents reading my email: please consider ]]] [[[ whether defending the US Constitution against all enemies, ]]] [[[ foreign or domestic, requires you to follow Snowden's example. ]]] > > The hard error could have a specific error message > > to inform users of where to look to find out what to change. > We've had such a specific warning (instead of error) for the last > 10 years. I suggest a specific error message as the next step in deprecation. -- Dr Richard Stallman President, Free Software Foundation (gnu.org, fsf.org) Internet Hall-of-Famer (internethalloffame.org) Skype: No way! See stallman.org/skype.html. ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH] Raise an error when detecting old-style backquotes. 2017-10-05 7:03 ` Richard Stallman @ 2017-10-06 4:04 ` Stefan Monnier 2017-10-06 15:17 ` Richard Stallman 0 siblings, 1 reply; 24+ messages in thread From: Stefan Monnier @ 2017-10-06 4:04 UTC (permalink / raw) To: emacs-devel >> > The hard error could have a specific error message >> > to inform users of where to look to find out what to change. >> We've had such a specific warning (instead of error) for the last >> 10 years. > I suggest a specific error message as the next step in deprecation. We've never done that when removing obsolete features. Why should this be different? Stefan ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: [PATCH] Raise an error when detecting old-style backquotes. 2017-10-06 4:04 ` Stefan Monnier @ 2017-10-06 15:17 ` Richard Stallman 0 siblings, 0 replies; 24+ messages in thread From: Richard Stallman @ 2017-10-06 15:17 UTC (permalink / raw) To: Stefan Monnier; +Cc: emacs-devel [[[ To any NSA and FBI agents reading my email: please consider ]]] [[[ whether defending the US Constitution against all enemies, ]]] [[[ foreign or domestic, requires you to follow Snowden's example. ]]] > We've never done that when removing obsolete features. > Why should this be different? I'm not insisting it should be different. I just think that, given that this was a very general feature that changed in a grossly incompatible way, it is worth keeping a little code to make a specific error message. -- Dr Richard Stallman President, Free Software Foundation (gnu.org, fsf.org) Internet Hall-of-Famer (internethalloffame.org) Skype: No way! See stallman.org/skype.html. ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: Old-style backquotes 2017-10-03 14:12 ` Paul Eggert 2017-10-03 14:17 ` [PATCH] Raise an error when detecting old-style backquotes Philipp Stephani @ 2017-10-03 15:02 ` Eli Zaretskii 2017-10-08 14:58 ` Philipp Stephani 1 sibling, 1 reply; 24+ messages in thread From: Eli Zaretskii @ 2017-10-03 15:02 UTC (permalink / raw) To: Paul Eggert; +Cc: p.stephani2, emacs-devel > From: Paul Eggert <eggert@cs.ucla.edu> > Date: Tue, 3 Oct 2017 07:12:25 -0700 > > On 10/03/2017 06:51 AM, Philipp Stephani wrote: > > old-style backquotes were deprecated ten years ago > > (1d06469794a66d6c8b424e6f17da029ebc5bb295). Is it time to finally turn > > them into errors for Emacs 26, and remove them in Emacs 27? > > Ten years is long enough, so I'd say it's time. On master, please (unless there are objections). ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: Old-style backquotes 2017-10-03 15:02 ` Old-style backquotes Eli Zaretskii @ 2017-10-08 14:58 ` Philipp Stephani 2017-10-08 16:05 ` Eli Zaretskii 0 siblings, 1 reply; 24+ messages in thread From: Philipp Stephani @ 2017-10-08 14:58 UTC (permalink / raw) To: Eli Zaretskii, Paul Eggert; +Cc: emacs-devel [-- Attachment #1.1: Type: text/plain, Size: 545 bytes --] Eli Zaretskii <eliz@gnu.org> schrieb am Di., 3. Okt. 2017 um 17:02 Uhr: > > From: Paul Eggert <eggert@cs.ucla.edu> > > Date: Tue, 3 Oct 2017 07:12:25 -0700 > > > > On 10/03/2017 06:51 AM, Philipp Stephani wrote: > > > old-style backquotes were deprecated ten years ago > > > (1d06469794a66d6c8b424e6f17da029ebc5bb295). Is it time to finally turn > > > them into errors for Emacs 26, and remove them in Emacs 27? > > > > Ten years is long enough, so I'd say it's time. > > On master, please (unless there are objections). > OK, here's a patch. [-- Attachment #1.2: Type: text/html, Size: 952 bytes --] [-- Attachment #2: 0001-Raise-an-error-when-detecting-old-style-backquotes.txt --] [-- Type: text/plain, Size: 4898 bytes --] From 96d9780bf072772f3be289b4c344d741b9ce3249 Mon Sep 17 00:00:00 2001 From: Philipp Stephani <phst@google.com> Date: Tue, 3 Oct 2017 16:14:54 +0200 Subject: [PATCH] Raise an error when detecting old-style backquotes. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. * test/src/lread-tests.el (lread-tests--old-style-backquotes): Adapt unit test. --- src/lread.c | 32 ++++++-------------------------- test/src/lread-tests.el | 10 +++++----- 2 files changed, 11 insertions(+), 31 deletions(-) diff --git a/src/lread.c b/src/lread.c index 6bc93b1481..44953baa77 100644 --- a/src/lread.c +++ b/src/lread.c @@ -1003,14 +1003,11 @@ load_error_handler (Lisp_Object data) return Qnil; } -static void -load_warn_old_style_backquotes (Lisp_Object file) +static _Noreturn void +load_error_old_style_backquotes (void) { - if (!NILP (Vlread_old_style_backquotes)) - { - AUTO_STRING (format, "Loading `%s': old-style backquotes detected!"); - CALLN (Fmessage, format, file); - } + AUTO_STRING (format, "Loading `%s': old-style backquotes detected!"); + xsignal1 (Qerror, CALLN (Fformat_message, format, Vload_file_name)); } static void @@ -1282,10 +1279,6 @@ Return t if the file exists and loads successfully. */) version = -1; - /* Check for the presence of old-style quotes and warn about them. */ - 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 about them. */ specbind (Qlread_unescaped_character_literals, Qnil); @@ -3178,10 +3171,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) first_in_list exception (old-style can still be obtained via "(\`" anyway). */ if (!new_backquote_flag && first_in_list && next_char == ' ') - { - Vlread_old_style_backquotes = Qt; - goto default_label; - } + load_error_old_style_backquotes (); else { Lisp_Object value; @@ -3232,10 +3222,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) return list2 (comma_type, value); } else - { - Vlread_old_style_backquotes = Qt; - goto default_label; - } + load_error_old_style_backquotes (); } case '?': { @@ -3423,7 +3410,6 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) row. */ FALLTHROUGH; default: - default_label: if (c <= 040) goto retry; if (c == NO_BREAK_SPACE) goto retry; @@ -4996,12 +4982,6 @@ 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 ("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, doc: /* List of deprecated unescaped character literals encountered by `read'. diff --git a/test/src/lread-tests.el b/test/src/lread-tests.el index ac730b4f00..241cebb6b1 100644 --- a/test/src/lread-tests.el +++ b/test/src/lread-tests.el @@ -173,13 +173,13 @@ lread-tests--last-message (should (string-suffix-p "/somelib.el" (caar load-history))))) (ert-deftest lread-tests--old-style-backquotes () - "Check that loading warns about old-style backquotes." + "Check that loading doesn’t accept 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!"))))) + (let ((data (should-error (load file-name nil :nomessage :nosuffix)))) + (should (equal (cdr data) + (list (concat (format-message "Loading `%s': " file-name) + "old-style backquotes detected!"))))))) (ert-deftest lread-lread--substitute-object-in-subtree () (let ((x (cons 0 1))) -- 2.14.2 ^ permalink raw reply related [flat|nested] 24+ messages in thread
* Re: Old-style backquotes 2017-10-08 14:58 ` Philipp Stephani @ 2017-10-08 16:05 ` Eli Zaretskii 2017-10-08 16:09 ` Eli Zaretskii 0 siblings, 1 reply; 24+ messages in thread From: Eli Zaretskii @ 2017-10-08 16:05 UTC (permalink / raw) To: Philipp Stephani; +Cc: eggert, emacs-devel > From: Philipp Stephani <p.stephani2@gmail.com> > Date: Sun, 08 Oct 2017 14:58:45 +0000 > Cc: emacs-devel@gnu.org > > OK, here's a patch. Thanks, a few minor comments: > @@ -3178,10 +3171,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) > first_in_list exception (old-style can still be obtained via > "(\`" anyway). */ > if (!new_backquote_flag && first_in_list && next_char == ' ') > - { > - Vlread_old_style_backquotes = Qt; > - goto default_label; > - } > + load_error_old_style_backquotes (); Here (and elsewhere) the indentation should be fixed to be in line with our style. > --- a/test/src/lread-tests.el > +++ b/test/src/lread-tests.el > @@ -173,13 +173,13 @@ lread-tests--last-message > (should (string-suffix-p "/somelib.el" (caar load-history))))) > > (ert-deftest lread-tests--old-style-backquotes () > - "Check that loading warns about old-style backquotes." > + "Check that loading doesn’t accept old-style backquotes." Please don't use literal curved quotes in doc strings and message text, they will be transformed (by default) when displayed. ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: Old-style backquotes 2017-10-08 16:05 ` Eli Zaretskii @ 2017-10-08 16:09 ` Eli Zaretskii 2017-10-08 16:25 ` Philipp Stephani 0 siblings, 1 reply; 24+ messages in thread From: Eli Zaretskii @ 2017-10-08 16:09 UTC (permalink / raw) To: p.stephani2; +Cc: eggert, emacs-devel > Date: Sun, 08 Oct 2017 19:05:53 +0300 > From: Eli Zaretskii <eliz@gnu.org> > Cc: eggert@cs.ucla.edu, emacs-devel@gnu.org > > > From: Philipp Stephani <p.stephani2@gmail.com> > > Date: Sun, 08 Oct 2017 14:58:45 +0000 > > Cc: emacs-devel@gnu.org > > > > OK, here's a patch. > > Thanks, a few minor comments: Oh, and one more: this needs a NEWS entry. Thanks. ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: Old-style backquotes 2017-10-08 16:09 ` Eli Zaretskii @ 2017-10-08 16:25 ` Philipp Stephani 2017-10-08 16:38 ` Eli Zaretskii 0 siblings, 1 reply; 24+ messages in thread From: Philipp Stephani @ 2017-10-08 16:25 UTC (permalink / raw) To: Eli Zaretskii; +Cc: eggert, emacs-devel [-- Attachment #1.1: Type: text/plain, Size: 514 bytes --] Eli Zaretskii <eliz@gnu.org> schrieb am So., 8. Okt. 2017 um 18:09 Uhr: > > Date: Sun, 08 Oct 2017 19:05:53 +0300 > > From: Eli Zaretskii <eliz@gnu.org> > > Cc: eggert@cs.ucla.edu, emacs-devel@gnu.org > > > > > From: Philipp Stephani <p.stephani2@gmail.com> > > > Date: Sun, 08 Oct 2017 14:58:45 +0000 > > > Cc: emacs-devel@gnu.org > > > > > > OK, here's a patch. > > > > Thanks, a few minor comments: > > Oh, and one more: this needs a NEWS entry. > > Here's a new patch that also fixes the byte compiler tests. [-- Attachment #1.2: Type: text/html, Size: 1169 bytes --] [-- Attachment #2: 0001-Raise-an-error-when-detecting-old-style-backquotes.txt --] [-- Type: text/plain, Size: 8305 bytes --] From a651664039cfe7794920abbd20a17dc62d26f1a5 Mon Sep 17 00:00:00 2001 From: Philipp Stephani <phst@google.com> Date: Tue, 3 Oct 2017 16:14:54 +0200 Subject: [PATCH] Raise an error when detecting old-style backquotes. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 | 3 +++ lisp/emacs-lisp/bytecomp.el | 8 +------- src/lread.c | 32 ++++++-------------------------- test/lisp/emacs-lisp/bytecomp-tests.el | 11 +++-------- test/src/lread-tests.el | 10 +++++----- 5 files changed, 18 insertions(+), 46 deletions(-) diff --git a/etc/NEWS b/etc/NEWS index f961928ffd..75a98d1500 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -77,6 +77,9 @@ them through 'format' first. Even that is discouraged: for ElDoc support, you should set 'eldoc-documentation-function' instead of calling 'eldoc-message' directly. +** Old-style backquotes now generate an error. They have been +generating warnings for a decade. + \f * Lisp Changes in Emacs 27.1 diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 590db570c5..45fa188d6c 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -2048,14 +2048,8 @@ byte-compile-from-buffer (not (eobp))) (setq byte-compile-read-position (point) byte-compile-last-position byte-compile-read-position) - (let* ((lread--old-style-backquotes nil) - (lread--unescaped-character-literals nil) + (let* ((lread--unescaped-character-literals nil) (form (read inbuffer))) - ;; Warn about the use of 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.")) (when lread--unescaped-character-literals (byte-compile-warn "unescaped character literals %s detected!" diff --git a/src/lread.c b/src/lread.c index 6bc93b1481..c073fc4ce6 100644 --- a/src/lread.c +++ b/src/lread.c @@ -1003,14 +1003,11 @@ load_error_handler (Lisp_Object data) return Qnil; } -static void -load_warn_old_style_backquotes (Lisp_Object file) +static _Noreturn void +load_error_old_style_backquotes (void) { - if (!NILP (Vlread_old_style_backquotes)) - { - AUTO_STRING (format, "Loading `%s': old-style backquotes detected!"); - CALLN (Fmessage, format, file); - } + AUTO_STRING (format, "Loading `%s': old-style backquotes detected!"); + xsignal1 (Qerror, CALLN (Fformat_message, format, Vload_file_name)); } static void @@ -1282,10 +1279,6 @@ Return t if the file exists and loads successfully. */) version = -1; - /* Check for the presence of old-style quotes and warn about them. */ - 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 about them. */ specbind (Qlread_unescaped_character_literals, Qnil); @@ -3178,10 +3171,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) first_in_list exception (old-style can still be obtained via "(\`" anyway). */ if (!new_backquote_flag && first_in_list && next_char == ' ') - { - Vlread_old_style_backquotes = Qt; - goto default_label; - } + load_error_old_style_backquotes (); else { Lisp_Object value; @@ -3232,10 +3222,7 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) return list2 (comma_type, value); } else - { - Vlread_old_style_backquotes = Qt; - goto default_label; - } + load_error_old_style_backquotes (); } case '?': { @@ -3423,7 +3410,6 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list) row. */ FALLTHROUGH; default: - default_label: if (c <= 040) goto retry; if (c == NO_BREAK_SPACE) goto retry; @@ -4996,12 +4982,6 @@ 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 ("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, 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 30d2a4753c..1f85c26978 100644 --- a/test/lisp/emacs-lisp/bytecomp-tests.el +++ b/test/lisp/emacs-lisp/bytecomp-tests.el @@ -534,23 +534,18 @@ bytecomp-tests--with-temp-file (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)))) + (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."))))))) + '("Loading `nil': old-style backquotes detected!"))))))) (ert-deftest bytecomp-tests-function-put () "Check `function-put' operates during compilation." - (should (boundp 'lread--old-style-backquotes)) (bytecomp-tests--with-temp-file source (dolist (form '((function-put 'bytecomp-tests--foo 'foo 1) (function-put 'bytecomp-tests--foo 'bar 2) diff --git a/test/src/lread-tests.el b/test/src/lread-tests.el index ac730b4f00..3f41982eba 100644 --- a/test/src/lread-tests.el +++ b/test/src/lread-tests.el @@ -173,13 +173,13 @@ lread-tests--last-message (should (string-suffix-p "/somelib.el" (caar load-history))))) (ert-deftest lread-tests--old-style-backquotes () - "Check that loading warns about old-style backquotes." + "Check that loading doesn't accept 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!"))))) + (let ((data (should-error (load file-name nil :nomessage :nosuffix)))) + (should (equal (cdr data) + (list (concat (format-message "Loading `%s': " file-name) + "old-style backquotes detected!"))))))) (ert-deftest lread-lread--substitute-object-in-subtree () (let ((x (cons 0 1))) -- 2.14.2 ^ permalink raw reply related [flat|nested] 24+ messages in thread
* Re: Old-style backquotes 2017-10-08 16:25 ` Philipp Stephani @ 2017-10-08 16:38 ` Eli Zaretskii 2017-10-08 16:59 ` Philipp Stephani 0 siblings, 1 reply; 24+ messages in thread From: Eli Zaretskii @ 2017-10-08 16:38 UTC (permalink / raw) To: Philipp Stephani; +Cc: eggert, emacs-devel > From: Philipp Stephani <p.stephani2@gmail.com> > Date: Sun, 08 Oct 2017 16:25:44 +0000 > Cc: eggert@cs.ucla.edu, emacs-devel@gnu.org > > Here's a new patch that also fixes the byte compiler tests. Thanks, LGTM, but please mention the NEWS change in the log message. Also, the log message should quote 'like this', not ‘like this’. ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: Old-style backquotes 2017-10-08 16:38 ` Eli Zaretskii @ 2017-10-08 16:59 ` Philipp Stephani 2017-12-09 20:44 ` Philipp Stephani 0 siblings, 1 reply; 24+ messages in thread From: Philipp Stephani @ 2017-10-08 16:59 UTC (permalink / raw) To: Eli Zaretskii; +Cc: eggert, emacs-devel [-- Attachment #1: Type: text/plain, Size: 487 bytes --] Eli Zaretskii <eliz@gnu.org> schrieb am So., 8. Okt. 2017 um 18:38 Uhr: > > From: Philipp Stephani <p.stephani2@gmail.com> > > Date: Sun, 08 Oct 2017 16:25:44 +0000 > > Cc: eggert@cs.ucla.edu, emacs-devel@gnu.org > > > > Here's a new patch that also fixes the byte compiler tests. > > Thanks, LGTM, but please mention the NEWS change in the log message. > > Also, the log message should quote 'like this', not ‘like this’. > Fixed and pushed as 9613690f6e to master. [-- Attachment #2: Type: text/html, Size: 982 bytes --] ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: Old-style backquotes 2017-10-08 16:59 ` Philipp Stephani @ 2017-12-09 20:44 ` Philipp Stephani 2017-12-09 20:48 ` Alan Mackenzie 0 siblings, 1 reply; 24+ messages in thread From: Philipp Stephani @ 2017-12-09 20:44 UTC (permalink / raw) To: Eli Zaretskii; +Cc: eggert, emacs-devel [-- Attachment #1: Type: text/plain, Size: 681 bytes --] Philipp Stephani <p.stephani2@gmail.com> schrieb am So., 8. Okt. 2017 um 18:59 Uhr: > Eli Zaretskii <eliz@gnu.org> schrieb am So., 8. Okt. 2017 um 18:38 Uhr: > >> > From: Philipp Stephani <p.stephani2@gmail.com> >> > Date: Sun, 08 Oct 2017 16:25:44 +0000 >> > Cc: eggert@cs.ucla.edu, emacs-devel@gnu.org >> > >> > Here's a new patch that also fixes the byte compiler tests. >> >> Thanks, LGTM, but please mention the NEWS change in the log message. >> >> Also, the log message should quote 'like this', not ‘like this’. >> > > Fixed and pushed as 9613690f6e to master. > I've now fixed the Bovine issue and re-pushed this commit as 8b8197235f to master. [-- Attachment #2: Type: text/html, Size: 1489 bytes --] ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: Old-style backquotes 2017-12-09 20:44 ` Philipp Stephani @ 2017-12-09 20:48 ` Alan Mackenzie 2017-12-09 20:58 ` Philipp Stephani 0 siblings, 1 reply; 24+ messages in thread From: Alan Mackenzie @ 2017-12-09 20:48 UTC (permalink / raw) To: Philipp Stephani; +Cc: Eli Zaretskii, eggert, emacs-devel Hello, Philipp. On Sat, Dec 09, 2017 at 20:44:35 +0000, Philipp Stephani wrote: > Philipp Stephani <p.stephani2@gmail.com> schrieb am So., 8. Okt. 2017 um > 18:59 Uhr: > > Eli Zaretskii <eliz@gnu.org> schrieb am So., 8. Okt. 2017 um 18:38 Uhr: > >> > From: Philipp Stephani <p.stephani2@gmail.com> > >> > Date: Sun, 08 Oct 2017 16:25:44 +0000 > >> > Cc: eggert@cs.ucla.edu, emacs-devel@gnu.org > >> > Here's a new patch that also fixes the byte compiler tests. > >> Thanks, LGTM, but please mention the NEWS change in the log message. > >> Also, the log message should quote 'like this', not ‘like this’. > > Fixed and pushed as 9613690f6e to master. > I've now fixed the Bovine issue and re-pushed this commit as 8b8197235f to > master. Just as a matter of interest, I think there are still some old style backquotes in advice.el. In master: find . -name '*.el' | xargs grep -n '(` ' produces: ./emacs-lisp/advice.el:1517:;; (` (list (, x)))) ./emacs-lisp/advice.el:1550:;; (` (progn (print (, x)) . Do these need converting? -- Alan Mackenzie (Nuremberg, Germany). ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: Old-style backquotes 2017-12-09 20:48 ` Alan Mackenzie @ 2017-12-09 20:58 ` Philipp Stephani 2017-12-09 21:05 ` Philipp Stephani 0 siblings, 1 reply; 24+ messages in thread From: Philipp Stephani @ 2017-12-09 20:58 UTC (permalink / raw) To: Alan Mackenzie; +Cc: Eli Zaretskii, eggert, emacs-devel [-- Attachment #1: Type: text/plain, Size: 1397 bytes --] Alan Mackenzie <acm@muc.de> schrieb am Sa., 9. Dez. 2017 um 21:55 Uhr: > Hello, Philipp. > > On Sat, Dec 09, 2017 at 20:44:35 +0000, Philipp Stephani wrote: > > Philipp Stephani <p.stephani2@gmail.com> schrieb am So., 8. Okt. 2017 um > > 18:59 Uhr: > > > > Eli Zaretskii <eliz@gnu.org> schrieb am So., 8. Okt. 2017 um 18:38 > Uhr: > > > >> > From: Philipp Stephani <p.stephani2@gmail.com> > > >> > Date: Sun, 08 Oct 2017 16:25:44 +0000 > > >> > Cc: eggert@cs.ucla.edu, emacs-devel@gnu.org > > > >> > Here's a new patch that also fixes the byte compiler tests. > > > >> Thanks, LGTM, but please mention the NEWS change in the log message. > > > >> Also, the log message should quote 'like this', not ‘like this’. > > > > > Fixed and pushed as 9613690f6e to master. > > > > I've now fixed the Bovine issue and re-pushed this commit as 8b8197235f > to > > master. > > Just as a matter of interest, I think there are still some old style > backquotes in advice.el. In master: > > find . -name '*.el' | xargs grep -n '(` ' > > produces: > > ./emacs-lisp/advice.el:1517:;; (` (list (, x)))) > ./emacs-lisp/advice.el:1550:;; (` (progn (print (, x)) > > . Do these need converting? > > Thanks, compiling didn't catch those because they are in comments. Yes, they should definitely be fixed. Will send a follow-up patch in a second. [-- Attachment #2: Type: text/html, Size: 2178 bytes --] ^ permalink raw reply [flat|nested] 24+ messages in thread
* Re: Old-style backquotes 2017-12-09 20:58 ` Philipp Stephani @ 2017-12-09 21:05 ` Philipp Stephani 0 siblings, 0 replies; 24+ messages in thread From: Philipp Stephani @ 2017-12-09 21:05 UTC (permalink / raw) To: Alan Mackenzie; +Cc: Eli Zaretskii, eggert, emacs-devel [-- Attachment #1: Type: text/plain, Size: 1570 bytes --] Philipp Stephani <p.stephani2@gmail.com> schrieb am Sa., 9. Dez. 2017 um 21:58 Uhr: > Alan Mackenzie <acm@muc.de> schrieb am Sa., 9. Dez. 2017 um 21:55 Uhr: > >> Hello, Philipp. >> >> On Sat, Dec 09, 2017 at 20:44:35 +0000, Philipp Stephani wrote: >> > Philipp Stephani <p.stephani2@gmail.com> schrieb am So., 8. Okt. 2017 >> um >> > 18:59 Uhr: >> >> > > Eli Zaretskii <eliz@gnu.org> schrieb am So., 8. Okt. 2017 um 18:38 >> Uhr: >> >> > >> > From: Philipp Stephani <p.stephani2@gmail.com> >> > >> > Date: Sun, 08 Oct 2017 16:25:44 +0000 >> > >> > Cc: eggert@cs.ucla.edu, emacs-devel@gnu.org >> >> > >> > Here's a new patch that also fixes the byte compiler tests. >> >> > >> Thanks, LGTM, but please mention the NEWS change in the log message. >> >> > >> Also, the log message should quote 'like this', not ‘like this’. >> >> >> > > Fixed and pushed as 9613690f6e to master. >> >> >> > I've now fixed the Bovine issue and re-pushed this commit as 8b8197235f >> to >> > master. >> >> Just as a matter of interest, I think there are still some old style >> backquotes in advice.el. In master: >> >> find . -name '*.el' | xargs grep -n '(` ' >> >> produces: >> >> ./emacs-lisp/advice.el:1517:;; (` (list (, x)))) >> ./emacs-lisp/advice.el:1550:;; (` (progn (print (, x)) >> >> . Do these need converting? >> >> > Thanks, compiling didn't catch those because they are in comments. Yes, > they should definitely be fixed. Will send a follow-up patch in a second. > Fixed in commit ac6ea59830. [-- Attachment #2: Type: text/html, Size: 2638 bytes --] ^ permalink raw reply [flat|nested] 24+ messages in thread
end of thread, other threads:[~2017-12-09 21:05 UTC | newest] Thread overview: 24+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2017-10-03 13:51 Old-style backquotes Philipp Stephani 2017-10-03 14:12 ` Paul Eggert 2017-10-03 14:17 ` [PATCH] Raise an error when detecting old-style backquotes Philipp Stephani 2017-10-03 17:43 ` Stefan Monnier 2017-10-03 18:36 ` Philipp Stephani 2017-10-03 18:52 ` Stefan Monnier 2017-10-08 16:03 ` Philipp Stephani 2017-10-08 19:14 ` Stefan Monnier 2017-10-04 14:12 ` Richard Stallman 2017-10-04 15:30 ` Stefan Monnier 2017-10-05 7:03 ` Richard Stallman 2017-10-06 4:04 ` Stefan Monnier 2017-10-06 15:17 ` Richard Stallman 2017-10-03 15:02 ` Old-style backquotes Eli Zaretskii 2017-10-08 14:58 ` Philipp Stephani 2017-10-08 16:05 ` Eli Zaretskii 2017-10-08 16:09 ` Eli Zaretskii 2017-10-08 16:25 ` Philipp Stephani 2017-10-08 16:38 ` Eli Zaretskii 2017-10-08 16:59 ` Philipp Stephani 2017-12-09 20:44 ` Philipp Stephani 2017-12-09 20:48 ` Alan Mackenzie 2017-12-09 20:58 ` Philipp Stephani 2017-12-09 21:05 ` 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).