* Reacting to package load @ 2023-11-25 12:54 Psionic K 2023-11-25 13:06 ` Eli Zaretskii 2023-11-27 9:38 ` Björn Bidar 0 siblings, 2 replies; 5+ messages in thread From: Psionic K @ 2023-11-25 12:54 UTC (permalink / raw) To: help-gnu-emacs I need a strategy to detect when a package is loaded so I can look for a header (or predetermined override) to install non-elisp dependencies for that package. If there's a hook or functions variable, I can't guess the name. Not sure where I might add advice if that's the best available approach. I need an approach that is agnostic to package managers. -- 남백호 대표 겸 공동 창업자 포지트론 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Reacting to package load 2023-11-25 12:54 Reacting to package load Psionic K @ 2023-11-25 13:06 ` Eli Zaretskii 2023-11-27 9:38 ` Björn Bidar 1 sibling, 0 replies; 5+ messages in thread From: Eli Zaretskii @ 2023-11-25 13:06 UTC (permalink / raw) To: help-gnu-emacs > From: Psionic K <psionik@positron.solutions> > Date: Sat, 25 Nov 2023 21:54:47 +0900 > > I need a strategy to detect when a package is loaded so I can look for a > header (or predetermined override) to install non-elisp dependencies for > that package. > > If there's a hook or functions variable, I can't guess the name. Not sure > where I might add advice if that's the best available approach. Is eval-after-load what you had in mind? ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Reacting to package load 2023-11-25 12:54 Reacting to package load Psionic K 2023-11-25 13:06 ` Eli Zaretskii @ 2023-11-27 9:38 ` Björn Bidar 2023-11-28 2:12 ` Psionic K 1 sibling, 1 reply; 5+ messages in thread From: Björn Bidar @ 2023-11-27 9:38 UTC (permalink / raw) To: Psionic K; +Cc: help-gnu-emacs As Eli already said there's eval after load but there's also featurep to check if a feature is present. Not in all cases it's good to check for dependencies only after the depending package was loaded. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Reacting to package load 2023-11-27 9:38 ` Björn Bidar @ 2023-11-28 2:12 ` Psionic K 2023-11-28 2:32 ` Psionic K 0 siblings, 1 reply; 5+ messages in thread From: Psionic K @ 2023-11-28 2:12 UTC (permalink / raw) To: Björn Bidar; +Cc: Psionic K, help-gnu-emacs > Not in all cases it's good to check for dependencies only after the depending package was loaded. Yes, and this will continue to be true for packages that resolve and configure external dependencies at load time rather than dynamically after giving us a chance to react. I'm going with after-load-functions for now. In the future, packages will cooperate with dependency management through a new package header to communicate which non-elisp packages are required. Long term, Emacs needs to mediate the implementation of providing external deps in reaction to loaded Elisp deps. A non-standard hook such as before-load-functions will enable external dependency managers to pre-empt missing software before any chance for problems downstream. To be clear, these dependency managers will be agnostic to Elpaca, Straight, package.el etc. They don't care what they are doing, just which package got loaded so they can see if the dependency is already available. If there's a more obvious extra header name than X-Package-External to describe a non-elisp dependency, please say so. I am using an X prefix because I have seen this used for other additional headers that don't have a standard meaning yet. The contents of the header needs to accommodate both generic and specific styles so that more specific declarations can override generic ones For an example: X-Package-External: (((nix . "cowsay") (guix . "cowsay") "cowsay")) Each entry is a list for one dependency. The dependency is specified via generic paths in a string and then in specific paths with a cons if necessary. I'll take a closer look at Guix. I didn't identify anything concerning, but I've lost familiarity. IIRC both Nix and Guix support more explicit string paths where necessary. The external dependency managers and use-package will of course override packages to alleviate pressure on upstreams, via new keywords and supplying values for missing headers. In the beginning, this will be the only available mechanism. On Mon, Nov 27, 2023 at 6:38 PM Björn Bidar <bjorn.bidar@thaodan.de> wrote: > > As Eli already said there's eval after load but there's also > featurep to check if a feature is present. > Not in all cases it's good to check for dependencies only after the > depending package was loaded. > -- 남백호 대표 겸 공동 창업자 포지트론 ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Reacting to package load 2023-11-28 2:12 ` Psionic K @ 2023-11-28 2:32 ` Psionic K 0 siblings, 0 replies; 5+ messages in thread From: Psionic K @ 2023-11-28 2:32 UTC (permalink / raw) To: Psionic K; +Cc: Björn Bidar, help-gnu-emacs After sending that I started thinking about blocking and user experience. In the case of checking for an existing dependency, it's fast and can happen synchronously. In the case that we would need to obtain the dependency, it's usually slow. In order to complete the load asynchronously, more cooperation would be needed. This is all quite edge case since most well-done packages can dynamically resolve their dependencies and user actions to install from ad-hoc dependency sources is usually not automatic and certainly not at load time. `executable-find` might be something I look at since it can co-opt a badly behaving package, but this also runs into the lack of asynchronous capability to defer the rest of execution after the co-opting is completed. On Tue, Nov 28, 2023 at 11:12 AM Psionic K <psionik@positron.solutions> wrote: > > Not in all cases it's good to check for dependencies only after the > depending package was loaded. > > Yes, and this will continue to be true for packages that resolve and > configure external dependencies at load time rather than dynamically after > giving us a chance to react. I'm going with after-load-functions for now. > > In the future, packages will cooperate with dependency management through > a new package header to communicate which non-elisp packages are required. > > Long term, Emacs needs to mediate the implementation of providing external > deps in reaction to loaded Elisp deps. A non-standard hook such as > before-load-functions will enable external dependency managers to > pre-empt missing software before any chance for problems downstream. > > To be clear, these dependency managers will be agnostic to Elpaca, > Straight, package.el etc. They don't care what they are doing, just which > package got loaded so they can see if the dependency is already available. > > If there's a more obvious extra header name than X-Package-External to > describe a non-elisp dependency, please say so. I am using an X prefix > because I have seen this used for other additional headers that don't have > a standard meaning yet. > > The contents of the header needs to accommodate both generic and specific > styles so that more specific declarations can override generic ones > > For an example: > > X-Package-External: (((nix . "cowsay") (guix . "cowsay") "cowsay")) > > Each entry is a list for one dependency. The dependency is specified via > generic paths in a string and then in specific paths with a cons if > necessary. > > I'll take a closer look at Guix. I didn't identify anything concerning, > but I've lost familiarity. IIRC both Nix and Guix support more explicit > string paths where necessary. > > The external dependency managers and use-package will of course override > packages to alleviate pressure on upstreams, via new keywords and supplying > values for missing headers. In the beginning, this will be the only > available mechanism. > > On Mon, Nov 27, 2023 at 6:38 PM Björn Bidar <bjorn.bidar@thaodan.de> > wrote: > >> >> As Eli already said there's eval after load but there's also >> featurep to check if a feature is present. >> Not in all cases it's good to check for dependencies only after the >> depending package was loaded. >> > > > -- > > 남백호 > 대표 겸 공동 창업자 > 포지트론 > -- 남백호 대표 겸 공동 창업자 포지트론 ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-11-28 2:32 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2023-11-25 12:54 Reacting to package load Psionic K 2023-11-25 13:06 ` Eli Zaretskii 2023-11-27 9:38 ` Björn Bidar 2023-11-28 2:12 ` Psionic K 2023-11-28 2:32 ` Psionic K
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.