Touch up the previous commit
This commit is contained in:
parent
7226716739
commit
efddd76ae5
1 changed files with 20 additions and 11 deletions
|
@ -9,8 +9,10 @@
|
|||
|
||||
;;; Commentary:
|
||||
|
||||
;; Some basic configuration for python.el (the latest and greatest
|
||||
;; Python mode Emacs has to offer).
|
||||
;; Enhanced configuration for python.el (the latest and greatest
|
||||
;; Python mode Emacs has to offer). Most notably Prelude leverages
|
||||
;; anaconda mode to provide code navigation, documentation lookup and
|
||||
;; completion for Python.
|
||||
|
||||
;;; License:
|
||||
|
||||
|
@ -31,21 +33,26 @@
|
|||
|
||||
;;; Code:
|
||||
|
||||
(defcustom prelude-python-mode-set-encoding-automatically nil
|
||||
"Non-nil values enable auto insertion of '# coding: utf-8' on python buffers."
|
||||
:type 'boolean
|
||||
:group 'prelude)
|
||||
(require 'electric)
|
||||
(require 'prelude-programming)
|
||||
|
||||
;; Code navigation, documentation lookup and completion for Python
|
||||
(prelude-require-package 'anaconda-mode)
|
||||
|
||||
(when (boundp 'company-backends)
|
||||
(prelude-require-package 'company-anaconda)
|
||||
(add-to-list 'company-backends 'company-anaconda))
|
||||
|
||||
(require 'electric)
|
||||
(require 'prelude-programming)
|
||||
(defcustom prelude-python-mode-set-encoding-automatically nil
|
||||
"Non-nil values enable auto insertion of '# coding: utf-8' on python buffers."
|
||||
:type 'boolean
|
||||
:group 'prelude)
|
||||
|
||||
;; Copy pasted from ruby-mode.el
|
||||
;;; Encoding detection/insertion logic
|
||||
;;
|
||||
;; Adapted from ruby-mode.el
|
||||
;;
|
||||
;; This logic was useful in Python 2, but it's not really needed in Python 3.
|
||||
(defun prelude-python--encoding-comment-required-p ()
|
||||
(re-search-forward "[^\0-\177]" nil t))
|
||||
|
||||
|
@ -84,14 +91,16 @@
|
|||
(when (buffer-modified-p)
|
||||
(basic-save-buffer-1)))))))
|
||||
|
||||
;;; python-mode setup
|
||||
|
||||
(when (fboundp 'exec-path-from-shell-copy-env)
|
||||
(exec-path-from-shell-copy-env "PYTHONPATH"))
|
||||
|
||||
(defun prelude-python-mode-defaults ()
|
||||
"Defaults for Python programming."
|
||||
(subword-mode +1)
|
||||
(anaconda-mode 1)
|
||||
(eldoc-mode 1)
|
||||
(anaconda-mode +1)
|
||||
(eldoc-mode +1)
|
||||
(setq-local electric-layout-rules
|
||||
'((?: . (lambda ()
|
||||
(and (zerop (first (syntax-ppss)))
|
||||
|
|
Loading…
Reference in a new issue