Showing posts with label Emacs. Show all posts
Showing posts with label Emacs. Show all posts

Wednesday, August 28, 2019

Updating modules using Elpy

When a self written module gets updated, reevaluating the buffer and the module in the python shell inside Emacs/Elpy doesn't get updated. For solving this issue, add the following to your Emacs configuration file:

(defun my-restart-python-console ()
  "Restart python console before evaluate buffer or region to avoid various uncanny conflicts, like not reloding modules even when they are changed"
  (interactive)
  (if (get-buffer "*Python*")
      (let ((kill-buffer-query-functions nil)) (kill-buffer "*Python*")))
  (elpy-shell-send-region-or-buffer))

(global-set-key (kbd "C-c C-x C-c") 'my-restart-python-console)

restart your Emacs run your code using ```C-c C-x C-c```

In short, this code has the "if clause" for checking if *Python* buffer is open. This will help to be able to run ```C-c C-x C-c``` at any time of development even when there is no Python process already open. Another part is ```kill-buffer-query-functions``` which neglects the prompt for killing the *Python* buffer.

Wednesday, July 31, 2019

Matplotlib plot not appearing with elpy in Emacs

For solving this, you can use different back-end:

import matplotlib
matplotlib.use('TkAgg')
import matplotlib.pyplot as plt

Other GUI backends:
  • TkAgg
  • WX
  • QTAgg
  • QT4Agg
Run your code using: C-u C-c C-c

Sunday, May 5, 2019

Emacs as Python3 IDE in Mac

Install the following using your preferred method:

pip3 install rope jedi importmagic autopep8 flake8

In Emacs:

M-x package-install RET elpy RET
M-x package-install RET exec-path-from-shell RET
M-x package-install RET pyenv RET
M-x package-install RET anaconda-mode RET

Edit .emacs as following:

(elpy-enable)
(when (memq window-system '(mac ns x))
    (exec-path-from-shell-initialize))
(add-hook 'python-mode-hook 'anaconda-mode)
(setenv "WORKON_HOME" "/anaconda3/envs")
(pyvenv-mode 1)

Restart your emacs and enjoy using the best Python IDE

Use M-x pyvenv-workon to switch between anaconda environments

Monday, November 5, 2018

Common Lisp IDE

Best resource for Common Lisp can be found here: https://github.com/norvig/paip-lisp

Emacs

- sudo apt-get install emacs
 
SBCL

- Download from here: http://www.sbcl.org/platform-table.html
- sudo ./install.sh

Slime

- create .emacs  in your home folder.