Conversation
This allows setting (buffer-local) variables from local environment
variables. For example,
(defun my-set-jdtls-path ()
(setq-local lsp-java-server-install-dir (getenv "JDTLS_PATH")))
(add-hook 'envrc-post-update-hook 'my-set-jdtls-path)
|
Thanks! I'll articulate here the reason I haven't immediately merged this. Namely, I expect that some of the things one might do in such a hook would be specific to a major mode, e.g. because the variable being set from an env var is specific to a major mode. By modifying So one might then naturally try to modify the hook buffer-locally, e.g. with (defun enable-sync-jdtls-path ()
(add-hook 'envrc-post-update-hook 'my-set-jdtls-path nil t))
(add-hook 'java-mode-hook 'enable-sync-jdtls-path nil t)but then the So I'm pondering whether there's an alternate pattern or approach to make this both easy and reliable. Perhaps I'm also overthinking things, so let me know what you think. |
|
Hmm, what about an envrc function (for discussion, call it should do the Right Thing regardless of whether |
|
What I currently usually do is in the mode hook, I add a buffer-local hook to hack-local-variables-hook to defer stuff until after envrc is loaded. |
Fixes #55. The hook is probably called more often than necessary. Is there a better position in the source code of
envrcfor it to be called?This allows setting (buffer-local) variables from local environment variables. For example,