Function: foldout-zoom-subtree
foldout-zoom-subtree is an interactive and byte-compiled function
defined in foldout.el.gz.
Signature
(foldout-zoom-subtree &optional EXPOSURE)
Documentation
Open the subtree under the current heading and narrow to it.
Normally the body and the immediate subheadings are exposed, but optional arg EXPOSURE (interactively with prefix arg) changes this:-
EXPOSURE > 0 exposes n levels of subheadings (c.f. show-children)
EXPOSURE < 0 exposes only the body
EXPOSURE = 0 exposes the entire subtree
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/foldout.el.gz
(defun foldout-zoom-subtree (&optional exposure)
"Open the subtree under the current heading and narrow to it.
Normally the body and the immediate subheadings are exposed, but
optional arg EXPOSURE \(interactively with prefix arg) changes this:-
EXPOSURE > 0 exposes n levels of subheadings (c.f. `show-children')
EXPOSURE < 0 exposes only the body
EXPOSURE = 0 exposes the entire subtree"
(interactive "P")
(save-excursion
(widen)
(outline-back-to-heading)
(let* ((exposure-value (prefix-numeric-value exposure))
(start (point))
(start-marker (point-marker))
(end (progn (outline-end-of-subtree)
(skip-chars-forward "\n\^M")
(point)))
;; I need a marker that will follow the end of the region even when
;; text is inserted right at the end. Text gets inserted *after*
;; markers, so I need it at end+1. Unfortunately I can't set a
;; marker at (point-max)+1, so I use nil to mean the region ends at
;; (point-max).
(end-marker (if (eobp) nil (set-marker (make-marker) (1+ end))))
)
;; narrow to this subtree
(narrow-to-region start end)
;; show the body and/or subheadings for this heading
(goto-char start)
(cond
((null exposure)
(outline-show-entry)
(outline-show-children))
((< exposure-value 0)
(outline-show-entry))
((consp exposure)
(outline-show-children))
((> exposure-value 0)
(outline-show-children exposure-value))
(t
(outline-show-subtree)))
;; save the location of the fold we are entering
(setq foldout-fold-list (cons (cons start-marker end-marker)
foldout-fold-list))
;; update the mode line
(foldout-update-mode-line))))