summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/regexp-opt.el
diff options
context:
space:
mode:
authorTassilo Horn <tsdh@gnu.org>2021-09-09 22:31:47 +0200
committerTassilo Horn <tsdh@gnu.org>2021-09-11 11:51:14 +0200
commitccc9bd774c31ef5a7ba69729afbc9f97e710dfb2 (patch)
treef457706e9e72e6f0f4700fbc9d5ade934065a1ee /lisp/emacs-lisp/regexp-opt.el
parentbfd5e268a82d8ccbd758fdfbe445f9cb8b5befea (diff)
downloademacs-ccc9bd774c31ef5a7ba69729afbc9f97e710dfb2.tar.gz
emacs-ccc9bd774c31ef5a7ba69729afbc9f97e710dfb2.tar.bz2
emacs-ccc9bd774c31ef5a7ba69729afbc9f97e710dfb2.zip
bug-reference-bug-regexp now defines a contract for the overlay region
Formerly, bug-reference-fontify placed the overlay on the complete match of bug-reference-bug-regexp. That made it impossible to encode constraints like "must not match at BOL" in the regexp without messing up fontification. Therefore, now it establishes the contract that subexpression 1 defines the overlay region. Subexpression 2 must still match the part of the bug reference injected into bug-reference-url-format if that's a string. If its a function, the interpretation of subexpressions > 1 is up to the function. For backwards compatibility, bug-reference-fontify checks if the bounds of subexpression 2..10 are within the bounds of subexpession 1. If not, or subexpression 1 doesn't even exist/match, we fall back to placing the overlay from (match-beginning 0) to (match-end 0) but issue a warning. * lisp/progmodes/bug-reference.el (bug-reference-bug-regexp): Document contract that subexpression 1 defines the overlay region and adapt the default value accordingly. (bug-reference--nonconforming-regexps): New internal variable. (bug-reference--overlay-bounds): New function. (bug-reference-fontify): Place overlay on subexpression 1's bounds if bug-reference-bug-regexp conforms to the documented contract. (bug-reference--setup-from-vc-alist): Adapt regexps to new contract. * doc/emacs/maintaining.texi (Bug Reference): Adapt regexp used in example.
Diffstat (limited to 'lisp/emacs-lisp/regexp-opt.el')
0 files changed, 0 insertions, 0 deletions