Add finally working company

This commit is contained in:
Maciej Szlosarczyk 2017-08-28 21:20:29 +03:00
parent c59eb1ceb8
commit a9cf902017
No known key found for this signature in database
GPG key ID: 0D4EEACF63D4262E
7 changed files with 105 additions and 54 deletions

View file

@ -3,25 +3,36 @@
;;; Code:
(require 'elpy)
(defun python-mode-config ()
(require 'pyenv-mode)
;;========== Editor config =========================
(defun editor-config-python ()
"Setup editor for Python."
(remove-hook 'ruby-mode-hook 'ruby-mode-config)
(remove-hook 'elixir-mode-hook 'elixir-mode-config)
(remove-hook 'emacs-lisp-mode-hook 'elisp-mode-config)
(remove-hook 'html-mode-hook 'web-mode-config)
(remove-hook 'haskell-mode-hook 'haskell-mode-config)
(remove-hook 'java-mode-hook 'java-mode-config)
(set-indent 4)
(set-width-79)
(setq python-indent-guess-indent-offset 4)
(setq python-indent-offset 4))
(set-indent 4))
;;========== Code completion
(defun completion-config-python ()
"Code completion and inspection for Python."
(elpy-mode 1)
(pyenv-mode 1)
(company-mode 1)
(setq elpy-rpc-python-command "python3")
(setq python-indent-guess-indent-offset 4)
(setq python-indent-offset 4)
(flycheck-mode 1)
(flymake-mode 1)
(add-hook 'python-mode-hook 'python-mode-config)
(add-hook 'python-mode-hook 'pyenv-mode)
(add-hook 'python-mode-hook 'elpy-mode)
(add-hook 'python-mode-hook 'set-width-79)
(setq elpy-rpc-backend "jedi")
(jedi:setup)
(setq jedi:complete-on-dot t)
(setq jedi:complete-reply t)
(set (make-local-variable 'company-backends)
'((company-jedi elpy-company-backend company-capf company-dabbrev-code
company-yasnippet company-files))))
(add-hook 'python-mode-hook 'editor-config-python)
(add-hook 'python-mode-hook 'completion-config-python)
(provide 'python)
;;; python.el ends here