Function: kvspec:levels-to-show

kvspec:levels-to-show is a byte-compiled function defined in kvspec.el.

Signature

(kvspec:levels-to-show LEVELS-TO-KEEP)

Documentation

Hide all cells in outline at levels deeper than LEVELS-TO-KEEP (a number).

Shows any hidden cells within LEVELS-TO-KEEP. 1 is the first level. 0 means display all levels of cells.

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/kotl/kvspec.el
(defun kvspec:levels-to-show (levels-to-keep)
  "Hide all cells in outline at levels deeper than LEVELS-TO-KEEP (a number).
Shows any hidden cells within LEVELS-TO-KEEP.  1 is the first level.  0 means
display all levels of cells."
  (if (null levels-to-keep)
      (setq levels-to-keep
	    (read-from-minibuffer "Show cells down to level (0 = show all levels): "
				  nil nil t)))
  (setq levels-to-keep (prefix-numeric-value levels-to-keep))
  (if (< levels-to-keep 0)
      (error "(kvspec:levels-to-show): Must display at least one level"))
  (kview:map-tree
   (lambda (_kview)
     (if (/= (kcell-view:level) levels-to-keep)
	 (kotl-mode:show-tree)
       (kotl-mode:hide-subtree)
       ;; Move to last cell in hidden subtree, to skip further
       ;; processing of these cells.
       (if (kcell-view:next t)
	   (kcell-view:previous)
	 (goto-char (point-max)))))
   kotl-kview t)
  (kview:set-attr kotl-kview 'levels-to-show levels-to-keep))