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
|
2015-08-25 01:23:48 +00:00
|
|
|
"mtA" 'nosetests-pdb-all
|
2014-11-10 04:54:10 +00:00
|
|
|
"mta" 'nosetests-all
|
2015-08-25 01:23:48 +00:00
|
|
|
"mtB" 'nosetests-pdb-module
|
2014-12-09 01:58:35 +00:00
|
|
|
"mtb" 'nosetests-module
|
2015-08-25 01:23:48 +00:00
|
|
|
"mtT" 'nosetests-pdb-one
|
2014-12-10 04:40:26 +00:00
|
|
|
"mtt" 'nosetests-one
|
2015-08-25 01:23:48 +00:00
|
|
|
"mtM" 'nosetests-pdb-module
|
2014-11-10 04:54:10 +00:00
|
|
|
"mtm" 'nosetests-module
|
2015-08-25 01:23:48 +00:00
|
|
|
"mtS" 'nosetests-pdb-suite
|
2014-11-10 04:54:10 +00:00
|
|
|
"mts" 'nosetests-suite)
|
|
|
|
:config
|
|
|
|
(progn
|
|
|
|
(add-to-list 'nose-project-root-files "setup.cfg")
|
2015-08-25 01:23:48 +00:00
|
|
|
(setq nose-use-verbose nil))))
|
2014-11-10 04:54:10 +00:00
|
|
|
|
|
|
|
(defun python/init-pylookup ()
|
|
|
|
(use-package pylookup
|
2015-10-06 10:18:33 +00:00
|
|
|
:commands (pylookup-lookup pylookup-update pylookup-update-all)
|
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
|
2015-10-06 10:18:33 +00:00
|
|
|
(let ((dir (configuration-layer/get-layer-local-dir 'python)))
|
|
|
|
(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))))
|