1

Is there a way to make buffer-local overrides to exec-path (whose value is normally initialized with the PATH environment variable)?

I tried (make-variable-buffer-local 'exec-path) and local overrides seem to work fine after that, but are there any harmful side effects? In any case, this is non-standard, so is there an officially blessed way to do it?

One reason for a buffer-local path would be to use project-specific versions of tools in Node.js and other projects.

Lassi
  • 377
  • 1
  • 7
  • 2
    `setq-local` would have even less impact since it really only effects the value of `exec-path` in the current buffer. The other buffers still share the same value. With `make-variable-buffer-local` the variable becomes buffer local in all buffers. That could break things. Especially if you do something like that in the early initialization phase. For an instance a package could add the directory path of an external program via `(setq exec-path (cons ... exec-path))` even if that is not advisable. That path would only be added in the buffer where `load-package` run. – Tobias Jan 05 '19 at 14:57
  • The normal approach would be to `let`-bind the value you wanted around the call to the function which needed it. – phils Apr 05 '20 at 07:40

0 Answers0