From 39edb91c14fac10a371eabf22b084bf947067b11 Mon Sep 17 00:00:00 2001 From: Gerardo Marx Date: Tue, 1 Feb 2022 16:59:22 -0600 Subject: [PATCH] python env and completion --- .emacs | 43 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 40 insertions(+), 3 deletions(-) diff --git a/.emacs b/.emacs index d2e317d..f3638e8 100644 --- a/.emacs +++ b/.emacs @@ -59,7 +59,7 @@ (package-install 'all-the-icons)) ;; Set default font: (add-to-list 'default-frame-alist - '(font . "Source Code Pro-15")) + '(font . "Source Code Pro-13")) ;;+++++++ ;;auctex: (is-installed 'auctex) @@ -100,6 +100,12 @@ (require 'org-ref) (setq org-latex-pdf-process (list "latexmk -shell-escape -bibtex -f -pdf %f")) (setq org-latex-prefer-user-labels t) +(org-babel-do-load-languages 'org-babel-load-languages '( + (python . t) + (ditaa . t))) +;(setq org-ditaa-jar-path "/usr/bin/ditaa") +;(is-installed 'ditaa) + ;; ========== ;; TRMAP (eval-after-load 'tramp '(setenv "SHELL" "/bin/bash")) @@ -122,7 +128,33 @@ (is-installed 'neotree) (require 'neotree) (global-set-key [f8] 'neotree-toggle) - +;;======= +;; 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 (setq inhibit-startup-message t) ;;inhibit startup @@ -142,7 +174,12 @@ ;; 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" "e19ac4ef0f028f503b1ccafa7c337021834ce0d1a2bca03fcebc1ef635776bea" "d268b67e0935b9ebc427cad88ded41e875abfcc27abd409726a92e55459e0d01" "745d03d647c4b118f671c49214420639cb3af7152e81f132478ed1c649d4597d" "246a9596178bb806c5f41e5b571546bb6e0f4bd41a9da0df5dfbca7ec6e2250c" "4f1d2476c290eaa5d9ab9d13b60f2c0f1c8fa7703596fa91b235db7f99a9441b" default)) + '(package-selected-packages + '(ditaa pyvenv anaconda-mode which-key use-package org-ref neotree markdown-mode doom-themes doom-modeline 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.