Function: minibuffer-regexp-mode

minibuffer-regexp-mode is an interactive and byte-compiled function defined in minibuffer.el.gz.

Signature

(minibuffer-regexp-mode &optional ARG)

Documentation

Minor mode for editing regular expressions in the minibuffer.

Highlight parens via show-paren-mode(var)/show-paren-mode(fun) and blink-matching-paren in a user-friendly way, avoid reporting alleged paren mismatches and make sexp navigation more intuitive.

The list of prompts activating this mode in specific minibuffer interactions is customizable via minibuffer-regexp-prompts.

This is a global minor mode. If called interactively, toggle the Minibuffer-Regexp mode mode. If the prefix argument is positive, enable the mode, and if it is zero or negative, disable the mode.

If called from Lisp, toggle the mode if ARG is toggle. Enable the mode if ARG is nil, omitted, or is a positive number. Disable the mode if ARG is a negative number.

To check whether the minor mode is enabled in the current buffer, evaluate (default-value \=minibuffer-regexp-mode)'.

The mode's hook is called both when the mode is enabled and when it is disabled.

View in manual

Probably introduced at or before Emacs version 30.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/minibuffer.el.gz
(define-minor-mode minibuffer-regexp-mode
  "Minor mode for editing regular expressions in the minibuffer.
Highlight parens via `show-paren-mode' and `blink-matching-paren'
in a user-friendly way, avoid reporting alleged paren mismatches
and make sexp navigation more intuitive.

The list of prompts activating this mode in specific minibuffer
interactions is customizable via `minibuffer-regexp-prompts'."
  :global t
  :initialize #'custom-initialize-after-file-load
  :init-value t
  (if minibuffer-regexp-mode
      (progn
        (add-hook 'minibuffer-setup-hook #'minibuffer--regexp-setup)
        (add-hook 'minibuffer-exit-hook #'minibuffer--regexp-exit))
    ;; Clean up - why is Vminibuffer_list not available in Lisp?
    (dolist (buffer (buffer-list))
      (when (and (minibufferp)
                 parse-sexp-lookup-properties
                 (with-current-buffer buffer
                   (save-excursion
                     (goto-char (point-min))
                     (looking-at minibuffer--regexp-prompt-regexp))))
        (with-current-buffer buffer
          (with-silent-modifications
            (remove-text-properties
             (point-min) (point-max) '(syntax-table nil)))
          (setq-local parse-sexp-lookup-properties t))))
    (remove-hook 'minibuffer-setup-hook #'minibuffer--regexp-setup)
    (remove-hook 'minibuffer-exit-hook #'minibuffer--regexp-exit)))