Comments (13)
How does it fail? Note that the interactive command only sets the buffer env of the current buffer, not the entire project.
from buffer-env.
Hi,
It fails silently. That is, no pip installed packages are available in my current buffer from the virtualenv that I set up.
The package I usually test this out with is jedi-language-server.
I call eglot
and eglot
does not find the said language server.
When I try with pyvenv, it works fine.
I'm aware of the issue with having to use inheritenv
in conjunction with buffer-env
in order for environments to propagate across buffers (comint, etc).
from buffer-env.
In the meantime I stopped using buffer-env
, but let me know if you'd like me to reproduce anything in particular.
If you share a config or steps for me to try, that might be the best approach to testing this and seeing where the problem may be.
Do virtualenv's work for you currently? What is your workflow? How do you have buffer-env set up to use Python virtualenv's?
from buffer-env.
Okay, Eglot is a bit complicated since it starts a process asynchronously, but nonetheless it works fine for me (no need for any inheritenv advices). A simple test you can do is, after updating the environment, is M-! env RET
. If you see the right PATH, then buffer-env is working.
All I have in my config is this:
(add-hook 'hack-local-variables-hook 'buffer-env-update)
(setq buffer-env-script-name '(".envrc" ".venv/bin/activate"))
;; Plus the inheritenv advice around `python-shell-make-comint'.
from buffer-env.
I have seemingly the same problem, which can be fixed by changing the (sit-for 0)
line to (sit-for 1)
.
from buffer-env.
That sounds like a plausible cause.
I'll do some more testing this week with your change to see if it also fixes it for me.
from buffer-env.
Okay, Eglot is a bit complicated since it starts a process asynchronously, but nonetheless it works fine for me (no need for any inheritenv advices). A simple test you can do is, after updating the environment, is
M-! env RET
. If you see the right PATH, then buffer-env is working.All I have in my config is this:
(add-hook 'hack-local-variables-hook 'buffer-env-update) (setq buffer-env-script-name '(".envrc" ".venv/bin/activate")) ;; Plus the inheritenv advice around `python-shell-make-comint'.
@astoff This didn't work for me.
from buffer-env.
@quotuva Can you reproduce this with emacs -q
and using a minimal .envrc file? Also, which OS are you on?
(One more thing you could try: keep (sit-for 1)
in buffer-env.el but add sleep 5
in your .envrc file.)
from buffer-env.
Can you reproduce this with emacs -q
I can't. :D
The only explanation I can think of is that using all the packages slows down the system to cause this.
add sleep 5 in your .envrc file
I don't use direnv. I simply add .venv/bin/activate
to buffer-env-script-name
.
EDIT:
Also, which OS are you on?
Ubuntu 22
EDIT2:
Just FYI: When this happens, the vars
local variable is nil
because the temporary buffer is empty. But the process-live-p
part does not happen.
from buffer-env.
the vars local variable is nil because the temporary buffer is empty
Okay, I should add an error message in this case. But I still don't get why your temp buffer ends up empty.
I don't use direnv. I simply add .venv/bin/activate to buffer-env-script-name.
It's still a shell script, you could add a long sleep to check if buffer-env is actually waiting for the process to end (I'm staring at the code and can't see how this could go wrong)
from buffer-env.
But I still don't get why your temp buffer ends up empty.
I'm just guessing: The process exit status is 0, but Emacs hasn't updated the buffer yet. I don't know if that's impossible.
It's still a shell script, you could add a long sleep
Yes, I did that and it works fine then.
from buffer-env.
I guess you're right, see "this loop contains a bug" here: https://www.gnu.org/software/emacs/manual/html_node/elisp/Accepting-Output.html
What if you replace this:
Lines 215 to 216 in e015220
by this:
(sit-for 0)
(if (not (process-live-p proc)) (accept-process-output proc 1)
from buffer-env.
What if you replace this:
...
by this:
Works! Thank you! I hope @jgarte can also confirm (if this is indeed his problem).
from buffer-env.
Related Issues (12)
- Alternative to Customize? HOT 6
- `format-prompt` not defined in Emacs 27 HOT 4
- Support pyproject.toml HOT 1
- `cl-letf` warning HOT 9
- Temporarily disable hack-local-variables-hook? And misc org-babel issues. HOT 4
- Support specifying a command directly HOT 4
- Setting buffer-env-command locally HOT 3
- buffer-env-active mention in README does not exist
- How to inherit environment from manifest.scm to external applications HOT 2
- Saving buffer-env-safe-files: wrong-type-argument listp t HOT 15
- Adding buffer-env-update to hack-local-variables-hook does not affect buffers without files HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from buffer-env.