2015-01-14 04:12:56 +00:00
|
|
|
;;; extensions.el --- Python Layer extensions File for Spacemacs
|
|
|
|
;;
|
|
|
|
;; Copyright (c) 2012-2014 Sylvain Benner
|
|
|
|
;; Copyright (c) 2014-2015 Sylvain Benner & Contributors
|
|
|
|
;;
|
|
|
|
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
|
|
|
|
;; URL: https://github.com/syl20bnr/spacemacs
|
|
|
|
;;
|
|
|
|
;; This file is not part of GNU Emacs.
|
|
|
|
;;
|
|
|
|
;;; License: GPLv3
|
2014-11-10 04:54:10 +00:00
|
|
|
|
|
|
|
;; Pre extensions are loaded *before* the packages
|
2015-04-22 04:02:23 +00:00
|
|
|
(setq python-pre-extensions '())
|
2014-11-10 04:54:10 +00:00
|
|
|
|
|
|
|
;; Post extensions are loaded *after* the packages
|
2015-04-19 03:57:27 +00:00
|
|
|
(setq python-post-extensions
|
2014-11-10 04:54:10 +00:00
|
|
|
'(
|
2015-06-08 03:59:23 +00:00
|
|
|
nose
|
2014-11-10 04:54:10 +00:00
|
|
|
pylookup
|
2015-04-12 14:17:29 +00:00
|
|
|
python-compile
|
|
|
|
py-yapf
|
2014-11-10 04:54:10 +00:00
|
|
|
))
|
|
|
|
|
|
|
|
;; Initialize the extensions
|
|
|
|
|
|
|
|
(defun python/init-nose ()
|
|
|
|
(use-package nose
|
2015-06-08 03:59:23 +00:00
|
|
|
:if (eq 'nose python-test-runner)
|
2014-11-10 04:54:10 +00:00
|
|
|
:commands (nosetests-one
|
|
|
|
nosetests-pdb-one
|
|
|
|
nosetests-all
|
|
|
|
nosetests-pdb-all
|
|
|
|
nosetests-module
|
|
|
|
nosetests-pdb-module
|
|
|
|
nosetests-suite
|
|
|
|
nosetests-pdb-suite)
|
|
|
|
:init
|
|
|
|
(evil-leader/set-key-for-mode 'python-mode
|
|
|
|
"mTa" 'nosetests-pdb-all
|
|
|
|
"mta" 'nosetests-all
|
2014-12-09 01:58:35 +00:00
|
|
|
"mTb" 'nosetests-pdb-module
|
|
|
|
"mtb" 'nosetests-module
|
2014-12-10 04:40:26 +00:00
|
|
|
"mTt" 'nosetests-pdb-one
|
|
|
|
"mtt" 'nosetests-one
|
2014-11-10 04:54:10 +00:00
|
|
|
"mTm" 'nosetests-pdb-module
|
|
|
|
"mtm" 'nosetests-module
|
|
|
|
"mTs" 'nosetests-pdb-suite
|
|
|
|
"mts" 'nosetests-suite)
|
|
|
|
:config
|
|
|
|
(progn
|
|
|
|
(add-to-list 'nose-project-root-files "setup.cfg")
|
|
|
|
(setq nose-use-verbose nil)
|
|
|
|
)))
|
|
|
|
|
|
|
|
(defun python/init-pylookup ()
|
|
|
|
(use-package pylookup
|
|
|
|
:commands pylookup-lookup
|
2015-04-02 04:00:36 +00:00
|
|
|
:init
|
2014-11-10 04:54:10 +00:00
|
|
|
(progn
|
2015-04-02 04:00:36 +00:00
|
|
|
(evilify pylookup-mode pylookup-mode-map)
|
2014-12-09 03:19:55 +00:00
|
|
|
(evil-leader/set-key-for-mode 'python-mode
|
2015-04-02 04:00:36 +00:00
|
|
|
"mhH" 'pylookup-lookup))
|
|
|
|
:config
|
|
|
|
(progn
|
2014-12-25 19:45:27 +00:00
|
|
|
(let ((dir (configuration-layer/get-layer-property 'python :ext-dir)))
|
2014-11-10 04:54:10 +00:00
|
|
|
(setq pylookup-dir (concat dir "/pylookup")
|
|
|
|
pylookup-program (concat pylookup-dir "/pylookup.py")
|
|
|
|
pylookup-db-file (concat pylookup-dir "/pylookup.db"))))))
|
2015-04-12 14:17:29 +00:00
|
|
|
|
|
|
|
(defun python/init-py-yapf ()
|
|
|
|
(use-package py-yapf
|
|
|
|
:init
|
2015-04-22 04:02:23 +00:00
|
|
|
(evil-leader/set-key-for-mode 'python-mode "m=" 'py-yapf-buffer)
|
2015-04-12 14:17:29 +00:00
|
|
|
:config
|
2015-04-22 04:02:23 +00:00
|
|
|
(if python-enable-yapf-format-on-save
|
|
|
|
(add-hook 'python-mode-hook 'py-yapf-enable-on-save))))
|