Browse Source

minor fixes for hook activation

master
Marc Pohling 6 years ago
parent
commit
1d75b0fba1
1 changed files with 20 additions and 19 deletions
  1. 39
      config.org

39
config.org

@ -629,11 +629,13 @@
#+BEGIN_SRC emacs-lisp #+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 #+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: 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 #+BEGIN_SRC emacs-lisp
(defun company/python-mode-hook() (defun company/python-mode-hook()
(message "python-mode-hook activated")
(message "company/python-mode-hook activated")
(set (make-local-variable 'company-backends) (set (make-local-variable 'company-backends)
'((company-ob-ipython company-jedi))) '((company-ob-ipython company-jedi)))
; '((company-jedi company-dabbrev-code company-yasnippet) company-capf company-files)) ; '((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. I have yet to find the proper hook to call this.
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(defun company/ipython-mode-hook() (defun company/ipython-mode-hook()
(message "python-mode-hook activated")
(message "company/ipython-mode-hook activated")
(set (make-local-variable 'company-backends) (set (make-local-variable 'company-backends)
'((company-ob-ipython))) '((company-ob-ipython)))
(company-mode t) (company-mode t)
@ -1183,12 +1185,13 @@ It is only available for emacs 26 and higher.
Backend for Orgmode Backend for Orgmode
#+BEGIN_SRC emacs-lisp #+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 #+END_SRC
Backend configuration for lisp-mode Backend configuration for lisp-mode
@ -1448,7 +1451,7 @@ END_SRC
(setenv "WORKON_HOME" (expand-file-name "~/Archiv/Programmierprojekte/Python/virtualenv/")) (setenv "WORKON_HOME" (expand-file-name "~/Archiv/Programmierprojekte/Python/virtualenv/"))
:config :config
(pyvenv-mode t) (pyvenv-mode t)
(defun my/post-activate-hook()
(defun my/pyvenv-post-activate-hook()
(setq jedi:environment-root pyvenv-virtual-env) (setq jedi:environment-root pyvenv-virtual-env)
(setq jedi:environment-virtualenv pyvenv-virtual-env) (setq jedi:environment-virtualenv pyvenv-virtual-env)
(setq jedi:tooltip-method '(nil)) ;; variants: nil or pos-tip and/or popup (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 ;; default traceback, other option M-x jedi:toggle-log-traceback
;; traceback is in jedi:pop-to-epc-buffer ;; traceback is in jedi:pop-to-epc-buffer
(jedi:setup) (jedi:setup)
(company/python-mode-hook)
;; (company/python-mode-hook)
(setq jedi:server-args '("--log-traceback")) (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 #+END_SRC
I want Emacs to automatically start the proper virtual environment. 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/ Required is a .python-version file with, content in the first line being /path/to/virtualenv/
[[https://github.com/marcwebbie/auto-virtualenv][Github source]] [[https://github.com/marcwebbie/auto-virtualenv][Github source]]
Depends on pyvenv Depends on pyvenv
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(use-package auto-virtualenv (use-package auto-virtualenv
:ensure t :ensure t

Loading…
Cancel
Save