Function: hywiki-format-reference-to-consult-grep

hywiki-format-reference-to-consult-grep is a byte-compiled function defined in hywiki.el.

Signature

(hywiki-format-reference-to-consult-grep PAGE-AND-SECTION)

Documentation

From PAGE-AND-SECTION ref, return '|^[ ]*\*+.*sect|page' grep pat.

Return t if PAGE-AND-SECTION is a valid string, else nil. If the page name therein is invalid, trigger an error.

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hywiki.el
(defun hywiki-format-reference-to-consult-grep (page-and-section)
  "From PAGE-AND-SECTION ref, return '|^[ \t]*\\*+.*sect|page' grep pat.

Return t if PAGE-AND-SECTION is a valid string, else nil.  If the page name
therein is invalid, trigger an error."
  (when (and page-and-section (stringp page-and-section))
    (if (string-match hywiki-word-with-optional-suffix-exact-regexp
                      page-and-section)
        (let ((page (match-string 1 page-and-section))
              (line (match-string 2 page-and-section)))
          (setq line (if line
                         ;; Remove the # prefix in line
                         (substring line 1)
                       ""))
          ;; Add '* ' prefix
          (format "|[ \t]*\\\\*+.*%s|%s"
                  (regexp-quote line)
                  (regexp-quote page)
                  ))
      (message "(hwiki-format-reference-to-consult-grep): Parse error on: %s"
               page-and-section)
      nil)))