diff options
| author | Alan Mackenzie | 2018-10-30 11:43:13 +0000 |
|---|---|---|
| committer | Alan Mackenzie | 2018-10-30 11:43:13 +0000 |
| commit | 607cc2901bab0be64d08aff0394a4676a81da40b (patch) | |
| tree | 09d96c501b865e4209e3bd841d09a58c4f3ed4a8 | |
| parent | 15059d228c099c7fbccfb04058d58253d40851e7 (diff) | |
| download | emacs-607cc2901bab0be64d08aff0394a4676a81da40b.tar.gz emacs-607cc2901bab0be64d08aff0394a4676a81da40b.zip | |
Fix C++ Mode dynamic error with string delimiters.
Fixes bug #33163
* lisp/progmodes/cc-mode.el (c-before-change-check-unbalanced-strings):
Use the correct variable `end' in place of the wrong `c-new-END'.
(c-after-change-re-mark-unbalanced-strings): Correct a logic error whilst
skipping over comments.
| -rw-r--r-- | lisp/progmodes/cc-mode.el | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el index 09c30e2bd1b..d019cf24937 100644 --- a/lisp/progmodes/cc-mode.el +++ b/lisp/progmodes/cc-mode.el | |||
| @@ -1232,21 +1232,21 @@ Note that the style variables are always made local to the buffer." | |||
| 1232 | (if (eq beg-literal-type 'string) | 1232 | (if (eq beg-literal-type 'string) |
| 1233 | (setq c-new-BEG (min (car beg-limits) c-new-BEG)))) | 1233 | (setq c-new-BEG (min (car beg-limits) c-new-BEG)))) |
| 1234 | 1234 | ||
| 1235 | ((< c-new-END (point-max)) | 1235 | ((< end (point-max)) |
| 1236 | (goto-char (1+ c-new-END)) ; might be a newline. | 1236 | (goto-char (1+ end)) ; might be a newline. |
| 1237 | ;; In the following regexp, the initial \n caters for a newline getting | 1237 | ;; In the following regexp, the initial \n caters for a newline getting |
| 1238 | ;; joined to a preceding \ by the removal of what comes between. | 1238 | ;; joined to a preceding \ by the removal of what comes between. |
| 1239 | (re-search-forward "[\n\r]?\\(\\\\\\(.\\|\n\\|\r\\)\\|[^\\\n\r]\\)*" | 1239 | (re-search-forward "[\n\r]?\\(\\\\\\(.\\|\n\\|\r\\)\\|[^\\\n\r]\\)*" |
| 1240 | nil t) | 1240 | nil t) |
| 1241 | ;; We're at an EOLL or point-max. | 1241 | ;; We're at an EOLL or point-max. |
| 1242 | (setq c-new-END (min (1+ (point)) (point-max))) | 1242 | (setq c-new-END (max c-new-END (min (1+ (point)) (point-max)))) |
| 1243 | (goto-char c-new-END) | 1243 | (if (equal (c-get-char-property (point) 'syntax-table) '(15)) |
| 1244 | (if (equal (c-get-char-property (1- (point)) 'syntax-table) '(15)) | 1244 | (if (memq (char-after) '(?\n ?\r)) |
| 1245 | (if (memq (char-before) '(?\n ?\r)) | ||
| 1246 | ;; Normally terminated invalid string. | 1245 | ;; Normally terminated invalid string. |
| 1247 | (progn | 1246 | (let ((eoll-1 (point))) |
| 1247 | (forward-char) | ||
| 1248 | (backward-sexp) | 1248 | (backward-sexp) |
| 1249 | (c-clear-char-property (1- c-new-END) 'syntax-table) | 1249 | (c-clear-char-property eoll-1 'syntax-table) |
| 1250 | (c-clear-char-property (point) 'syntax-table)) | 1250 | (c-clear-char-property (point) 'syntax-table)) |
| 1251 | ;; Opening " at EOB. | 1251 | ;; Opening " at EOB. |
| 1252 | (c-clear-char-property (1- (point)) 'syntax-table)) | 1252 | (c-clear-char-property (1- (point)) 'syntax-table)) |
| @@ -1254,7 +1254,7 @@ Note that the style variables are always made local to the buffer." | |||
| 1254 | ;; Opening " on last line of text (without EOL). | 1254 | ;; Opening " on last line of text (without EOL). |
| 1255 | (c-clear-char-property (point) 'syntax-table)))) | 1255 | (c-clear-char-property (point) 'syntax-table)))) |
| 1256 | 1256 | ||
| 1257 | (t (goto-char c-new-END) | 1257 | (t (goto-char end) ; point-max |
| 1258 | (if (c-search-backward-char-property 'syntax-table '(15) c-new-BEG) | 1258 | (if (c-search-backward-char-property 'syntax-table '(15) c-new-BEG) |
| 1259 | (c-clear-char-property (point) 'syntax-table)))) | 1259 | (c-clear-char-property (point) 'syntax-table)))) |
| 1260 | 1260 | ||
| @@ -1343,9 +1343,9 @@ Note that the style variables are always made local to the buffer." | |||
| 1343 | (while (progn | 1343 | (while (progn |
| 1344 | (setq s (parse-partial-sexp (point) c-new-END nil | 1344 | (setq s (parse-partial-sexp (point) c-new-END nil |
| 1345 | nil s 'syntax-table)) | 1345 | nil s 'syntax-table)) |
| 1346 | (and (not (nth 3 s)) | 1346 | (and (< (point) c-new-END) |
| 1347 | (< (point) c-new-END) | 1347 | (or (not (nth 3 s)) |
| 1348 | (not (memq (char-before) c-string-delims))))) | 1348 | (not (memq (char-before) c-string-delims)))))) |
| 1349 | ;; We're at the start of a string. | 1349 | ;; We're at the start of a string. |
| 1350 | (memq (char-before) c-string-delims))) | 1350 | (memq (char-before) c-string-delims))) |
| 1351 | (if (c-unescaped-nls-in-string-p (1- (point))) | 1351 | (if (c-unescaped-nls-in-string-p (1- (point))) |