Browse Source

Python

arch-macpro
parent
commit
1077bbb6ce
2 changed files with 73 additions and 2 deletions
  1. +36
    -1
      .emacs
  2. +37
    -1
      Readme.md

+ 36
- 1
.emacs View File

@ -130,6 +130,36 @@ Then run FUN with ARGS."
(is-installed 'neotree) (is-installed 'neotree)
(require 'neotree) (require 'neotree)
(global-set-key [f8] 'neotree-toggle) (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 ;; 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. ;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance. ;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right. ;; 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
;; custom-set-faces was added by Custom. ;; custom-set-faces was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful. ;; If you edit it by hand, you could mess it up, so be careful.


+ 37
- 1
Readme.md View File

@ -2,7 +2,43 @@
This repository contains the basic configuration to work with emacs for compile LaTeX, This repository contains the basic configuration to work with emacs for compile LaTeX,
Markdown and Docker tested with MacOS, Ubuntu and Windows. 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 # Known issues
## Windows ## Windows

Loading…
Cancel
Save