Function: orderless--literal-prefix-p

orderless--literal-prefix-p is a byte-compiled function defined in orderless.el.

Signature

(orderless--literal-prefix-p REGEXP)

Documentation

Determine if REGEXP is a quoted regexp anchored at the beginning.

If REGEXP is of the form "\\`q" for q = (regexp-quote u), then return (cons REGEXP u); else return nil.

Source Code

;; Defined in ~/.emacs.d/elpa/orderless-20260519.1029/orderless.el
;; Thanks to @jakanakaevangeli for writing a version of this function:
;; https://github.com/oantolin/orderless/issues/79#issuecomment-916073526
(defun orderless--literal-prefix-p (regexp)
  "Determine if REGEXP is a quoted regexp anchored at the beginning.
If REGEXP is of the form \"\\`q\" for q = (regexp-quote u),
then return (cons REGEXP u); else return nil."
  (when (and (string-prefix-p "\\`" regexp)
             (not (string-match-p "[$*+.?[\\^]"
                                  (replace-regexp-in-string
                                   "\\\\[$*+.?[\\^]" "" regexp
                                   'fixedcase 'literal nil 2))))
    (cons regexp
          (replace-regexp-in-string "\\\\\\([$*+.?[\\^]\\)" "\\1"
                                    regexp 'fixedcase nil nil 2))))