summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2022-06-15 01:52:19 +0100
committerjao <jao@gnu.org>2022-06-15 01:52:19 +0100
commit36de8f6269798e12fc68ec1b139332dc55365f31 (patch)
tree7b742b0848964e62bd9b414138c931c8e24c1b80
parentdf2de54b62180413528ce0ada1a31160c360677c (diff)
downloadelibs-36de8f6269798e12fc68ec1b139332dc55365f31.tar.gz
elibs-36de8f6269798e12fc68ec1b139332dc55365f31.tar.bz2
jao-outline: toggle command
-rw-r--r--init.el24
1 files changed, 17 insertions, 7 deletions
diff --git a/init.el b/init.el
index dee3cbc..86ab5fb 100644
--- a/init.el
+++ b/init.el
@@ -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