on.el
on.el copied to clipboard
Feature request: `on-first-project-hook`?
Many packages requires a project to be defined, I think a on-first-project-hook could benefits many users? :)
Do you have a use case for this? It doesn't seem entirely necessary to me, because you could just use (eval-after-load 'project '(...)) instead. The :after keyword in use-package makes this even easier.
Oh, not the project.el (loading package). What I mean is when a project root is defined. Many packages rely on the project root to be defined in order to work, like lsp-mode, etc.
@ajgrf Friendly ping. :)
@jcs090218 Is the idea to do something like add-variable-watcher to a project root variable? I'm not sure I understand the use case because you wouldn't normally wan to run lsp-mode just once.
I'm not sure I understand the use case because you wouldn't normally wan to run lsp-mode just once.
Not enable lsp-mode but require the module the first time. lsp-mode may be a bad example, other example are diff-hl, git-gutter, or vc-msg, etc.
Maybe hooks on-first-project-hook (for diff-hl/git-gutter) and on-project-hook (for lsp-mode/eglot) can be a great addition?
Expectation:
(add-hook 'on-first-project-hook (lambda () (global-diff-hl-mode 1))) ; don't load on every project's hook
(add-hook 'on-project-hook (lambda () (lsp-mode 1)))