wbolster/emacs-direnv

Show message when waiting for direnv

Closed this issue · 4 comments

Mic92 commented

When loading some direnv environments that require to download packages,
in my example nix packages direnv currently blocks the editor without any indication why for the time of the download.
It would be therefore cool to show a message in order to see, where emacs currently blocks.

Mic92 commented

Direnv itself already shows a message, when an environment takes longer then 5 seconds too load.

i understand how this can be annoying.

currently direnv.el uses call-process (a synchronous api) to execute direnv export json:

(call-process "direnv" nil '(t t) nil "export" "json")

making that asynchronous using e.g. make-process would make things considerably more complex. not just the code, also all the state handling, e.g. what happens if direnv-mode is enabled, you switch to a buffer, direnv takes its time (in the background), you switch to another buffer from another directory in the mean time, direnv is triggered again, this time fast, the results get loaded, now the first direnv finally finished, even though you're not looking at that buffer anymore, oops, and so on, and so on.

i'd like to keep this library simple (and low maintenance) and changing this is not worth the complexity imho, though i do understand the inconvenience.

closing this as ‘wontfix’ since it's too complex

Mic92 commented

I started working on this issue, but I don't know how I can prevents direnv to be called multiple times in parallel for the same directory: Mic92@f4f3dbb
Also see this thread on NixOS discourse: https://discourse.nixos.org/t/emacs-direnv-help-needed-to-make-it-non-blocking/8595