Function: kotl-mode:split-cell

kotl-mode:split-cell is an interactive and byte-compiled function defined in kotl-mode.el.

Signature

(kotl-mode:split-cell &optional ARG)

Documentation

Split the current cell into two cells and move to the new cell.

The cell contents after point become part of the newly created cell. The default is to create the new cell as a sibling of the current cell. With optional universal ARG, {\C-u}, the new cell is added as the child of the current cell. Non-read-only attributes from the current cell are replicated in the new cell.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/kotl/kotl-mode.el
(defun kotl-mode:split-cell (&optional arg)
  "Split the current cell into two cells and move to the new cell.
The cell contents after point become part of the newly created cell.
The default is to create the new cell as a sibling of the current cell.
With optional universal ARG, {\\`C-u'}, the new cell is added as the child of
the current cell.  Non-read-only attributes from the current cell are
replicated in the new cell."
  (interactive "*P")
  ;; delete any surrounding whitespace
  (delete-horizontal-space)
  (delete-region (point) (progn (skip-chars-backward "\n\r\t ") (point)))
  (let ((new-cell-contents (kotl-mode:kill-region
			    (point) (kcell-view:end-contents) 'string))
	(start (kcell-view:start))
	(current-plist (kcell-view:plist))
	plist
	prop
	val)

    ;; Create a plist for the new cell, dropping any kcell:read-only-attributes
    (while current-plist
      (setq prop (nth 0 current-plist)
	    val  (nth 1 current-plist))
      (setq current-plist (nthcdr 2 current-plist))
      (unless (memq prop kcell:read-only-attributes)
	(setq plist (cons prop (cons val plist)))))

    ;; delete copied text from prior cell
    (delete-region (max start (point)) (kcell-view:end-contents))
    (kotl-mode:add-cell arg new-cell-contents
			plist
			(kcell-view:get-attr 'no-fill))))