Subject: bug#60418: [PATCH] Add :vc keyword to use-package

From: Tony Zorman <[email-masked]>
Date: Mon, 24 Apr 2023 14:36:57 +0200

On Sun, Apr 23 2023 12:35, Philip Kaludercic wrote:
> Tony Zorman <[email-masked]> writes:
>
>> On Sat, Apr 22 2023 11:32, Philip Kaludercic wrote:
>>> (Sorry for all the back and forth, I hope you understand that this is
>>> just to get stuff right and not for my own sake of being pedantic.  If
>>> you don't have the time, I can also make the changes I'd just like to
>>> hear your opinions.)
>>
>> No, I totally get it. Getting this stuff right the first time is much
>> easier than going back and trying to fix it afterwards.
>
> OK, great.  I just didn't want to make this seem like a ritual GNU thing ^^.

Well, maybe a little bit of that as well :)

>>> On my machine, these tests appear to fail?  Also, it would probably be
>>> useful to document them (at leat the ...-1 to ...-5 ones) so that a
>>> failure can be more easily understood.
>>
>> They don't fail for me—maybe I'm running the tests wrong? So far, I've
>> done so interactively by evaluating the whole buffer and then running
>> `M-x ert'. The -1…-5 tests just test the macro expansion, so e.g.
>>
>>     (ert-deftest use-package-test/:vc-1 ()
>>       (match-expansion
>>        (use-package foo :vc (:url "bar"))
>>        '(use-package-vc-install '(foo (:url "bar") :last-release) nil)))
>>
>> would test if the first argument to `match-expansion' actually expands
>> into the second one or not (which I guess explains why the error
>> messages are a bit hard to understand).   
>
> But that isn't the case, or am I mistaken?  The use-package form expands
> to a lot mroe than just (use-package-vc-install ...)?

I think a combination of 'use-package-expand-minimally' and
'macroexpand-1' does shrink it down to essentially just that.

Oh, but while writing this I think I found the issue—global variables,
as always. I have 'use-package-always-ensure' and
'use-package-always-defer' set, which obviously influences macro
expansion. The bottom line is that most examples need an extra '(require
'foo nil nil)' added, nothing too major. I'll fix that, thanks for
helping me figure it out!

-- 
Tony Zorman | https://tony-zorman.com/