Flat index with python imenu

This commit is contained in:
toctan 2014-08-30 23:30:16 +08:00
parent d74147f618
commit e379c876c2

View file

@ -45,8 +45,8 @@
buffer-file-coding-system))) buffer-file-coding-system)))
(if coding-system (if coding-system
(symbol-name (symbol-name
(or (coding-system-get coding-system 'mime-charset) (or (coding-system-get coding-system 'mime-charset)
(coding-system-change-eol-conversion coding-system nil))) (coding-system-change-eol-conversion coding-system nil)))
"ascii-8bit"))) "ascii-8bit")))
(defun prelude-python--insert-coding-comment (encoding) (defun prelude-python--insert-coding-comment (encoding)
@ -78,9 +78,12 @@
"Defaults for Python programming." "Defaults for Python programming."
(subword-mode +1) (subword-mode +1)
(setq-local electric-layout-rules (setq-local electric-layout-rules
'((?: . (lambda () '((?: . (lambda ()
(if (python-info-statement-starts-block-p) (if (python-info-statement-starts-block-p)
'after))))) 'after)))))
(when (fboundp #'python-imenu-create-flat-index)
(setq-local imenu-create-index-function
#'python-imenu-create-flat-index))
(electric-layout-mode +1) (electric-layout-mode +1)
(add-hook 'after-save-hook 'prelude-python-mode-set-encoding nil 'local)) (add-hook 'after-save-hook 'prelude-python-mode-set-encoding nil 'local))