diff --git a/config.org b/config.org index 255de8f..b564d6e 100644 --- a/config.org +++ b/config.org @@ -152,6 +152,7 @@ Also auto refresh dired, but be quiet about it. [[http://whattheemacsd.com/sane- * Org Mode ** Installation Although org mode ships with Emacs, the latest version can be installed externally. The configuration here follows the [[http://orgmode.org/elpa.html][Org mode ELPA Installation instructions.]] +Added a hook to complete org functions, company-capf is necessary for this #+begin_src emacs-lisp (use-package org @@ -421,7 +422,7 @@ Colorize colors as text with their value ) #+end_src -*** Company Mode +** Company Mode Complete Anything! Activate company and make it react nearly instantly @@ -438,6 +439,21 @@ Activate company and make it react nearly instantly ) #+end_src +*** Company backend hooks + +Backend configuration for python-mode + +#+begin_src emacs-lisp + (defun company/python-mode-hook() + (lambda () + (set (make-local-variable 'company-backends) + '((company-jedi company-dabbrev) company-capf company-files)) + (company-mode t)) + ) +#+end_src + +*** Misc Company packages + Addon to sort suggestions by usage #+begin_src emacs-lisp @@ -484,10 +500,10 @@ The virtual environments need to have following modules installed: (add-hook 'python-mode-hook (lambda () (semantic-mode 1) (flycheck-select-checker 'python-pylint))) -;; (setq flycheck-checker 'python-pylint))) ) #+end_src + 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~. @@ -499,10 +515,10 @@ Also limit the completion backends to those which make sense in Python. :mode ("\\.py\\'" . python-mode) :interpreter ("python" . python-mode) :init - (add-hook 'python-mode-hook + (add-hook 'python-mode-hook ;;'company/python-mode-hook) (lambda () -;; (set (make-local-variable 'company-backends) -;; '((company-jedi company-dabbrev-code company-capf company-files))) + (set (make-local-variable 'company-backends) + '((company-jedi company-dabbrev-code) company-capf company-files)) (company-mode t))) :config (setq python-shell-completion-native-enable nil) @@ -531,6 +547,7 @@ Code checks need to be installed, too: (add-hook 'python-mode-hook 'jedi:setup) (setq jedi:complete-on-dot t) (setq jedi:use-shortcuts t) + (add-hook 'python-mode-hook 'company/python-mode-hook) ;; (defun my/python-mode-hook() ;; (lambda () ;; (set (make-local-variable 'company-backends) @@ -561,8 +578,9 @@ apt install ;; default traceback, other option M-x jedi:toggle-log-traceback ;; traceback is in jedi:pop-to-epc-buffer (jedi:setup) + (company/python-mode-hook) (setq jedi:server-args '("--log-traceback"))) - (add-to-list 'company-backends 'company-jedi) +;; (add-to-list 'company-backends 'company-jedi) ;; (add-to-list 'company-backends 'company-anaconda) ;; (lambda () ;; (set (make-local-variable 'company-backends)