diff --git a/.emacs b/.emacs index e6a2295..c893055 100644 --- a/.emacs +++ b/.emacs @@ -130,6 +130,36 @@ Then run FUN with ARGS." (is-installed 'neotree) (require 'neotree) (global-set-key [f8] 'neotree-toggle) +;; ======== +;; Python +;;=-=-=-=-=-= +;; Python completion: +(is-installed 'anaconda-mode) +(add-hook 'python-mode-hook 'anaconda-mode) +(add-hook 'python-mode-hook 'anaconda-eldoc-mode) +;(add-hook 'python-mode-hook 'jedi:setup) +;(setq jedi:complete-on-dot t) ; optional +;(setq jedi:environment-root "/usr/local/bin/python3") +;;======= +;; Python pyvenv +(is-installed 'pyvenv) +(pyvenv-mode t) +(setenv "WORKON_HOME" "~/.pyvenv/") +;(setq python-shell-interpreter (concat pyvenv-virtual-env "bin/python3")) +;(setq python-shell-interpreter "/usr/local/bin/python3") +;; -=-=-=-=-=-=-=-=- +;; My functions gmarx +;; Python chunk: +(defun python-shell-send-chunk () + (interactive) + (save-excursion + (mark-paragraph) + (let ((start (region-beginning)) + (end (region-end))) + (python-shell-send-region start end)) + (keyboard-quit))) +;; my keybindings: +(global-set-key (kbd "C-c C-k") 'python-shell-send-chunk) ;;==================== ;; emacs startup config @@ -150,7 +180,12 @@ Then run FUN with ARGS." ;; If you edit it by hand, you could mess it up, so be careful. ;; Your init file should contain only one such instance. ;; If there is more than one, they won't work right. -) + '(custom-safe-themes + '("b0e446b48d03c5053af28908168262c3e5335dcad3317215d9fdeb8bac5bacf9" default)) + '(package-selected-packages + '(anaconda-mode which-key use-package pyvenv pdf-tools org-ref neotree markdown-mode jedi helm doom-themes doom-modeline docker-compose-mode auctex)) + '(safe-local-variable-values + '((LaTeX-includegraphics-read-file . LaTeX-includegraphics-read-file-relative)))) (custom-set-faces ;; custom-set-faces was added by Custom. ;; If you edit it by hand, you could mess it up, so be careful. diff --git a/Readme.md b/Readme.md index 883dc53..e1207c3 100644 --- a/Readme.md +++ b/Readme.md @@ -2,7 +2,43 @@ This repository contains the basic configuration to work with emacs for compile LaTeX, Markdown and Docker tested with MacOS, Ubuntu and Windows. -This configuration is used with the research seminar 101. +# Python `venv` +It has been tested that to work with Python's virtual environments (venv) on emacs, the venv must be created and activated on shell y using: + +``` shell +$ python3 -m venv ~/.pyvenv/path/to/new/virtual/environment/ +$ source /path/to/new/virtual/environment/activate +``` + +after this we have to activate the virtual environment with emacs' command `pyvenv-workon` and select the environment to work with. + +*consider tath a variable in `.emacs` must bedefined* + +``` +(setenv "WORKON_HOME" "~/.pyvenv/") +``` + +The commands to create a environmet is + +``` +python3 -m venv ~/.pyvenv/path/to/new/vir +tual/environment/ +``` + +then you need to acticate the environmet to install or update packages by: + +``` +source ~/.pyvenv/path/to/new/vir +tual/environment/bin/activate +``` + + +and the command to install a package is: + +``` +pip install package-name +``` + # Known issues ## Windows