From 4e7ce5e744db532beaabcac604288f1af1688ac2 Mon Sep 17 00:00:00 2001 From: Marc Pohling Date: Sat, 19 May 2018 17:50:12 +0200 Subject: [PATCH] added iPython, more structure in python configs --- config.org | 149 +++++++++++++++++++++++++++-------------------------- 1 file changed, 75 insertions(+), 74 deletions(-) diff --git a/config.org b/config.org index 388e2e3..df68a21 100644 --- a/config.org +++ b/config.org @@ -786,41 +786,43 @@ Org overwrites RET and C-j, so I need to disable the rebinds ** Org babel languages This code block is linux specific. Loading languages which aren't available seems to be a problem #+BEGIN_SRC emacs-lisp - (cond ((eq system-type 'gnu/linux) - (org-babel-do-load-languages - 'org-babel-load-languages - '( - (C . t) - (calc . t) - (java . t) - (js . t) - (latex . t) - (ledger . t) - (beancount . t) - (lisp . t) - (python . t) - (R . t) - (ruby . t) - (scheme . t) - (shell . t) - (sqlite . t) - ) - )) - ) +(cond ((eq system-type 'gnu/linux) + (org-babel-do-load-languages +'org-babel-load-languages + '( + (C . t) + (calc . t) + (java . t) + (ipython . t) + (js . t) + (latex . t) + (ledger . t) + (beancount . t) + (lisp . t) + (python . t) + (R . t) + (ruby . t) + (scheme . t) + (shell . t) + (sqlite . t) + ) + )) +) #+END_SRC #+BEGIN_SRC emacs-lisp - (defun my-org-confirm-babel-evaluate (lang body) - "Do not confirm evaluation for these languages." - (not (or (string= lang "beancount") - (string= lang "C") - (string= lang "emacs-lisp") - (string= lang "java") - (string= lang "ledger") - (string= lang "python") - (string= lang "R") - (string= lang "sqlite")))) - (setq org-confirm-babel-evaluate 'my-org-confirm-babel-evaluate) +(defun my-org-confirm-babel-evaluate (lang body) + "Do not confirm evaluation for these languages." + (not (or (string= lang "beancount") + (string= lang "C") + (string= lang "emacs-lisp") + (string= lang "ipython") + (string= lang "java") + (string= lang "ledger") + (string= lang "python") + (string= lang "R") + (string= lang "sqlite")))) +(setq org-confirm-babel-evaluate 'my-org-confirm-babel-evaluate) #+END_SRC I want plots! @@ -1152,6 +1154,7 @@ Common backends are: #+BEGIN_SRC emacs-lisp (defun company/python-mode-hook() + (message "python-mode-hook activated") (set (make-local-variable 'company-backends) '((company-jedi))) ; '((company-jedi company-dabbrev-code company-yasnippet) company-capf company-files)) @@ -1299,25 +1302,22 @@ Add some helpers to handle and understand macros #+END_SRC ** Python - Systemwide following packages need to be installed: - - venv - - The virtual environments need to have following modules installed: - - wheel (for some reason it isn't pulled by other packages, yet they complain about missing wheel) - - jedi - - epc - - pylint - - NEW: python-language-server[all] - - instead of [all] there are - - for python-language-server see here: [[https://github.com/palantir/python-language-server][Link]] - - Automatically start python-mode when opening a .py-file. - Not sure if python.el is better than python-mode.el. - See [[https://github.com/jorgenschaefer/elpy/issues/887][here]] for info about ~python-shell-completion-native-enable~. - The custom function is to run inferiour processes (do I really need that?), see [[https://emacs.stackexchange.com/questions/16361/how-to-automatically-run-inferior-process-when-loading-major-mode][here]]. - - Also limit the completion backends to those which make sense in Python. +*** Intro + Systemwide following packages need to be installed: + - venv + + The virtual environments need to have following modules installed: + - wheel (for some reason it isn't pulled by other packages, yet they complain about missing wheel) + - jedi + - epc + - pylint +*** Python-Mode + Automatically start python-mode when opening a .py-file. + Not sure if python.el is better than python-mode.el. + See [[https://github.com/jorgenschaefer/elpy/issues/887][here]] for info about ~python-shell-completion-native-enable~. + The custom function is to run inferiour processes (do I really need that?), see [[https://emacs.stackexchange.com/questions/16361/how-to-automatically-run-inferior-process-when-loading-major-mode][here]]. + + Also limit the completion backends to those which make sense in Python. #+BEGIN_SRC emacs-lisp (use-package python @@ -1333,13 +1333,13 @@ Add some helpers to handle and understand macros (setq python-shell-completion-native-enable nil) ) #+END_SRC - - First test for lsp-python. - Source python language server: [[https://github.com/palantir/python-language-server][Link]] - Source lsp-mode: - Source lsp-python: [[https://github.com/emacs-lsp/lsp-python][Link]] - Source company-lsp: [[https://github.com/tigersoldier/company-lsp][Link]] - Source lsp-ui: [[https://github.com/emacs-lsp/lsp-ui][Link]] +*** Python language server (inactive) + First test for lsp-python. + Source python language server: [[https://github.com/palantir/python-language-server][Link]] + Source lsp-mode: + Source lsp-python: [[https://github.com/emacs-lsp/lsp-python][Link]] + Source company-lsp: [[https://github.com/tigersoldier/company-lsp][Link]] + Source lsp-ui: [[https://github.com/emacs-lsp/lsp-ui][Link]] BEGIN_SRC emacs-lisp (use-package lsp-mode @@ -1370,11 +1370,11 @@ BEGIN_SRC emacs-lisp END_SRC - -Jedi is a backend for python autocompletion and needs to be installed on the server: -- pip install jedi -Code checks need to be installed, too: -- pip install flake8 +*** Jedi / Company + Jedi is a backend for python autocompletion and needs to be installed on the server: + - pip install jedi + Code checks need to be installed, too: + - pip install flake8 #+BEGIN_SRC emacs-lisp (use-package company-jedi @@ -1391,10 +1391,11 @@ Code checks need to be installed, too: ) #+END_SRC -A wrapper to handle virtual environments. -I strongly recommend to install virtual environments on the terminal, not through this wrapper, but changing venvs is fine. +*** Virtual Environments + A wrapper to handle virtual environments. + I strongly recommend to install virtual environments on the terminal, not through this wrapper, but changing venvs is fine. -TODO: automatically start an inferior python process or switch to it if already created + TODO: automatically start an inferior python process or switch to it if already created #+BEGIN_SRC emacs-lisp (use-package pyvenv @@ -1419,11 +1420,11 @@ TODO: automatically start an inferior python process or switch to it if already #+END_SRC -I want Emacs to automatically start the proper virtual environment. -Required is a .python-version file with, content in the first line being /path/to/virtualenv/ -[[https://github.com/marcwebbie/auto-virtualenv][Github source]] + I want Emacs to automatically start the proper virtual environment. + Required is a .python-version file with, content in the first line being /path/to/virtualenv/ + [[https://github.com/marcwebbie/auto-virtualenv][Github source]] -Depends on pyvenv + Depends on pyvenv #+BEGIN_SRC emacs-lisp (use-package auto-virtualenv @@ -1439,7 +1440,8 @@ Depends on pyvenv ) #+END_SRC -Highlight indentations +*** Visuals + Highlight indentations #+BEGIN_SRC emacs-lisp (use-package highlight-indentation @@ -1463,9 +1465,8 @@ BEGIN_SRC emacs-lisp highlight-indent-guides-auto-even-face-perc 15 highlight-indent-guides-auto-character-face-perc 20)) END_SRC - - -Anaconda test +*** Anaconda (inactive) + Anaconda test #+BEGIN_SRC emacs-lisp ; (use-package anaconda-mode