From d9cae60fa5048abd3528f96a285109329639fda6 Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Fri, 23 Jan 2015 23:23:05 -0500 Subject: Improve organization and consistency of files - Add pages and more headings for large files. - Try to use consistent order for file (or page) structure. * Loading * Settings * Hooks * Any mode activation or function calls * My functions * Key bindings --- lisp/init-python.el | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-) (limited to 'lisp/init-python.el') diff --git a/lisp/init-python.el b/lisp/init-python.el index b16a005..2003777 100644 --- a/lisp/init-python.el +++ b/lisp/init-python.el @@ -1,9 +1,17 @@ +(setq python-fill-docstring-style 'pep-257-nn) + +(setq jedi:tooltip-method nil + ac-auto-start nil) + +(add-to-list 'interpreter-mode-alist '("python2" . python-mode)) +(add-to-list 'interpreter-mode-alist '("python3" . python-mode)) (add-hook 'python-mode-hook 'jedi:setup) (add-hook 'python-mode-hook 'auto-complete-mode) -(setq jedi:tooltip-method nil - ac-auto-start nil) +(defun km/python-hook () + (set (make-local-variable 'compile-command) "py.test")) +(add-hook 'python-mode-hook 'km/python-hook) ;; http://www.emacswiki.org/emacs/PythonProgrammingInEmacs#toc5 (defun km/setup-ipython-shell () @@ -95,33 +103,23 @@ This is inspired by `ess-eval-function-or-paragraph-and-step'." (goto-char pos) n)) -(define-prefix-command 'km/python-prefix-map) -(define-key km/python-prefix-map "t" 'km/find-python-test-file-other-window) - (after 'python - (define-key python-mode-map (kbd "C-c m") 'km/python-prefix-map) + (key-chord-define python-mode-map ";w" 'auto-complete) + (define-key python-mode-map (kbd "C-c C-.") + 'km/python-shell-send-buffer-up-to-point) + (define-key python-mode-map (kbd "C-c C-b") 'python-shell-send-buffer) ;; Rebind `python-shell-send-buffer'. (define-key python-mode-map (kbd "C-c C-c") 'km/python-shell-send-function-or-paragraph-and-step) - (define-key python-mode-map (kbd "C-c C-b") 'python-shell-send-buffer) - (define-key python-mode-map (kbd "C-c C-.") - 'km/python-shell-send-buffer-up-to-point) - - (key-chord-define python-mode-map ";w" 'auto-complete) ;; Swap `python-shell-send-defun' and `python-eldoc-at-point'. (define-key python-mode-map (kbd "C-c C-f") 'python-shell-send-defun) - (define-key python-mode-map (kbd "C-M-x") 'python-eldoc-at-point)) - -(defun km/python-hook () - (set (make-local-variable 'compile-command) "py.test")) - -(add-hook 'python-mode-hook 'km/python-hook) + (define-key python-mode-map (kbd "C-M-x") 'python-eldoc-at-point) -(add-to-list 'interpreter-mode-alist '("python2" . python-mode)) -(add-to-list 'interpreter-mode-alist '("python3" . python-mode)) + (define-prefix-command 'km/python-prefix-map) + (define-key python-mode-map (kbd "C-c m") 'km/python-prefix-map) -(setq python-fill-docstring-style 'pep-257-nn) + (define-key km/python-prefix-map "t" 'km/find-python-test-file-other-window)) (provide 'init-python) -- cgit v1.2.3