Function: kotl-mode:goto-cell

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

Signature

(kotl-mode:goto-cell CELL-REF &optional ERROR-FLAG)

Documentation

Move point to start of cell text given by CELL-REF (see kcell:ref-to-id).

Return point if CELL-REF is found within current view, else nil. See the doc for kcell:ref-to-id, for valid formats.

With optional second arg ERROR-FLAG non-nil, or if called interactively, will signal an error if CELL-REF is not found within current view.

When called interactively, if a prefix argument is given, use that value as CELL-REF and search for it as a permanent idstamp regardless of cell label type; without a prefix argument, prompt for CELL-REF.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/kotl/kotl-mode.el
(defun kotl-mode:goto-cell (cell-ref &optional error-flag)
  "Move point to start of cell text given by CELL-REF (see `kcell:ref-to-id').
Return point if CELL-REF is found within current view, else nil.
See the doc for `kcell:ref-to-id', for valid formats.

With optional second arg ERROR-FLAG non-nil, or if called
interactively, will signal an error if CELL-REF is not found
within current view.

When called interactively, if a prefix argument is given, use
that value as CELL-REF and search for it as a permanent idstamp
regardless of cell label type; without a prefix argument, prompt
for CELL-REF."
  (interactive
   (list (if current-prefix-arg
	     (prefix-numeric-value current-prefix-arg)
	   (read-string "Goto cell label or id: "))))
  (setq cell-ref
	(or (kcell:ref-to-id cell-ref t)
	    (error "(kotl-mode:goto-cell): Invalid cell reference, `%s'" cell-ref)))
  (let* ((opoint (point))
	 found
	 id-flag)
    (if (and (stringp cell-ref)
	     (> (length cell-ref) 0)
	     (eq ?| (aref cell-ref 0)))
	;; Is a standalone view spec, not a cell reference
	(progn (kvspec:activate cell-ref) (setq found (point)))
      (cl-destructuring-bind (cell-only-ref kvspec) (kcell:parse-cell-ref cell-ref)
	(goto-char (point-min))
	(when (setq id-flag (or (integerp cell-only-ref)
				(string-match "\\`0[0-9]*\\'" cell-only-ref)))
	  ;; Is an idstamp
	  (when (kview:goto-cell-id cell-only-ref)
	    (setq found (point))))
	(when (and (not (or id-flag found))
		   (stringp cell-only-ref))
	  ;; Is a heading; this should never run as a heading should
	  ;; have been converted to an idstamp by the
	  ;; 'kcell:ref-to-id' call above already.
	  (setq found (kotl-mode:goto-heading cell-only-ref)))
	(if found
	    ;; Activate any viewspec from cell-ref
	    (when kvspec (kvspec:activate kvspec))
	  (goto-char opoint)
	  (when (or error-flag (called-interactively-p 'interactive))
	    (error "(kotl-mode:goto-cell): No `%s' cell in this view" cell-ref)))))
    found))