Function: kcell-view:contents

kcell-view:contents is a byte-compiled function defined in kview.el.

Signature

(kcell-view:contents &optional POS PREFIX-FLAG)

Documentation

Return text of cell at optional POS or point.

Remove indentation from all but first line in the returned text.

With optional PREFIX-FLAG non-nil, include back to the start of the first line, i.e. include the autonumber prefix and indent.

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/kotl/kview.el
(defun kcell-view:contents (&optional pos prefix-flag)
  "Return text of cell at optional POS or point.
Remove indentation from all but first line in the returned text.

With optional PREFIX-FLAG non-nil, include back to the start of the
first line, i.e. include the autonumber prefix and indent."
  (save-excursion
    (when pos
      (goto-char pos))
    (let ((indent (kcell-view:indent))
	  (start (if prefix-flag
		     (progn (goto-char (kcell-view:start))
			    (line-beginning-position))
		   (kcell-view:start)))
	  (end (kcell-view:end-contents)))
      ;; Remove indentation from all but first line.
      (replace-regexp-in-string
       (concat "\\([\n\r]\\)" (make-string indent ?\ ))
       "\\1" (buffer-substring start end)))))