From e379c876c2b770701be044ead7a374be54140002 Mon Sep 17 00:00:00 2001 From: toctan Date: Sat, 30 Aug 2014 23:30:16 +0800 Subject: [PATCH] Flat index with python imenu --- modules/prelude-python.el | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/modules/prelude-python.el b/modules/prelude-python.el index 1f7a44e..10ca704 100644 --- a/modules/prelude-python.el +++ b/modules/prelude-python.el @@ -45,8 +45,8 @@ buffer-file-coding-system))) (if coding-system (symbol-name - (or (coding-system-get coding-system 'mime-charset) - (coding-system-change-eol-conversion coding-system nil))) + (or (coding-system-get coding-system 'mime-charset) + (coding-system-change-eol-conversion coding-system nil))) "ascii-8bit"))) (defun prelude-python--insert-coding-comment (encoding) @@ -78,9 +78,12 @@ "Defaults for Python programming." (subword-mode +1) (setq-local electric-layout-rules - '((?: . (lambda () + '((?: . (lambda () (if (python-info-statement-starts-block-p) 'after))))) + (when (fboundp #'python-imenu-create-flat-index) + (setq-local imenu-create-index-function + #'python-imenu-create-flat-index)) (electric-layout-mode +1) (add-hook 'after-save-hook 'prelude-python-mode-set-encoding nil 'local))