From 1d75b0fba18782f0e7ab8bdd97036a7880202013 Mon Sep 17 00:00:00 2001 From: Marc Pohling Date: Mon, 21 May 2018 18:45:40 +0200 Subject: [PATCH] minor fixes for hook activation --- config.org | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/config.org b/config.org index 1a8ccfe..44484ad 100644 --- a/config.org +++ b/config.org @@ -629,11 +629,13 @@ #+BEGIN_SRC emacs-lisp - (use-package org - :ensure org-plus-contrib - :init - (add-hook 'org-mode-hook 'company/org-mode-hook) - ) +(use-package org + :ensure org-plus-contrib + :init + (add-hook 'org-mode-hook 'company/org-mode-hook) +) +(add-hook 'org-mode-hook 'company/org-mode-hook) + #+END_SRC To avoid problems executing source blocks out of the box. [[https://emacs.stackexchange.com/a/28604][Others have the same problem, too]]. The solution is to remove the .elc files form the package directory: @@ -1157,7 +1159,7 @@ It is only available for emacs 26 and higher. #+BEGIN_SRC emacs-lisp (defun company/python-mode-hook() - (message "python-mode-hook activated") + (message "company/python-mode-hook activated") (set (make-local-variable 'company-backends) '((company-ob-ipython company-jedi))) ; '((company-jedi company-dabbrev-code company-yasnippet) company-capf company-files)) @@ -1169,7 +1171,7 @@ It is only available for emacs 26 and higher. I have yet to find the proper hook to call this. #+BEGIN_SRC emacs-lisp (defun company/ipython-mode-hook() - (message "python-mode-hook activated") + (message "company/ipython-mode-hook activated") (set (make-local-variable 'company-backends) '((company-ob-ipython))) (company-mode t) @@ -1183,12 +1185,13 @@ It is only available for emacs 26 and higher. Backend for Orgmode #+BEGIN_SRC emacs-lisp - (defun company/org-mode-hook() - (set (make-local-variable 'company-backends) - '(company-capf company-files)) - (add-hook 'completion-at-point-functions 'pcomplete-completions-at-point nil t) - (company-mode t) - ) +(defun company/org-mode-hook() + (set (make-local-variable 'company-backends) + '(company-capf company-files)) + (add-hook 'completion-at-point-functions 'pcomplete-completions-at-point nil t) + (message "company/org-mode-hook") + (company-mode t) +) #+END_SRC Backend configuration for lisp-mode @@ -1448,7 +1451,7 @@ END_SRC (setenv "WORKON_HOME" (expand-file-name "~/Archiv/Programmierprojekte/Python/virtualenv/")) :config (pyvenv-mode t) - (defun my/post-activate-hook() + (defun my/pyvenv-post-activate-hook() (setq jedi:environment-root pyvenv-virtual-env) (setq jedi:environment-virtualenv pyvenv-virtual-env) (setq jedi:tooltip-method '(nil)) ;; variants: nil or pos-tip and/or popup @@ -1456,20 +1459,18 @@ END_SRC ;; default traceback, other option M-x jedi:toggle-log-traceback ;; traceback is in jedi:pop-to-epc-buffer (jedi:setup) - (company/python-mode-hook) +;; (company/python-mode-hook) (setq jedi:server-args '("--log-traceback")) - (message "post-activate-hook")) - (add-hook 'pyvenv-post-activate-hooks 'my/post-activate-hook) + (message "pyvenv-post-activate-hook activated")) + (add-hook 'pyvenv-post-activate-hooks 'my/pyvenv-post-activate-hook) ) #+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]] Depends on pyvenv - #+BEGIN_SRC emacs-lisp (use-package auto-virtualenv :ensure t