* Using package.el from site-start
@ 2024-02-04 19:48 sbaugh
2024-02-05 19:27 ` Björn Bidar
2024-02-24 17:04 ` Stefan Monnier via Users list for the GNU Emacs text editor
0 siblings, 2 replies; 6+ messages in thread
From: sbaugh @ 2024-02-04 19:48 UTC (permalink / raw)
To: help-gnu-emacs
Hi,
I maintain an Emacs installation used by many people at my employer. I
have site-specific customizations in site-start.el, stored in site-lisp.
I would like to be able to use packages installed into site-lisp/elpa
(which is added to package-directory-list) in my site-start.el. But I'm
not sure how in site-start.el I can activate the packages installed into
site-lisp/elpa without interfering with later customization by users
which might, e.g., change package-user-dir. If I call
(package-initialize) in site-start.el, that will activate the
site-lisp/elpa packages, but it will prevent users from using
early-init.el to customize the package system.
Also, if possible, I would like to use the package-quickstart-file
functionality to speed up activating the packages in site-lisp/elpa.
Any suggestions on how I should approach this?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Using package.el from site-start
2024-02-04 19:48 Using package.el from site-start sbaugh
@ 2024-02-05 19:27 ` Björn Bidar
2024-02-05 20:22 ` Spencer Baugh
2024-02-24 17:04 ` Stefan Monnier via Users list for the GNU Emacs text editor
1 sibling, 1 reply; 6+ messages in thread
From: Björn Bidar @ 2024-02-05 19:27 UTC (permalink / raw)
To: sbaugh; +Cc: help-gnu-emacs
sbaugh@catern.com writes:
Why are you not adding those packages in the directory to load-path?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Using package.el from site-start
2024-02-05 19:27 ` Björn Bidar
@ 2024-02-05 20:22 ` Spencer Baugh
2024-02-07 19:48 ` Björn Bidar
[not found] ` <87o7csm4y1.fsf@>
0 siblings, 2 replies; 6+ messages in thread
From: Spencer Baugh @ 2024-02-05 20:22 UTC (permalink / raw)
To: Björn Bidar; +Cc: help-gnu-emacs
Björn Bidar <bjorn.bidar@thaodan.de> writes:
> Why are you not adding those packages in the directory to load-path?
That's what activating a package does.
I could add them manually, but then they'll be added again when
package-initialize runs.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Using package.el from site-start
2024-02-05 20:22 ` Spencer Baugh
@ 2024-02-07 19:48 ` Björn Bidar
[not found] ` <87o7csm4y1.fsf@>
1 sibling, 0 replies; 6+ messages in thread
From: Björn Bidar @ 2024-02-07 19:48 UTC (permalink / raw)
To: Spencer Baugh; +Cc: help-gnu-emacs
Spencer Baugh <sbaugh@catern.com> writes:
> Björn Bidar <bjorn.bidar@thaodan.de> writes:
>> Why are you not adding those packages in the directory to load-path?
>
> That's what activating a package does.
>
> I could add them manually, but then they'll be added again when
> package-initialize runs.
If it's so complicated why not package those packages?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Using package.el from site-start
[not found] ` <87o7csm4y1.fsf@>
@ 2024-02-24 15:13 ` Spencer Baugh
0 siblings, 0 replies; 6+ messages in thread
From: Spencer Baugh @ 2024-02-24 15:13 UTC (permalink / raw)
To: Björn Bidar; +Cc: help-gnu-emacs
Björn Bidar <bjorn.bidar@thaodan.de> writes:
> Spencer Baugh <sbaugh@catern.com> writes:
>
>> Björn Bidar <bjorn.bidar@thaodan.de> writes:
>>> Why are you not adding those packages in the directory to load-path?
>>
>> That's what activating a package does.
>>
>> I could add them manually, but then they'll be added again when
>> package-initialize runs.
>
> If it's so complicated why not package those packages?
I don't understand. They're already packaged. I installed them with
package-install. That's the whole point.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Using package.el from site-start
2024-02-04 19:48 Using package.el from site-start sbaugh
2024-02-05 19:27 ` Björn Bidar
@ 2024-02-24 17:04 ` Stefan Monnier via Users list for the GNU Emacs text editor
1 sibling, 0 replies; 6+ messages in thread
From: Stefan Monnier via Users list for the GNU Emacs text editor @ 2024-02-24 17:04 UTC (permalink / raw)
To: help-gnu-emacs
Hi Spencer,
> I would like to be able to use packages installed into site-lisp/elpa
> (which is added to package-directory-list) in my site-start.el. But I'm
> not sure how in site-start.el I can activate the packages installed into
> site-lisp/elpa without interfering with later customization by users
> which might, e.g., change package-user-dir.
I think "you can't". I mean: you can, but you have to choose between
exposing to `package.el` the fact that those packages are activated (and
interfering with the users's later customizations), or not exposing it
and then have `package.el` *re*activate them later with potentially
undesirable side effects.
> If I call (package-initialize) in site-start.el,
First things, first: if you encounter the need to call
`package-initialize`, please report it as a bug. The function that is
relevant for your use case (that you might want to call) is
`package-activate-all`.
[ `package-initialize` is about making `package.el` ready for things
like `list-packages` or `package-install` and should be called
automatically by the code that needs it. For the subject under
discussion not only you should not need to call it, but nothing should
execute it for you either. ]
> that will activate the site-lisp/elpa packages, but it will prevent
> users from using early-init.el to customize the package system.
They would still be able to customize the package system, but of course
some of those customization could fail to have any effect because they've
already been used 🙁
[ E.g. it's difficult to *de*activate a package after it's been
activated. ]
> Also, if possible, I would like to use the package-quickstart-file
> functionality to speed up activating the packages in site-lisp/elpa.
The current design of `package-quickstart-file` is that it's a single
file that tries to bring Emacs to the "final" state of the user's
config, so it would usually include your site-wide packages along with
any other package they have.
You can load the user's quickstart file from your site-start
(`package-activate-all` will do that for you, by default), but then it
may activate additional packages which the rest of your `site-start.el`
doesn't expect, and it may also fail to activate some packages which
your `site-start.el` does expect.
I suggest the following:
- Use a dedicated "dummy" user account.
- Configure it to be vanilla so it only has your site-start/elpa in its
`package-directory-list` and that it has activated all those packages.
- `M-x package-quickstart-refresh RET`.
- cp ~dummy/.emacs.d/package-quickstart.el* .../site-start/elpa/
Then in `site-start.el` do:
(load ".../site-start/elpa/package-quickstart")
Of course, you'll have to redo it on a regular basis (i.e. whenever the
set of packages in `site-start/elpa/` changes, or whenever the
`...-autoloads.el` file of one of those packages changes), so you'll
probably want to script it.
Keep us posted about problems you encounter with such a setup,
Stefan
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-02-24 17:04 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-04 19:48 Using package.el from site-start sbaugh
2024-02-05 19:27 ` Björn Bidar
2024-02-05 20:22 ` Spencer Baugh
2024-02-07 19:48 ` Björn Bidar
[not found] ` <87o7csm4y1.fsf@>
2024-02-24 15:13 ` Spencer Baugh
2024-02-24 17:04 ` Stefan Monnier via Users list for the GNU Emacs text editor
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.