-
-
Notifications
You must be signed in to change notification settings - Fork 61
/
Copy pathorg-tree-slide-compt.el
50 lines (46 loc) · 1.66 KB
/
org-tree-slide-compt.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
;; These functions shall be loaded for Emacs 25.1 or earlier.
;; outline-show-children <- show-children
;; outline-show-subtree <- show-subtree
;; outline-hide-subtree <- hide-subtree
(defun outline-show-children (&optional level)
"Show all direct subheadings of this heading.
Prefix arg LEVEL is how many levels below the current level should be shown.
Default is enough to cause the following heading to appear."
(interactive "P")
(setq level
(if level (prefix-numeric-value level)
(save-excursion
(outline-back-to-heading)
(let ((start-level (funcall outline-level)))
(outline-next-heading)
(if (eobp)
1
(max 1 (- (funcall outline-level) start-level)))))))
(let (outline-view-change-hook)
(save-excursion
(outline-back-to-heading)
(setq level (+ level (funcall outline-level)))
(outline-map-region
(lambda ()
(if (<= (funcall outline-level) level)
(outline-show-heading)))
(point)
(progn (outline-end-of-subtree)
(if (eobp) (point-max) (1+ (point)))))))
(run-hooks 'outline-view-change-hook))
(defun outline-show-subtree (&optional event)
"Show everything after this heading at deeper levels.
If non-nil, EVENT should be a mouse event."
(interactive (list last-nonmenu-event))
(save-excursion
(when (mouse-event-p event)
(mouse-set-point event))
(outline-flag-subtree nil)))
(defun outline-hide-subtree (&optional event)
"Hide everything after this heading at deeper levels.
If non-nil, EVENT should be a mouse event."
(interactive (list last-nonmenu-event))
(save-excursion
(when (mouse-event-p event)
(mouse-set-point event))
(outline-flag-subtree t)))