Fix virtualenv jedi.

This commit is contained in:
Ivan Malison 2014-11-13 21:53:57 -08:00
parent 4a7bac7e0e
commit 7be8a99428

34
init.el
View File

@ -79,6 +79,7 @@ Return a list of installed packages or nil for every package not installed."
(put 'set-goal-column 'disabled nil) (put 'set-goal-column 'disabled nil)
(auto-fill-mode -1) (auto-fill-mode -1)
(setq indent-tabs-mode nil)
;; No hsplits. EVER. ;; No hsplits. EVER.
(defun split-horizontally-for-temp-buffers () (split-window-horizontally)) (defun split-horizontally-for-temp-buffers () (split-window-horizontally))
@ -236,16 +237,8 @@ Return a list of installed packages or nil for every package not installed."
;; Python ;; Python
;; ============================================================================= ;; =============================================================================
(use-package python
:commands python-mode
:mode ("\\.py\\'" . python-mode)
:config
(progn
;; macros
(fset 'ipdb "import ipdb; ipdb.set_trace()")
(fset 'main "if __name__ == '__main__':")
(fset 'sphinx-class ":class:`~")
(defvar use-python-tabs nil) (defvar use-python-tabs nil)
(defun python-tabs () (setq tab-width 4 (defun python-tabs () (setq tab-width 4
indent-tabs-mode t indent-tabs-mode t
python-indent-offset 4)) python-indent-offset 4))
@ -259,9 +252,8 @@ Return a list of installed packages or nil for every package not installed."
(apply #'append (mapcar (lambda (env) `("-v" ,env)) virtual-envs))) (apply #'append (mapcar (lambda (env) `("-v" ,env)) virtual-envs)))
(defun get-virtual-envs () (defun get-virtual-envs ()
(interactive)
(condition-case ex (condition-case ex
(let (project-root (projectile-project-root)) (let ((project-root (projectile-project-root)))
(cl-remove-if-not 'file-exists-p (cl-remove-if-not 'file-exists-p
(mapcar (lambda (env-suffix) (mapcar (lambda (env-suffix)
(concat project-root env-suffix)) (concat project-root env-suffix))
@ -269,7 +261,21 @@ Return a list of installed packages or nil for every package not installed."
('error ('error
(message (format "Caught exception: [%s]" ex)) (message (format "Caught exception: [%s]" ex))
(setq retval (cons 'exception (list ex)))) (setq retval (cons 'exception (list ex))))
nil))) nil))
(defun message-virtual-envs ()
(interactive)
(message "%s" (get-virtual-envs)))
(use-package python
:commands python-mode
:mode ("\\.py\\'" . python-mode)
:config
(progn
;; macros
(fset 'ipdb "import ipdb; ipdb.set_trace()")
(fset 'main "if __name__ == '__main__':")
(fset 'sphinx-class ":class:`~")
:init :init
(progn (progn
(use-package jedi (use-package jedi
@ -280,10 +286,10 @@ Return a list of installed packages or nil for every package not installed."
(use-package pymacs :ensure t) (use-package pymacs :ensure t)
(use-package sphinx-doc :ensure t) (use-package sphinx-doc :ensure t)
(add-hook 'python-mode-hook (lambda () (setq show-trailing-whitespace t))) (add-hook 'python-mode-hook (lambda () (setq show-trailing-whitespace t)))
(add-hook 'python-mode-hook (lambda () (if use-python-tabs python-tabs))) (add-hook 'python-mode-hook (lambda () (if use-python-tabs (python-tabs))))
(add-hook 'python-mode-hook (lambda () (subword-mode t))) (add-hook 'python-mode-hook (lambda () (subword-mode t)))
(add-hook 'python-mode-hook #'jedi:setup) (add-hook 'python-mode-hook #'jedi:setup)
(add-hook 'python-mode-hook #'add-virtual-envs-to-jedi-server))) (add-hook 'python-mode-hook #'add-virtual-envs-to-jedi-server))))
;; ============================================================================= ;; =============================================================================
;; Scala ;; Scala