Skip to content

Commit

Permalink
Allow changing between tramp and non-tramp buffers
Browse files Browse the repository at this point in the history
  • Loading branch information
siddharthverma314 committed Dec 13, 2022
1 parent 8b08407 commit 2c7c4a4
Showing 1 changed file with 6 additions and 11 deletions.
17 changes: 6 additions & 11 deletions direnv.el
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@
(defvar direnv--output-buffer-name "*direnv*"
"Name of the buffer filled with the last direnv output.")

(defvar direnv--executable (direnv--detect)
"Detected path of the direnv executable.")

(defvar direnv--active-directory nil
"Name of the directory for which direnv has most recently ran.")

Expand Down Expand Up @@ -103,10 +100,6 @@ use `default-directory', since there is no file name (or directory)."

(defun direnv--export (directory)
"Call direnv for DIRECTORY and return the parsed result."
(unless direnv--executable
(setq direnv--executable (direnv--detect)))
(unless direnv--executable
(user-error "Could not find the direnv executable. Is ‘exec-path’ correct?"))
(let ((environment process-environment)
(stderr-tempfile (make-temp-file "direnv-stderr"))) ;; call-process needs a file for stderr output
(unwind-protect
Expand All @@ -116,10 +109,12 @@ use `default-directory', since there is no file name (or directory)."
(process-environment (if (file-remote-p default-directory)
tramp-remote-process-environment
environment))
(exit-code (process-file
direnv--executable nil
`(t ,stderr-tempfile) nil
"export" "json")))
(direnv--executable (direnv--detect))
(exit-code (if (null direnv--executable)
-1
(process-file direnv--executable nil
`(t ,stderr-tempfile) nil
"export" "json"))))
(prog1
(unless (zerop (buffer-size))
(goto-char (point-max))
Expand Down

0 comments on commit 2c7c4a4

Please sign in to comment.