necaris / conda.el

Emacs helper library (and minor mode) to work with conda environments
MIT License
153 stars 49 forks source link

Unable to launch terminal emulator when base env. activated #73

Closed arthurcgusmao closed 4 years ago

arthurcgusmao commented 4 years ago

Context

I have the utility function shown below to launch a terminal emulator (outside Emacs) at the current directory. The OS is Linux.

(defun acg/open-in-terminal ()
  "Open the current dir in a new terminal window.
URL `http://ergoemacs.org/emacs/emacs_dired_open_file_in_ext_apps.html'
Version 2015-12-10"
  (interactive)
  (cond
   ((or (string-equal system-type "windows-nt")
        (string-equal system-type "darwin")
    (message "Not supported."))
   ((string-equal system-type "gnu/linux")
    (let ((process-connection-type nil))
      (start-process "" nil "x-terminal-emulator"
                     (concat "--working-directory=" default-directory))))))

Issue

When the "base" conda env is activated in Emacs using this package, no terminal emulator is launched. The process seems to be started, since I get a return value #<process >, but no terminal is actually shown.

Either deactivating the environment with conda-env-deactivate or switching to another environment that is not "base" makes it work.

arthurcgusmao commented 4 years ago

It is related to the PATH environment variable in Emacs. When I activate a conda env and then manually restore the value of PATH with

(conda-env-deactivate)
(setq old-path (getenv "PATH"))
(conda-env-activate "base")
(setenv "PATH" old-path)

the issue disappears.

It could be some particular executable I have in my base env. that is causing it, I don't know. From the terminal (not Emacs) I can launch another terminal w/ x-terminal-emulator even when the "base" env. is active.

arthurcgusmao commented 4 years ago

Playing around with it, it seems that sometimes it works even with the base env. activated. I will close the issue temporarily since it is more likely some local configuration rather than the effect of this package.