summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2015-07-31 21:46:00 -0400
committerKyle Meyer <kyle@kyleam.com>2015-07-31 21:46:00 -0400
commita7ed888cc820832b0f41e7d280c5fa38b103d9d8 (patch)
tree93fe51c61c987136c56ee722b74fdfd8ae655661
parent24b9c5ddfde46614158048febf53cd5b5586c4e1 (diff)
downloademacs.d-a7ed888cc820832b0f41e7d280c5fa38b103d9d8.tar.gz
Set up outline-minor-mode for python and elisp
-rw-r--r--lisp/init-elisp.el11
-rw-r--r--lisp/init-python.el7
2 files changed, 17 insertions, 1 deletions
diff --git a/lisp/init-elisp.el b/lisp/init-elisp.el
index a6cee16..e35a53d 100644
--- a/lisp/init-elisp.el
+++ b/lisp/init-elisp.el
@@ -1,4 +1,15 @@
(add-hook 'emacs-lisp-mode-hook 'lispy-mode)
+(add-hook 'emacs-lisp-mode-hook 'km/elisp-set-outline-vars)
+;; This likely breaks lispy's outline functions, but I don't use them.
+(add-hook 'lispy-mode-hook 'km/elisp-set-outline-vars)
+
+(defun km/elisp-outline-level ()
+ (and (looking-at (concat "^" outline-regexp))
+ (- (match-end 0) (match-beginning 0) 3)))
+
+(defun km/elisp-set-outline-vars ()
+ (setq outline-regexp ";;;;* ")
+ (setq outline-level 'km/elisp-outline-level))
(provide 'init-elisp)
diff --git a/lisp/init-python.el b/lisp/init-python.el
index 48c19dd..b27472f 100644
--- a/lisp/init-python.el
+++ b/lisp/init-python.el
@@ -13,12 +13,17 @@
'post-self-insert-hook
#'km/python-indent-post-self-insert-function 'append 'local)))
-
(defun km/python-set-local-vars ()
+ (setq outline-regexp "####* ")
+ (setq outline-level 'km/python-outline-level)
;; Stop semantic from taking over imenu.
(setq imenu-create-index-function #'python-imenu-create-index)
(set (make-local-variable 'compile-command) "py.test"))
+(defun km/python-outline-level ()
+ (and (looking-at (concat "^" outline-regexp))
+ (- (match-end 0) (match-beginning 0) 3)))
+
(defun km/toggle-ipython-shell ()
"Switch between using python and IPython for interactive shell."
(interactive)