emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Gnus using lexical-binding


From: Ted Zlatanov
Subject: Re: Gnus using lexical-binding
Date: Wed, 10 Feb 2021 10:24:18 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

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 via email to

[Prev in Thread] Current Thread [Next in Thread]