I wanted to ask if it is also (easily?) possible to set other variables in Emacs
depending on the local environment with envrc. For example, when using
different versions of the jdtls language server in Java, the corresponding
minor mode lsp-java needs to know about the installation directories via
lsp-java-server-install-dir, which differ for different versions of the
language server.
At the moment, I use directory-local environment variables and a "set the
variable in the major mode hook", e.g.,
That leads to problems when the environment changes. Of course, it would be much
easier to tell envrc to set lsp-java-server-install-dir along with the
exec-path. Then, I could just use envrc-reload to update the environment,
like I usually to with exec-path.
Hmmm, this would perhaps be a good case for adding a buffer-local hook like "envrc-post-update-hook", then you could use it to sync changes from updated env vars into emacs variables, as in your example.
Hi!
I wanted to ask if it is also (easily?) possible to set other variables in Emacs depending on the local environment with
envrc
. For example, when using different versions of thejdtls
language server in Java, the corresponding minor modelsp-java
needs to know about the installation directories vialsp-java-server-install-dir
, which differ for different versions of the language server.At the moment, I use directory-local environment variables and a "set the variable in the major mode hook", e.g.,
That leads to problems when the environment changes. Of course, it would be much easier to tell
envrc
to setlsp-java-server-install-dir
along with theexec-path
. Then, I could just useenvrc-reload
to update the environment, like I usually to withexec-path
.Thanks!