all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: emacs-devel@gnu.org
Subject: Re: master 9613690: Raise an error when detecting old-style backquotes.
Date: Mon, 09 Oct 2017 21:19:28 -0400	[thread overview]
Message-ID: <jwvbmlf952n.fsf-monnier+gmane.emacs.devel@gnu.org> (raw)
In-Reply-To: CAP-RRPtAzXLb8R9TetWoENi2TqWj3Bo255okffsO1HGwr9R3fQ@mail.gmail.com

> I've reverted the commit, but this should really be fixed. Apparently
> Bovine generates incorrect code.

Bovine uses the Lisp reader to `read` things like "( ,@$2 )" and "( foo
,$1 (car ,@$2) )".  AFAICT it was designed for the old-style unquotes, but
it's been tweaked to work correctly when those commas are treated as
new-style unquotes.

The patch below seems to work around this problem.  Of course, as
mentioned in another email, just always interpreting those unquotes as
new-style works just as well (and with cleaner semantics).


        Stefan


diff --git a/src/lread.c b/src/lread.c
index c073fc4ce6..75c7e3ee55 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -2667,13 +2667,17 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list)
 {
   int c;
   bool uninterned_symbol = false;
+  bool went_through_retry = false;
   bool multibyte;
   char stackbuf[MAX_ALLOCA];
   current_thread->stack_top = stackbuf;
 
   *pch = 0;
 
+  goto skipretry;
  retry:
+  went_through_retry = true;
+ skipretry:
 
   c = READCHAR_REPORT_MULTIBYTE (&multibyte);
   if (c < 0)
@@ -3202,6 +3206,9 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list)
 	   of a list.  */
 	if (new_backquote_flag
 	    || !first_in_list
+            /* If there was some separation (space, comment, ....) between the
+               `(` and the `,`, we consider this is a new-style unquote.  */
+            || went_through_retry
 	    || (next_char != ' ' && next_char != '@'))
 	  {
 	    Lisp_Object comma_type = Qnil;




      reply	other threads:[~2017-10-10  1:19 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20171008165905.14025.63605@vcs0.savannah.gnu.org>
     [not found] ` <20171008165907.42229201F3@vcs0.savannah.gnu.org>
2017-10-09 11:56   ` master 9613690: Raise an error when detecting old-style backquotes Mark Oteiza
2017-10-09 14:09     ` Philipp Stephani
2017-10-10  1:19       ` Stefan Monnier [this message]

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=jwvbmlf952n.fsf-monnier+gmane.emacs.devel@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --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.