Function: kotl-mode:add-before-parent

kotl-mode:add-before-parent is an interactive and byte-compiled function defined in kotl-mode.el.

Signature

(kotl-mode:add-before-parent &optional CELLS-TO-ADD CONTENTS PLIST NO-FILL)

Documentation

Add prior sibling cells to the current cell's parent.

Return the last one added.

If on the first level of the outline (parent is the hidden root cell
0), insert cells at the start of the outline.

Optional prefix arg number of CELLS-TO-ADD defaults to 1. Add new cells with optional CONTENTS string, attributes in PLIST, a property list, and NO-FILL flag to prevent any filling of CONTENTS.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/kotl/kotl-mode.el
(defun kotl-mode:add-before-parent (&optional cells-to-add contents plist no-fill)
  "Add prior sibling cells to the current cell's parent.
Return the last one added.

If on the first level of the outline (parent is the hidden root cell
0), insert cells at the start of the outline.

Optional prefix arg number of CELLS-TO-ADD defaults to 1.  Add
new cells with optional CONTENTS string, attributes in PLIST, a
property list, and NO-FILL flag to prevent any filling of
CONTENTS."
  (interactive "*p")
  (when (null cells-to-add) (setq cells-to-add 1))
  (unless (and (natnump cells-to-add) (/= cells-to-add 0))
    (error "(kotl-mode:add-before-parent): `cells-to-add' must be a positive integer"))
  ;; Add first cell as the prior sibling to the parent or if at level
  ;; 1 in the outline, add as the first outline cell
  (let ((last-added-cell
	 (if (kotl-mode:up-level 1)
	     ;; Add preceding sibling cell to parent
	     (kotl-mode:add-cell -1 contents plist no-fill)
	   ;; Add as first outline cell
	   (kotl-mode:beginning-of-buffer)
	   (kotl-mode:add-cell 1 contents plist no-fill))))
    (if (> (setq cells-to-add (1- cells-to-add)) 0)
	(kotl-mode:add-cell cells-to-add contents plist no-fill)
      last-added-cell)))