unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Ted Zlatanov <tzz@lifelogs.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: Gnus using lexical-binding
Date: Wed, 10 Feb 2021 10:24:18 +0000	[thread overview]
Message-ID: <tuqkusod.fsf@lifelogs.com> (raw)
In-Reply-To: <jwv5z32t85n.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Mon, 08 Feb 2021 19:10:48 -0500")

On Mon, 08 Feb 2021 19:10:48 -0500 Stefan Monnier <monnier@iro.umontreal.ca> wrote: 

>> The confusing thing here is that the eval lexical environment
>> is correct.

SM> It's correct but it's lexical, so those vars can't be seen from functions
SM> called from `gnus-topic-line-format-spec`.

I looked through (info "(elisp) Lexical Binding") and I think I
understand the issue better. Thank you for fixing it. I confirmed it's
all clear.

SM> I installed the patch below which should sadly fix it,

I have some (probably dumb) suggestions.

The fix and the whole pre-existing Gnus "user defines special function"
mechanism feels very magical. Could we instead define a standard way of
calling these custom user-defined functions in Gnus, passing them an
explicit alist or plist of special properties? That would also make it
easier from within the function to check what's passed down, and
probably remove some complex code in the long run.

The code that calls them today could check their arity and if it's 1
(current call signature), warn and do the workaround. If it's 2, pass
the alist or plist with no workarounds.

Another way may be to provide a special macro to define these functions
in a backwards-compatible way. If they have not been defined with the
macro, warn and use the workaround. Otherwise, pass them the special
values.

...and yet another way may be a new escape char in the format spec for
the new style functions with 2 arguments. Users can switch to it when
they are ready, and the old escape char gets deprecated.

I hope that's useful.
Ted



  reply	other threads:[~2021-02-10 10:24 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-29 23:11 Gnus using lexical-binding Stefan Monnier
2021-01-30  6:34 ` Lars Ingebrigtsen
2021-01-30  8:35 ` Eli Zaretskii
2021-01-30 13:43   ` Stefan Kangas
2021-01-30 13:52     ` Eli Zaretskii
2021-01-30 14:08       ` Eli Zaretskii
2021-01-30 15:24     ` Stefan Monnier
2021-01-30 15:07 ` Basil L. Contovounesios
2021-01-30 17:40   ` Stefan Monnier
2021-02-08 19:10     ` Ted Zlatanov
2021-02-09  0:10       ` Stefan Monnier
2021-02-10 10:24         ` Ted Zlatanov [this message]
2021-02-10 13:53           ` Stefan Monnier
2021-02-10 19:05           ` Lars Ingebrigtsen
2021-01-30 16:10 ` Andy Moreton
2021-01-30 17:35   ` Stefan Monnier
2021-01-30 18:00     ` Andy Moreton
2021-01-30 18:53       ` Stefan Monnier
2021-01-30 23:23         ` Andy Moreton
2021-01-31  0:06           ` Stefan Monnier
2021-01-31  0:46             ` Andy Moreton
2021-01-31 13:34             ` Basil L. Contovounesios
2021-02-02 18:17             ` Eric Abrahamsen
2021-02-02 19:40               ` Stefan Monnier
2021-02-02 20:31                 ` Eric Abrahamsen
2021-01-31  9:13 ` David Engster
2021-01-31 22:43   ` Stefan Monnier

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=tuqkusod.fsf@lifelogs.com \
    --to=tzz@lifelogs.com \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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).