Function: hywiki-consult-page-and-headline

hywiki-consult-page-and-headline is an interactive and byte-compiled function defined in hywiki.el.

Signature

(hywiki-consult-page-and-headline &optional PROMPT INITIAL)

Documentation

Return a string of HyWiki file and headline selected by consult-grep or nil.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hywiki.el
(defun hywiki-consult-page-and-headline (&optional prompt initial)
  "Return a string of HyWiki file and headline selected by `consult-grep' or nil."
  (interactive)
  (hsys-consult-require-version)
  (let* ((default-directory (expand-file-name hywiki-directory))
         (dir "./")
         (builder
          (lambda (input)
            (let* (;; Define the regexp inside the builder so it is always in scope
                   (headline-regexp (concat "^\\* .*" input))
                   (args (list "rg"
                               "--null"
                               "--line-buffered"
                               "--color=never"
                               "--with-filename"
                               "--line-number"
                               "--smart-case"
                               "--search-zip"
                               "-g" "*.org"
                               "-e" headline-regexp
                               dir)))
              (cons args dir))))
         (selected (consult--read
                    (consult--async-command builder)
                    :initial initial
                    :prompt (or prompt "HyWiki Headline: ")
                    :require-match t
                    :lookup #'consult--lookup-member
                    :category 'consult-grep)))
    selected))