all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Lars Ingebrigtsen <larsi@gnus.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Stefan Kangas <stefan@marxist.se>,
	Thibault Polge <thibault@thb.lt>,
	Andreas Schwab <schwab@linux-m68k.org>,
	38872@debbugs.gnu.org
Subject: bug#38872: 27.0.50; Keywords can be let-bound
Date: Sun, 20 Sep 2020 12:36:12 +0200	[thread overview]
Message-ID: <87zh5kpwf7.fsf@gnus.org> (raw)
In-Reply-To: <jwv36cenpi3.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Fri, 17 Jan 2020 09:11:37 -0500")

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>>> I think that should use the same condition as set_internal, so that (let
>>> ((:k :k))) still works.
>> Thanks, I forgot about that case.
>
> We should also look at what the byte-compiler does with this code.
>
> I get the impression that the best/simplest course of action is to set
> `declared_special` to `true` for keywords.

So this would be just:

diff --git a/src/lread.c b/src/lread.c
index 8064bf4d0e..f465b451a9 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -4104,6 +4104,7 @@ intern_sym (Lisp_Object sym, Lisp_Object obarray, Lisp_Object index)
     {
       make_symbol_constant (sym);
       XSYMBOL (sym)->u.s.redirect = SYMBOL_PLAINVAL;
+      XSYMBOL (sym)->u.s.declared_special = true;
       SET_SYMBOL_VAL (XSYMBOL (sym), sym);
     }
 
Which seems to work?  "make check" still works after doing this, and the
test case now fails like it should do.  Some more context below.

But I have to admit I don't understand why this fixes the test case.  :-/

intern_sym (Lisp_Object sym, Lisp_Object obarray, Lisp_Object index)
{
  Lisp_Object *ptr;

  XSYMBOL (sym)->u.s.interned = (EQ (obarray, initial_obarray)
				 ? SYMBOL_INTERNED_IN_INITIAL_OBARRAY
				 : SYMBOL_INTERNED);

  if (SREF (SYMBOL_NAME (sym), 0) == ':' && EQ (obarray, initial_obarray))
    {
      make_symbol_constant (sym);
      XSYMBOL (sym)->u.s.redirect = SYMBOL_PLAINVAL;
      XSYMBOL (sym)->u.s.declared_special = true;
      SET_SYMBOL_VAL (XSYMBOL (sym), sym);
    }



-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





  reply	other threads:[~2020-09-20 10:36 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-02 17:14 bug#38872: 27.0.50; Keywords can be let-bound Thibault Polge
2020-01-16 19:52 ` Stefan Kangas
2020-01-16 20:06   ` Andreas Schwab
2020-01-17  7:47     ` Eli Zaretskii
     [not found]     ` <87wo9r2fi6.fsf@marxist.se>
2020-01-17 14:11       ` Stefan Monnier
2020-09-20 10:36         ` Lars Ingebrigtsen [this message]
2020-09-20 10:55           ` Eli Zaretskii
2020-09-20 10:57             ` Lars Ingebrigtsen
2020-09-20 12:53           ` Stefan Monnier
2020-09-20 19:31             ` Lars Ingebrigtsen

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=87zh5kpwf7.fsf@gnus.org \
    --to=larsi@gnus.org \
    --cc=38872@debbugs.gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=schwab@linux-m68k.org \
    --cc=stefan@marxist.se \
    --cc=thibault@thb.lt \
    /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.