diff options
author | jao <jao@gnu.org> | 2022-06-15 01:52:19 +0100 |
---|---|---|
committer | jao <jao@gnu.org> | 2022-06-15 01:52:19 +0100 |
commit | 36de8f6269798e12fc68ec1b139332dc55365f31 (patch) | |
tree | 7b742b0848964e62bd9b414138c931c8e24c1b80 | |
parent | df2de54b62180413528ce0ada1a31160c360677c (diff) | |
download | elibs-36de8f6269798e12fc68ec1b139332dc55365f31.tar.gz elibs-36de8f6269798e12fc68ec1b139332dc55365f31.tar.bz2 |
jao-outline: toggle command
-rw-r--r-- | init.el | 24 |
1 files changed, 17 insertions, 7 deletions
@@ -911,8 +911,8 @@ ;;;; cursor and mark (transient-mark-mode -1) (blink-cursor-mode -1) -(setq cursor-in-non-selected-windows nil) - +(setq cursor-in-non-selected-windows nil + visible-cursor nil) ;; stop blinking in xterm ;;;; uniquifiy (require 'uniquify) (setq uniquify-buffer-name-style 'forward @@ -2139,18 +2139,31 @@ (setq c-type-finder-time-slot nil) ;;;; outline minor mode +(defvar-local jao-outline-folded nil) +(dolist (v '(4 5 outline-show-only-headings)) + (add-to-list 'safe-local-variable-values `(outline-default-state . ,v))) + (setq outline-minor-mode-cycle t) -(defun jao-outline-minor-mode-hide-all (arg) +(defun jao-outline-minor-mode-hide-all (&optional arg) (interactive "P") (hide-sublevels (if arg 5 4))) +(defun jao-outline-minor-expand-all () + (when jao-outline-minor-mode (outline-show-all))) + +(defun jao-outline-minor-mode-toogle-fold (&optional arg) + (interactive "P") + (if (setq jao-outline-folded (not jao-outline-folded)) + (jao-outline-minor-mode-hide-all arg) + (jao-outline-minor-expand-all))) + (defvar jao-outline-minor-mode-map (let ((map (make-keymap))) (define-key map (kbd "C-c C-n") #'outline-next-visible-heading) (define-key map (kbd "C-c C-p") #'outline-previous-visible-heading) (define-key map (kbd "C-c o") 'consult-outline) - (define-key map (kbd "<f3>") #'jao-outline-minor-mode-hide-all) + (define-key map (kbd "<f3>") #'jao-outline-minor-mode-toogle-fold) map)) (use-package outline-minor-faces @@ -2168,9 +2181,6 @@ (outline-minor-mode -1) (outline-minor-faces-mode -1))) -(defun jao-outline-minor-expand-all () - (when jao-outline-minor-mode (outline-show-all))) - (add-hook 'find-function-after-hook #'jao-outline-minor-expand-all) ;;; Programming languages |