-
Notifications
You must be signed in to change notification settings - Fork 235
Python Virtual Environment
This hack is possible because EAF respects the Environment of the terminal, so basically we can source any particular pyenv and then launch emacs within it. Feel free to add complexities to your custom scripts and lets try to keep this simple.
-
Create a virtual environment and note its path, lets say your user is
user
and virtualenv is in pyenv directory, thesource
path will be,/home/user/pyenv/bin/activate
. -
Create a simple script somewhere, and lets call it
launcher.sh
the job of launcher.sh is to source the virtualenv file and launch emacs, createlauncher.sh
with following content
source /home/user/pyenv/bin/activate
emacs &
(don't forget to chmod +x launcher.sh
)
- Now you can create a desktop entry for this with the following content (creating desktop entry basically means creating a .desktop file and moving it to ~/.local/share/applications)
[Desktop Entry]
Name=Emacs (Custom)
GenericName=Text Editor
Comment=Edit text
MimeType=text/english;text/plain;text/x-makefile;text/x-c++hdr;text/x-c++src;text/x-chdr;text/x-csrc;text/x-java;text/x-moc;text/x-pascal;text/x-tcl;text/x-tex;application/x-shellscript;text/x-c;text/x-c++;
Exec=/home/user/launcher.sh
Icon=emacs
Type=Application
Terminal=false
Categories=Development;TextEditor;Utility;
StartupWMClass=Emacs
And save it in ~/.local/share/applications/EmacsCustom.desktop
now you should be able to see the desktop entry in dash/rofi. If you feel like launching from commandline, even ./launcher.sh will work.
You can set an explicit python path as a simple way to run EAF without conflicts with existing conda/virtual environments.
EAF will interact with a specified python once you set eaf-python-command
in your Emacs configuration.
For example
(setq eaf-python-command "/usr/bin/python3") ; this path needs to be changed based on your OS