comparison .elisp/settings/40.modes.el @ 430:5843408c9a38

modes: try and clean up python indentation a bit
author Augie Fackler <raf@durin42.com>
date Fri, 28 Apr 2017 14:52:18 -0400
parents 95621f473f7e
children 601884c45f8a
comparison
equal deleted inserted replaced
429:27e8ad5acedf 430:5843408c9a38
59 (local-set-key (kbd "RET") 59 (local-set-key (kbd "RET")
60 'reindent-then-newline-and-indent))) 60 'reindent-then-newline-and-indent)))
61 (defun af-python-mode-hook () 61 (defun af-python-mode-hook ()
62 ; highlight tabs in Python 62 ; highlight tabs in Python
63 (make-variable-buffer-local 'font-lock-mode-hook) 63 (make-variable-buffer-local 'font-lock-mode-hook)
64 (make-variable-buffer-local 'python-indent)
65 (if (and buffer-file-name (string-match "melange" buffer-file-name))
66 (set-variable 'python-indent 2))
67 (af-tab-fix) 64 (af-tab-fix)
68 (easy-menu-add-item nil '("Python") ["Run All Tests" nosetests-all t] 65 (easy-menu-add-item nil '("Python") ["Run All Tests" nosetests-all t]
69 "Comment Out Region") 66 "Comment Out Region")
70 (easy-menu-add-item nil '("Python") ["Run All Tests with --failed" nosetests-failed t] 67 (easy-menu-add-item nil '("Python") ["Run All Tests with --failed" nosetests-failed t]
71 "Comment Out Region") 68 "Comment Out Region")
77 "Comment Out Region") 74 "Comment Out Region")
78 (easy-menu-add-item nil '("Python") ["-" nil t] "Comment Out Region") 75 (easy-menu-add-item nil '("Python") ["-" nil t] "Comment Out Region")
79 (local-set-key "\M-n" 'nosetests-module) 76 (local-set-key "\M-n" 'nosetests-module)
80 (local-set-key "\M-\C-n" 'nosetests-one) 77 (local-set-key "\M-\C-n" 'nosetests-one)
81 (local-set-key (kbd "RET") 'comment-indent-new-line) 78 (local-set-key (kbd "RET") 'comment-indent-new-line)
79 ; Match existing indentation in a file
80 (python-indent-guess-indent-offset)
82 ) 81 )
83 (add-hook 'python-mode-hook 'af-python-mode-hook) 82 (add-hook 'python-mode-hook 'af-python-mode-hook)
84 83
85 (add-hook 'compilation-mode-hook '(lambda () (local-set-key "g" 'recompile))) 84 (add-hook 'compilation-mode-hook '(lambda () (local-set-key "g" 'recompile)))
86 85