[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Execute code in use-package
From: |
John Mastro |
Subject: |
Re: Execute code in use-package |
Date: |
Fri, 16 Dec 2016 12:11:50 -0800 |
Joe Riel <joer@san.rr.com> wrote:
>> This should work:
>>
>> (use-package mds
>> :config (mds))
>>
> Alas, that doesn't work. The server does not start and now the mds command
> is not assigned so I cannot manually start it.
>
> What I found that does work is changing :config to :init, that is,
>
> (use-package mds
> :commands (mds)
> :init (mds))
>
> On reflection that might make sense. What confuses me is that :init runs
> code before the package is loaded. However, I assume that :commands (mds)
> ensures that mds is auto-loaded, so the call to (mds) then auto-loads and
> runs mds.
Right - it's essentially equivalent to what you had before
`use-package':
(autoload 'mds "mds")
(mds)
However, (use-package mds :config (mds)) really should work too, because
other than some complications for error handling it's morally equivalent
to:
(require 'mds)
(mds)
So I'm not sure what's going on there.
John