Created
May 9, 2013 14:27
-
-
Save dove-young/5547778 to your computer and use it in GitHub Desktop.
Automatic outline-minor-mode settings for GNU Emacs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (defun set-outline-minor-mode-regexp () | |
| "" | |
| (outline-minor-mode 1) | |
| (let ((regexp-list (append outline-minor-mode-list nil)) | |
| (find-regexp | |
| (lambda (lst) | |
| "" | |
| (let ((innerList (car lst))) | |
| (if innerList | |
| (if (string= (car innerList) major-mode) | |
| (car (cdr innerList)) | |
| (progn (pop lst) | |
| (funcall find-regexp lst)))) | |
| )))) | |
| (make-local-variable 'outline-regexp) | |
| (setq outline-regexp (funcall find-regexp regexp-list))) | |
| (set-key-bindings 'local-set-key | |
| (list | |
| (list (kbd "C-c C-t") 'hide-body) | |
| (list (kbd "C-c C-a") 'show-all) | |
| (list (kbd "C-c C-e") 'show-entry)))) | |
| (setq outline-minor-mode-list | |
| (list '(emacs-lisp-mode "(defun\\|(defvar\\|(defcustom\\|(defconst\\|(defmacro") | |
| '(shell-mode "^dove@zsh.*[#%\$] ") | |
| '(sh-mode "function .*[{(]") | |
| '(perl-mode "sub ") | |
| '(eshell-mode "^[^#$\n]* [#$] ") | |
| '(ruby-mode "[ ]+def \\|cloud_pattern\\|[ ]+cloud_node") | |
| '(Man-mode "^[A-Z]+") | |
| )) | |
| (mapc (lambda (mode-name) | |
| (add-hook mode-name 'set-outline-minor-mode-regexp t)) | |
| '(shell-mode-hook | |
| sh-mode-hook | |
| emacs-lisp-mode-hook | |
| eshell-mode-hook | |
| ruby-mode-hook | |
| Man-mode-hook | |
| )) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment