all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Philipp Stephani <p.stephani2@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>, Paul Eggert <eggert@cs.ucla.edu>
Cc: emacs-devel@gnu.org
Subject: Re: Old-style backquotes
Date: Sun, 08 Oct 2017 14:58:45 +0000	[thread overview]
Message-ID: <CAArVCkRBKwyA9MsNPbwVxpS8g5NP3JedD0CWw=PjZtVn+8gm+g@mail.gmail.com> (raw)
In-Reply-To: <83h8vg1dhy.fsf@gnu.org>


[-- 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


  reply	other threads:[~2017-10-08 14:58 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAArVCkRBKwyA9MsNPbwVxpS8g5NP3JedD0CWw=PjZtVn+8gm+g@mail.gmail.com' \
    --to=p.stephani2@gmail.com \
    --cc=eggert@cs.ucla.edu \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.