Put jedi, which is a complementary system of python, in emacs. There should be a lot of information on the net, but I ended up fighting for over an hour, so make a note.
Reference page [python] I installed emacs24 + jedi on mac [How to use the jedi package of emacs](http://hiroom2.jimdo.com/2015/09/20/emacs%E3%81%AEjedi%E3%83%91%E3%83%83%E3%82%B1 % E3% 83% BC% E3% 82% B8% E3% 81% AE% E4% BD% BF% E3% 81% 84% E6% 96% B9 /)
The method written here depends on the MELPA package-install, so emacs 24 is recommended. (There seems to be a way to use MELPA even with emacs 23, but I will omit it)
MELPA Add the following to init.el.
(require 'package)
(add-to-list 'package-archives
'("melpa" . "https://melpa.org/packages/"))
(when (< emacs-major-version 24)
(add-to-list 'package-archives '("gnu" . "http://elpa.gnu.org/packages/")))
(package-initialize)
M-x package-install
You can go to the official website with M-x package-install RET jedi RET
! It says (I also noticed that RET means Enter),
For those who use MELPA or ELPA for the first time, it seems that the package-list will not be updated unless M-x package-list-packages
is found (?)
So let's do M-x package-list-packages
and then M-x package-install RET jedi RET
. Or install it directly from package-list-packages.
Put virtualenv in your python environment and Add the following to init.el.
(require 'jedi)
(add-hook 'python-mode-hook
'(lambda()
(jedi:ac-setup)
(setq jedi:complete-on-dot t)
(local-set-key (kbd "M-TAB") 'jedi:complete)))
When you're done so far, you should do M-x jedi: install-server
at the end.
Recommended Posts