From 86e8b035922f4a33816ead9bf6379c9ff7d8791c Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Fri, 18 Dec 2015 01:03:41 +0100 Subject: Move python-mode-func to Python library --- emacs/.emacs.d/site-lisp/oni-python.el | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'emacs/.emacs.d/site-lisp/oni-python.el') diff --git a/emacs/.emacs.d/site-lisp/oni-python.el b/emacs/.emacs.d/site-lisp/oni-python.el index 6a0ff03..7dc6f21 100644 --- a/emacs/.emacs.d/site-lisp/oni-python.el +++ b/emacs/.emacs.d/site-lisp/oni-python.el @@ -25,7 +25,9 @@ ;;; Code: +(require 'fill-column-indicator) (require 'python) +(require 'whitespace) ;;;###autoload (defun oni:add-import-from (package import) @@ -49,6 +51,11 @@ (match-end 1)) results))) results)) +;;;###autoload +(defun oni:clear-electric-indent-chars () + "Clear the `electric-indent-chars' which don't work well in Python." + (set (make-local-variable 'electric-indent-chars) nil)) + ;;;###autoload (defun oni:make-import-multiline (from-point to-point) "Turn an import statement into a multi-line import statement." @@ -70,6 +77,27 @@ (forward-line -1) (oni:sort-imports))) +;;;###autoload +(defun oni:set-keys-for-python () + "Set Python mode-specific keybindings." + (define-key python-mode-map (kbd "C->") #'python-indent-shift-right) + (define-key python-mode-map (kbd "C-<") #'python-indent-shift-left)) + +;;;###autoload +(defun oni:set-pep8-fill-column () + "Set the `fill-column' to the PEP 8 recommendation." + (setq-local fill-column 72)) + +;;;###autoload +(defun oni:set-pep8-margin () + "Set the `fci-rule-column' the the PEP 8 recommendation." + (setq-local fci-rule-column 79)) + +;;;###autoload +(defun oni:set-whitespace-tab-display () + "Set the `whitespace-style' to show only tabs." + (setq-local whitespace-style '(tab-mark))) + ;;;###autoload (defun oni:sort-imports () "Sort python multiline imports using `()'." -- cgit v1.2.3-54-g00ecf