Subject: Re: bug#72414: 29.4; use-package :defer keyword does not honor ":defer nil"

From: John Wiegley <[email-masked]>
Date: Fri, 02 Aug 2024 15:32:07 -0700

>>>>> Eli Zaretskii <[email-masked]> writes:

>> The way the code above uses plist-member doesn't match the
>> documentation.  The test looks for the simple presence of a :defer
>> key/value, and doesn't distinguish between any of the possible values:
>> t, nil, or an integer.
>> 
>> Replacing plist-member with plist-get should fix the problem.  A ":defer
>> nil" would produce the same nil value as a missing :defer.

> Thanks for the report and the analysis.
>
> John, any comments or suggestions about this?

This sounds like a very good analysis, and I’m so glad you caught this. Yes,
it shouldn’t just be a plist membership test; it should lookup the member in
the plist AND if it’s present and non-nil, then the truth of the condition
should be established.

So, from:

    (when (and (not (plist-member args :load))
               (not (plist-member args :defer))
               (not (plist-member args :no-require)))
      (setq args (append args `(:load (,name)))))

to:

    (when (and (not (plist-get args :load))
               (not (plist-get args :defer))
               (not (plist-get args :no-require)))
      (setq args (append args `(:load (,name)))))

-- 
John Wiegley                  GPG fingerprint = 4710 CF98 AF9B 327B B80F
http://newartisans.com                          60E1 46C4 BD1A 7AC1 4BA2