Skip to content

Question about other buffer local variables #55

@dschrempf

Description

@dschrempf

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 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.,

   (after! cc-mode
     (defun my-set-lsp-path ()
       (setq lsp-java-server-install-dir (getenv "JDTLS_PATH")))
     (add-hook 'java-mode-hook #'my-set-lsp-path))

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.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions