Function: kotl-mode:reveal-toggle-invisible
kotl-mode:reveal-toggle-invisible is a byte-compiled function defined
in kotl-mode.el.
Signature
(kotl-mode:reveal-toggle-invisible O HIDEP)
Source Code
;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/kotl/kotl-mode.el
;; Adapted from outline-reveal-toggle-invisible; called by isearch.
(defun kotl-mode:reveal-toggle-invisible (o hidep)
(if (not (derived-mode-p 'kotl-mode))
(if (and (eq (current-buffer) (get-buffer hyrolo-display-buffer))
(eq (hyrolo-cache-get-major-mode-from-pos (point))
'kotl-mode))
(hyrolo-funcall-match
(lambda () (outline-reveal-toggle-invisible o hidep))
t)
(outline-reveal-toggle-invisible o hidep))
(save-excursion
(goto-char (overlay-start o))
(if hidep
;; When hiding the area again, we could just clean it up and let
;; reveal do the rest, by simply doing:
;; (remove-overlays (overlay-start o) (overlay-end o)
;; 'invisible 'outline)
;;
;; That works fine as long as everything is in sync, but if the
;; structure of the document is changed while revealing parts of it,
;; the resulting behavior can be ugly. I.e. we need to make
;; sure that we hide exactly a subtree.
(let ((end (overlay-end o)))
(delete-overlay o)
(while (progn
(kotl-mode:hide-subtree)
(kotl-mode:to-visible-position)
(and (not (kotl-mode:eobp)) (< (point) end)))))
;; When revealing, we just need to reveal sublevels. If point is
;; inside one of the sublevels, reveal will call us again.
;; But we need to preserve the original overlay.
(let ((o1 (copy-overlay o)))
(overlay-put o 'invisible nil) ;Show (most of) the text.
(while (progn
(kotl-mode:show-tree)
;; Normally just the above is needed.
;; But in odd cases, the above might fail to show anything.
;; To avoid an infinite loop, we have to make sure that
;; *something* gets shown.
(and (equal (overlay-start o) (overlay-start o1))
(< (point) (overlay-end o))
(= 0 (kfill:forward-line 1)))))
;; If still nothing was shown, just kill the damn thing.
(when (equal (overlay-start o) (overlay-start o1))
;; I've seen it happen at the end of buffer.
(delete-overlay o1)))))))