]> git.eshelyaron.com Git - emacs.git/commit
Correct handling of template markers on deletion/insertion
authorAlan Mackenzie <acm@muc.de>
Wed, 21 Jun 2023 15:36:56 +0000 (15:36 +0000)
committerAlan Mackenzie <acm@muc.de>
Wed, 21 Jun 2023 15:43:41 +0000 (15:43 +0000)
commitdae8aab52874441a70a94435d50f25b27301d9b0
treecd8991999450e2bcde4341c4b61b0e7927cc17e5
parent0f9a1039befea72e0f0a6987f8a65cb299a5dc73
Correct handling of template markers on deletion/insertion

This fixes bug#62841.

In particular, correct the syntax-table text properties on the
remaining <...>s.

* lisp/progmodes/cc-align.el
(c-lineup-template-args-indented-from-margin): New lineup
function.

* lisp/progmodes/cc-defs.el (c-put-char-properties): New macro.
(c-search-forward-non-nil-char-property): Handle terminating
limit correctly.

* lisp/progmodes/cc-engine.el
(c-clear-<-pair-props-if-match-after)
(c-clear->-pair-props-if-match-before): Return the position
outside the matching < or >, not merely t.
(c-end-of-literal): New function.
(c-unmark-<>-around-region): New function.
(c-before-change-check-<>-operators): Refactor, calling
c-unmark-<>-around-region.
(c-<>-get-restricted): New function, extracted from
c-restore-<>-properties.
(c-restore-<>-properties): Handle ">" characters whose matching
"<" has not yet been encountered.
(c-ml-string-opener-at-or-around-point): Fix an off by one
error.
(c-backward-<>-arglist): New parameter restricted-function, a
function which calculates c-restricted-<>-arglists for the
current operation.

* lisp/progmodes/cc-fonts.el (c-font-lock-c++-using): Check
point is less than limit in the loop.

* lisp/progmodes/cc-langs.el
(c-get-state-before-change-functions)
(c-before-font-lock-functions): Add the new function
c-unmark-<>-around-region into the C++ and Java values of the
variable.

* lisp/progmodes/cc-mode.el (c-clear-string-fences)
(c-restore-string-fences): Neutralize and restore the
syntax-table properties between an unbalanced " and EOL.

* lisp/progmodes/cc-vars.el (c-offsets-alist): Put new lineup
function c-lineup-template-args-indented-from-margin into entry
for template-args-cont.

* doc/misc/cc-mode.texi (List Line-Up): Document
c-lineup-template-args-indented-from-margin.
doc/misc/cc-mode.texi
lisp/progmodes/cc-align.el
lisp/progmodes/cc-defs.el
lisp/progmodes/cc-engine.el
lisp/progmodes/cc-fonts.el
lisp/progmodes/cc-langs.el
lisp/progmodes/cc-mode.el
lisp/progmodes/cc-vars.el