From e6597158c01c9bc9044b46831c7445f50c60af81 Mon Sep 17 00:00:00 2001 From: Alan Mackenzie Date: Thu, 30 Jun 2011 15:12:59 +0000 Subject: [PATCH] progmodes/cc-engine.el (c-guess-continued-construct): Correct the handling of template-args-cont, particularly for when font lock is disabled. Name this case as "CASE G". --- lisp/ChangeLog | 6 ++++++ lisp/progmodes/cc-engine.el | 29 +++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 5c063b9603b..c82e4325ffe 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2011-06-30 Alan Mackenzie + + * progmodes/cc-engine.el (c-guess-continued-construct): Correct + the handling of template-args-cont, particularly for when font + lock is disabled. Name this case as "CASE G". + 2011-06-30 Ken Manheimer * allout.el (allout-yank-processing): Fix injection of extra space diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index 0eec54fab6f..38f66b4504e 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el @@ -8712,6 +8712,35 @@ comment at the start of cc-engine.el for more info." (c-beginning-of-statement-1 containing-sexp) (c-add-syntax 'annotation-var-cont (point))) + ;; CASE G: a template list continuation? + ;; Mostly a duplication of case 5D.3 to fix templates-19: + ((and (c-major-mode-is 'c++-mode) + (save-excursion + (goto-char indent-point) + (c-with-syntax-table c++-template-syntax-table + (setq placeholder (c-up-list-backward))) + (and placeholder + (eq (char-after placeholder) ?<) + (/= (char-before placeholder) ?<) + (progn + (goto-char (1+ placeholder)) + (not (looking-at c-<-op-cont-regexp)))))) + (c-with-syntax-table c++-template-syntax-table + (goto-char placeholder) + (c-beginning-of-statement-1 containing-sexp t) + (if (save-excursion + (c-backward-syntactic-ws containing-sexp) + (eq (char-before) ?<)) + ;; In a nested template arglist. + (progn + (goto-char placeholder) + (c-syntactic-skip-backward "^,;" containing-sexp t) + (c-forward-syntactic-ws)) + (back-to-indentation))) + ;; FIXME: Should use c-add-stmt-syntax, but it's not yet + ;; template aware. + (c-add-syntax 'template-args-cont (point) placeholder)) + ;; CASE D: continued statement. (t (c-beginning-of-statement-1 containing-sexp) -- 2.39.2