Function: kimport:star-outline
kimport:star-outline is an autoloaded, interactive and byte-compiled
function defined in kimport.el.
Signature
(kimport:star-outline IMPORT-FROM OUTPUT-TO &optional CHILDREN-FLAG)
Documentation
Insert star outline nodes from IMPORT-FROM into koutline OUTPUT-TO.
Display and leave point in OUTPUT-TO. See documentation for kimport:initialize for valid values of IMPORT-FROM and OUTPUT-TO and for an explanation of where imported cells are placed.
"* " = level 1, "** " = level 2 in outline and so on.
Key Bindings
Source Code
;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/kotl/kimport.el
;;;
;;; Emacs outliner style files, leading `*' cell delimiters
;;;
;;;###autoload
(defun kimport:star-outline (import-from output-to &optional children-flag)
"Insert star outline nodes from IMPORT-FROM into koutline OUTPUT-TO.
Display and leave point in OUTPUT-TO. See documentation for
`kimport:initialize' for valid values of IMPORT-FROM and
OUTPUT-TO and for an explanation of where imported cells are
placed.
\"* \" = level 1, \"** \" = level 2 in outline and so on."
(interactive "fImport from star delimited cells buffer/file: \nFBuffer/file to insert cells into: \nP")
(when (and (hypb:buffer-file-name) (directory-name-p import-from))
(setq import-from (hypb:buffer-file-name)))
(when (and (hypb:buffer-file-name) (directory-name-p output-to))
(setq output-to (concat (file-name-sans-extension (hypb:buffer-file-name)) ".kotl")))
(let ((output-level 1) (klabel "1") (count 0)
max-pos-and-count initially-empty-output no-renumber orig-point total)
;; Don't change the order of import-from and output-to inits here.
(setq import-from (kimport:copy-and-set-buffer import-from)
;; Set current buffer to output-to
output-to (kimport:initialize output-to t)
orig-point (point)
initially-empty-output (zerop (- (point-max) (point-min)))
no-renumber (or initially-empty-output
(not (if children-flag
(kcell-view:child-p)
(kcell-view:sibling-p)))))
(when (eq import-from output-to)
(error "(kimport:star-outline): Import and output buffers may not be the same"))
(set-buffer import-from)
(outline-show-all)
(save-excursion
(goto-char (point-min))
;; If initial text in buffer is not a star outline node, add a star to
;; make it one, so it is not deleted from the import.
(unless (looking-at kimport:star-heading)
(insert "* "))
(goto-char (point-min))
;; Total number of top-level cells.
(setq total (count-matches "^[ \t]*\\*\\s-"))
(unless initially-empty-output
;; Insert first cell as sibling of current cell.
(set-buffer output-to)
(cond (children-flag
;; Insert as children.
(setq klabel (klabel:child (kcell-view:label))
output-level (klabel:level klabel))
;; Move to end of this cell since cell insertion will
;; occur at point.
(goto-char (kcell-view:end)))
((string-empty-p (kcell-view:contents))
;; This is an unused cell, fill in from here.
(setq klabel (kcell-view:label)
output-level (klabel:level klabel))
(goto-char (kcell-view:start)))
(t ;; Insert as successors.
(setq klabel (klabel:increment (kcell-view:label))
output-level (klabel:level klabel))
;; Move to start of line of next tree since cell insertion
;; will occur at point.
(goto-char (kotl-mode:tree-end)))))
(setq max-pos-and-count (kimport:star-entries
import-from output-to klabel output-level 1 count total 0)
count (cdr max-pos-and-count)))
(pop-to-buffer output-to)
(kfile:narrow-to-kcells)
(unless no-renumber
(klabel-type:update-labels klabel))
(goto-char orig-point)
(unless (kotl-mode:buffer-empty-p)
(kotl-mode:to-valid-position))
(message "Imported %d of %d star outline trees." count total)))