summaryrefslogtreecommitdiff
path: root/lisp/progmodes/cc-mode.el
diff options
context:
space:
mode:
authorAlan Mackenzie <acm@muc.de>2019-07-23 09:55:49 +0000
committerAlan Mackenzie <acm@muc.de>2019-07-23 09:55:49 +0000
commit6bd817ee66e7a5759ef6c5a8c12d57b5ec59043c (patch)
tree9b92b5409282e1612303827a5f143617c41eae30 /lisp/progmodes/cc-mode.el
parentdfb0ba79b5f41ca6fed25a03d2a5cd6996ec4753 (diff)
downloademacs-6bd817ee66e7a5759ef6c5a8c12d57b5ec59043c.tar.gz
emacs-6bd817ee66e7a5759ef6c5a8c12d57b5ec59043c.tar.bz2
emacs-6bd817ee66e7a5759ef6c5a8c12d57b5ec59043c.zip
Fix problems in CC Mode with " being entered into a comment at EOB.
* lisp/progmodes/cc-engine.el (c-full-lit-near-cache): Amend the definition such that an element's END element will be nil if the pertinent literal is open at EOB. (c-full-pp-to-literal): Before setting the aforementioned END element, check that we're no longer in a literal. (c-literal-limits): When c-full-pp-to-literal returns a list with a nil END element, replace this by (point-max) to keep the interface of c-literal-limits unchanged. * lisp/progmodes/cc-mode.el (c-after-change-mark-abnormal-strings): Having found a string quote, check it is not inside an unterminated comment (i.e. one at EOB).
Diffstat (limited to 'lisp/progmodes/cc-mode.el')
-rw-r--r--lisp/progmodes/cc-mode.el4
1 files changed, 3 insertions, 1 deletions
diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el
index a5e158933ba..5e373b6e170 100644
--- a/lisp/progmodes/cc-mode.el
+++ b/lisp/progmodes/cc-mode.el
@@ -1527,7 +1527,9 @@ Note that the style variables are always made local to the buffer."
(or (not (nth 3 s))
(not (memq (char-before) c-string-delims))))))
;; We're at the start of a string.
- (memq (char-before) c-string-delims)))
+ (and (memq (char-before) c-string-delims)
+ (not (nth 4 s))))) ; Check we're actually out of the
+ ; comment. not stuck at EOB
(unless (and (c-major-mode-is 'c++-mode)
(c-maybe-re-mark-raw-string))
(if (c-unescaped-nls-in-string-p (1- (point)))