Function: minibuffer--regexp-propertize
minibuffer--regexp-propertize is a byte-compiled function defined in
minibuffer.el.gz.
Signature
(minibuffer--regexp-propertize)
Documentation
In current minibuffer propertize parens and slashes in regexps.
Put punctuation syntax-table property on selected paren and
backslash characters in current buffer to make show-paren-mode(var)/show-paren-mode(fun)
and blink-matching-paren more user-friendly.
Source Code
;; Defined in /usr/src/emacs/lisp/minibuffer.el.gz
(defun minibuffer--regexp-propertize ()
"In current minibuffer propertize parens and slashes in regexps.
Put punctuation `syntax-table' property on selected paren and
backslash characters in current buffer to make `show-paren-mode'
and `blink-matching-paren' more user-friendly."
(let (in-char-alt-p)
(save-excursion
(with-silent-modifications
(remove-text-properties (point-min) (point-max) '(syntax-table nil))
(goto-char (point-min))
(while (re-search-forward
(rx (| (group "\\\\")
(: "\\" (| (group (in "(){}"))
(group "[")
(group "]")))
(group "[:" (+ (in "A-Za-z")) ":]")
(group "[")
(group "]")
(group (in "(){}"))))
(point-max) 'noerror)
(cond
((match-beginning 1)) ; \\, skip
((match-beginning 2) ; \( \) \{ \}
(if in-char-alt-p
;; Within character alternative, set symbol syntax for
;; paren only.
(put-text-property (1- (point)) (point) 'syntax-table '(3))
;; Not within character alternative, set symbol syntax for
;; backslash only.
(put-text-property (- (point) 2) (1- (point)) 'syntax-table '(3))))
((match-beginning 3) ; \[
(if in-char-alt-p
(progn
;; Set symbol syntax for backslash.
(put-text-property (- (point) 2) (1- (point)) 'syntax-table '(3))
;; Re-read bracket we might be before a character class.
(backward-char))
;; Set symbol syntax for bracket.
(put-text-property (1- (point)) (point) 'syntax-table '(3))))
((match-beginning 4) ; \]
(if in-char-alt-p
(progn
;; Within character alternative, set symbol syntax for
;; backslash, exit alternative.
(put-text-property (- (point) 2) (1- (point)) 'syntax-table '(3))
(setq in-char-alt-p nil))
;; Not within character alternative, set symbol syntax for
;; bracket.
(put-text-property (1- (point)) (point) 'syntax-table '(3))))
((match-beginning 5)) ; POSIX character class, skip
((match-beginning 6) ; [
(if in-char-alt-p
;; Within character alternative, set symbol syntax.
(put-text-property (1- (point)) (point) 'syntax-table '(3))
;; Start new character alternative.
(setq in-char-alt-p t)
;; Looking for immediately following non-closing ].
(when (looking-at "\\^?\\]")
;; Non-special right bracket, set symbol syntax.
(goto-char (match-end 0))
(put-text-property (1- (point)) (point) 'syntax-table '(3)))))
((match-beginning 7) ; ]
(if in-char-alt-p
(setq in-char-alt-p nil)
;; The only warning we can emit before RET.
(message "Not in character alternative")))
((match-beginning 8) ; (){}
;; Plain parenthesis or brace, set symbol syntax.
(put-text-property (1- (point)) (point) 'syntax-table '(3)))))))))