Function: kcell:parse-cell-ref

kcell:parse-cell-ref is an autoloaded and byte-compiled function defined in kcell.el.

Signature

(kcell:parse-cell-ref CELL-REF)

Documentation

Parse CELL-REF string and return list of strings (<cell-id> <viewspec>).

If any item in the list is missing, it is nil.

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/kotl/kcell.el
;;;###autoload
(defun kcell:parse-cell-ref (cell-ref)
  "Parse CELL-REF string and return list of strings (<cell-id> <viewspec>).
If any item in the list is missing, it is nil."
  (let (cell-id
	kvspec)
    ;; !! TODO: Remove any relative specs and view specs from
    ;; cell-ref to form cell-id.  Really should account for Augment-style
    ;; relative specs here, but we don't yet support them.
    (cond ((and (stringp cell-ref)
		(string-match "\\(\\.[a-zA-Z]+\\)?\\([|:][^|: \t\n\r\f]+\\)\\|\\.[a-zA-Z]+"
			      cell-ref))
	   ;; relative cell id and optional kvspec
	   (setq cell-id (substring cell-ref 0 (match-beginning 0))
		 kvspec  (when (match-beginning 2)
			   (match-string 2 cell-ref))))
	  ((and (stringp cell-ref)
		(string-match "[^|\n\r\f]+?\\([|:][^|: \t\n\r\f]+\\)"
			      cell-ref))
	   ;; string heading and optional kvspec
	   (setq cell-id (string-trim (substring cell-ref 0 (match-beginning 0)))
		 kvspec  (when (match-beginning 1)
			   (match-string 1 cell-ref))))
	  ;; idstring with no kvspec
	  (t (setq cell-id cell-ref
		   kvspec nil)))
    (list cell-id kvspec)))