Function: hyrolo-to
hyrolo-to is a byte-compiled function defined in hyrolo.el.
Signature
(hyrolo-to NAME &optional FILE-OR-BUF-LIST)
Documentation
Move point to entry for NAME within optional FILE-OR-BUF-LIST.
(hyrolo-get-file-or-buf-list) provides the default when
FILE-OR-BUF-LIST is nil. Leave point immediately after the first
match of NAME within an entry. Switches internal current buffer
but does not alter the frame. Return point where matching entry
begins or nil if not found.
Source Code
;; Defined in ~/.emacs.d/elpa/hyperbole-20260822.1645/hyrolo.el
(defun hyrolo-to (name &optional file-or-buf-list)
"Move point to entry for NAME within optional FILE-OR-BUF-LIST.
\(hyrolo-get-file-or-buf-list) provides the default when
FILE-OR-BUF-LIST is nil. Leave point immediately after the first
match of NAME within an entry. Switches internal current buffer
but does not alter the frame. Return point where matching entry
begins or nil if not found."
(when (or (not (stringp name)) (string-blank-p name))
(error "(hyrolo-to): Invalid name: `%s'" name))
(unless file-or-buf-list
(setq file-or-buf-list (hyrolo-get-file-list)))
(let ((found) file-or-buf)
(while (and (not found) file-or-buf-list)
(setq file-or-buf (car file-or-buf-list)
file-or-buf-list (cdr file-or-buf-list))
(cond ((stringp file-or-buf)
(when (string-blank-p file-or-buf)
(error "(hyrolo-to): Invalid file: `%s'" file-or-buf))
(when (and (file-exists-p file-or-buf) (not (file-readable-p file-or-buf)))
(error "(hyrolo-to): File not readable: `%s'" file-or-buf)))
((bufferp file-or-buf)
(unless (buffer-live-p file-or-buf)
(error "(hyrolo-to): Buffer not live: `%s'" file-or-buf)))
(t (error "(hyrolo-to): Second argument must be a file or buffer, not: `%s'" file-or-buf)))
(hyrolo-set-buffer (if (stringp file-or-buf)
(or (get-file-buffer file-or-buf)
(hyrolo-find-file-noselect file-or-buf))
;; must be a buffer
file-or-buf))
(let ((case-fold-search t) (real-name name) (parent "") (level)
col-num end line name-column)
(hyrolo-widen)
(goto-char (point-min))
(if (setq col-num (get-text-property 0 :hyrolo-line-entry-column name))
;; this is a whole line to find without any entry delimiters
(when (re-search-forward (concat (regexp-quote name) "$") nil t)
(move-to-column col-num)
(setq found (point)))
;; If this is the first line of an entry, then don't treat
;; '/' characters as parent/child delimiters but just as
;; part of the entry first line text.
(unless (setq name-column (get-text-property 0 :hyrolo-name-entry-column name))
;; Otherwise, navigate through parent-child records.
(while (string-match "\\`[^\]\[<>{}\"]*/" name)
(setq end (1- (match-end 0))
level nil
parent (substring name 0 end)
name (substring name (min (1+ end) (length name))))
(cond ((progn
(while (and (not level) (search-forward parent nil t))
(save-excursion
(forward-line 0)
(when (looking-at (concat hyrolo-hdr-and-entry-regexp (regexp-quote parent)))
(setq level (match-string-no-properties hyrolo-entry-group-number)))))
level))
((equal name real-name)) ;; Try next file-or-buf.
(t ;; Found parent but not child
(setq buffer-read-only nil)
(hyrolo-to-buffer (current-buffer))
(error "(hyrolo-to): `%s' part of name not found in \"%s\""
parent file-or-buf)))
(when level
(narrow-to-region (point)
(save-excursion
(hyrolo-to-entry-end t) (point))))))
(goto-char (point-min))
(while (and
;; Search for just the leaf part of a name
(if name-column
;; Then searching for a whole line
(re-search-forward (concat (regexp-quote name) "$") nil t)
(search-forward name nil t))
(not (save-excursion
(forward-line 0)
(setq found
(when (or (looking-at (buffer-local-value
'outline-regexp
(current-buffer)))
;; Jump to non-first line within an entry
(progn (unless name-column
(back-to-indentation))
(looking-at (regexp-quote name))))
(when (or name-column
(setq name-column (get-text-property 0 :hyrolo-name-entry-column name)))
;; this is a whole line to find except for leading whitespace
(setq line name
col-num name-column)
(when (re-search-forward
(concat (regexp-quote line) "$") nil t)
(move-to-column col-num)))
(when (derived-mode-p 'kotl-mode)
(kotl-mode:to-valid-position))
(point)))))))))
(unless found
(hyrolo-kill-buffer))) ;; conditionally kill
(hyrolo-widen)
found))