Massive refactor. Refactor all the things

This commit is contained in:
Henrik Lissner 2016-04-23 22:08:46 -04:00
parent 03514fc09d
commit f234be68a4
56 changed files with 792 additions and 831 deletions

View file

@ -17,55 +17,59 @@
python-shell-completion-string-code
"';'.join(get_ipython().Completer.all_completions('''%s'''))\n")
(define-docset! python-mode "py,py3,python")
(define-env-command! python-mode "python --version 2>&1 | cut -d' ' -f2")
(define-repl! python-mode narf/inf-python)
(add-hook! python-mode '(emr-initialize narf|flycheck-enable-maybe))
(def-company-backend! python-mode (anaconda))
(def-docset! python-mode "py,py3,python")
(def-env-command! python-mode "python --version 2>&1 | cut -d' ' -f2")
(def-repl! python-mode narf/inf-python)
(add-hook 'python-mode-hook 'flycheck-mode)
:config
(define-key python-mode-map (kbd "DEL") nil) ; interferes with smartparens
(define-key python-mode-map (kbd "DEL") nil)) ; interferes with smartparens
(use-package anaconda-mode
:init
(add-hook! python-mode '(anaconda-mode anaconda-eldoc-mode eldoc-mode))
(setq anaconda-mode-installation-directory (concat narf-temp-dir "/anaconda/")
anaconda-mode-eldoc-as-single-line t)
(use-package anaconda-mode
:after python
:init
(add-hook! python-mode '(anaconda-mode anaconda-eldoc-mode eldoc-mode))
(setq anaconda-mode-installation-directory (concat narf-temp-dir "/anaconda/")
anaconda-mode-eldoc-as-single-line t)
:config
(map! :map anaconda-mode-map :m "gd" 'anaconda-mode-find-definitions)
(map! :map anaconda-nav-mode-map :n [escape] 'anaconda-nav-quit)
:config
(map! :map anaconda-mode-map :m "gd" 'anaconda-mode-find-definitions)
(map! :map anaconda-nav-mode-map :n [escape] 'anaconda-nav-quit)
(advice-add 'anaconda-mode-doc-buffer :after 'narf*anaconda-mode-doc-buffer)
(advice-add 'anaconda-mode-doc-buffer :after 'narf*anaconda-mode-doc-buffer))
(require 'company-anaconda)
(define-company-backend! python-mode (anaconda))
(after! emr
(mapc (lambda (x)
(let ((command-name (car x))
(title (cadr x))
(region-p (caddr x))
predicate)
(setq predicate (lambda () (and (anaconda-mode-running-p)
(not (use-region-p))
(not (sp-point-in-string-or-comment)))))
(emr-declare-command (intern (format "anaconda-mode-%s" (symbol-name command-name)))
:title title :modes 'python-mode :predicate predicate)))
'((show-doc "view documentation" t)
(find-assignments "find assignments" t)
(find-definitions "find definitions" t)
(find-file "find assignments" t)
(find-references "show usages" nil))))))
(use-package company-anaconda
:after anaconda-mode
:init (add-hook 'anaconda-mode-hook 'emr-initialize)
:config
(mapc (lambda (x)
(let ((command-name (car x))
(title (cadr x))
(region-p (caddr x))
predicate)
(setq predicate (lambda () (and (anaconda-mode-running-p)
(not (use-region-p))
(not (sp-point-in-string-or-comment)))))
(emr-declare-command (intern (format "anaconda-mode-%s" (symbol-name command-name)))
:title title :modes 'python-mode :predicate predicate)))
'((show-doc "view documentation" t)
(find-assignments "find assignments" t)
(find-definitions "find definitions" t)
(find-file "find assignments" t)
(find-references "show usages" nil))))
(use-package pip-requirements
:mode ("/requirements.txt$" . pip-requirements-mode)
:config (define-company-backend! pip-requirements-mode (capf)))
:config (def-company-backend! pip-requirements-mode (capf)))
(use-package nose
:commands nose-mode
:preface (defvar nose-mode-map (make-sparse-keymap))
:init (associate! nose-mode :match "/test_.+\\.py$" :in (python-mode))
:init
(associate! nose-mode :match "/test_.+\\.py$" :in (python-mode))
(def-yas-mode! 'nose-mode)
:config
(add-yas-minor-mode! 'nose-mode)
(map! :map nose-mode-map
(:localleader
:n "tr" 'nosetests-again