unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "Mattias Engdegård" <mattiase@acm.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 39373@debbugs.gnu.org
Subject: bug#39373: 27.0.50; [PATCH] mode-local-print-bindings broken with lexical-binding
Date: Fri, 31 Jan 2020 21:51:48 +0100	[thread overview]
Message-ID: <8EF7D3C6-041D-493F-859B-55D8D35AF588@acm.org> (raw)
In-Reply-To: <83imkrjrvh.fsf@gnu.org>

31 jan. 2020 kl. 21.25 skrev Eli Zaretskii <eliz@gnu.org>:

> That's not the "usual" way of fixing problems with lexical-binding,
> and it isn't immediately clear to me why that fixes the problem.

'add-to-list' doesn't work on lexical variables because it's a plain function taking the variable symbol as argument. 'push' works on lexical variables since it is a macro that expands to direct variable reference and setq. I should perhaps have included this in the commit message.

Happily, Emacs provides generalised variable support for 'if' and 'cons', so that they can be used as target for 'push'.

We could sink the pushes to the leaves of the condition tree, if you prefer:

(cond ((get s 'mode-variable-flag)
       (if (get s 'constant-flag) (push s mc) (push s mv)))
      ((get s 'override-flag)
       (if (get s 'constant-flag) (push s fo) (push s ov)))
      (t (push s us)))

Not as elegant or concise, but does not rely on if and cond as GVs in push.






  reply	other threads:[~2020-01-31 20:51 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-31 17:08 bug#39373: 27.0.50; [PATCH] mode-local-print-bindings broken with lexical-binding Mattias Engdegård
2020-01-31 19:27 ` Eli Zaretskii
2020-01-31 19:38   ` Mattias Engdegård
2020-01-31 20:25     ` Eli Zaretskii
2020-01-31 20:51       ` Mattias Engdegård [this message]
2020-02-01  7:48         ` Eli Zaretskii
2020-02-01 15:53           ` Drew Adams
2020-02-01 19:24           ` Mattias Engdegård
2020-02-01 19:28             ` Eli Zaretskii
2020-02-01 20:15             ` Stefan Monnier
2020-02-01 21:40               ` Mattias Engdegård
2020-02-02  3:31                 ` Eli Zaretskii
2020-02-02 11:58                   ` Mattias Engdegård
2020-02-02 13:55                     ` Stefan Monnier
2020-02-02 14:14                       ` Mattias Engdegård
2020-08-09 11:39                         ` Lars Ingebrigtsen
2020-08-09 13:28                           ` Mattias Engdegård
2020-08-09 19:42                             ` 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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=8EF7D3C6-041D-493F-859B-55D8D35AF588@acm.org \
    --to=mattiase@acm.org \
    --cc=39373@debbugs.gnu.org \
    --cc=eliz@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 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).