commit a1a777ffdf13afebca24793ded469b3cf0e76290 (HEAD, refs/remotes/origin/master) Author: Alan Mackenzie Date: Sat Aug 27 19:57:42 2016 +0000 Handle the C++ "identifiers" "final" and "override" correctly. This fixes bug #24319, allowing destructors affixed with these identifiers to be correctly fontified. * lisp/progmodes/cc-engine.el (c-forward-type, c-forward-decl-or-cast-1): After reaching the "end" of a type expression, skip over any occurrences of c-type-decl-suffix-ws-ids-key. * lisp/progmodes/cc-langs.el (c-type-modifier-kwds): Remove "override" and "final" from the C++ value. (c-type-decl-suffix-ws-ids-kwds, c-type-decl-suffix-ws-ids-key): New lang constants/variables for "final" and "override". diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index ecee57e..28d6618 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el @@ -7263,6 +7263,12 @@ comment at the start of cc-engine.el for more info." (goto-char (match-end 1)) (c-forward-syntactic-ws))) + ;; Skip any "WS" identifiers (e.g. "final" or "override" in C++) + (while (looking-at c-type-decl-suffix-ws-ids-key) + (goto-char (match-end 1)) + (c-forward-syntactic-ws) + (setq res t)) + (when c-opt-type-concat-key ; Only/mainly for pike. ;; Look for a trailing operator that concatenates the type ;; with a following one, and if so step past that one through @@ -8165,6 +8171,11 @@ comment at the start of cc-engine.el for more info." (setq type-start (point)) (setq at-type (c-forward-type)))) + ;; Move forward over any "WS" ids (like "final" or "override" in C++) + (while (looking-at c-type-decl-suffix-ws-ids-key) + (goto-char (match-end 1)) + (c-forward-syntactic-ws)) + (setq at-decl-or-cast (catch 'at-decl-or-cast diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el index e1ccc79..ae6e6a3 100644 --- a/lisp/progmodes/cc-langs.el +++ b/lisp/progmodes/cc-langs.el @@ -1844,7 +1844,7 @@ but they don't build a type of themselves. Unlike the keywords on not the type face." t nil c '("const" "restrict" "volatile") - c++ '("const" "noexcept" "volatile" "throw" "final" "override") + c++ '("const" "noexcept" "volatile" "throw") objc '("const" "volatile")) (c-lang-defconst c-opt-type-modifier-key @@ -1873,6 +1873,18 @@ not the type face." (c-lang-const c-type-modifier-kwds)) :test 'string-equal)) +(c-lang-defconst c-type-decl-suffix-ws-ids-kwds + "\"Identifiers\" that when immediately following a declarator have semantic +effect in the declaration, but are syntactically like whitespace." + t nil + c++ '("final" "override")) + +(c-lang-defconst c-type-decl-suffix-ws-ids-key + ;; An adorned regexp matching `c-type-decl-suffix-ws-ids-kwds'. + t (c-make-keywords-re t (c-lang-const c-type-decl-suffix-ws-ids-kwds))) +(c-lang-defvar c-type-decl-suffix-ws-ids-key + (c-lang-const c-type-decl-suffix-ws-ids-key)) + (c-lang-defconst c-class-decl-kwds "Keywords introducing declarations where the following block (if any) contains another declaration level that should be considered a class. commit 0ca712ca3d0df4d10664d97b5f4ba9f0a21e7a4c Author: Stefan Monnier Date: Sat Aug 27 14:17:20 2016 -0400 * lisp/textmodes/page-ext.el (pages-directory-mode): Use special-mode. diff --git a/lisp/textmodes/page-ext.el b/lisp/textmodes/page-ext.el index 4769af5..f67e85e 100644 --- a/lisp/textmodes/page-ext.el +++ b/lisp/textmodes/page-ext.el @@ -694,20 +694,14 @@ Used by `pages-directory' function." (terpri)) (end-of-line 1))) -(defun pages-directory-mode () +(define-derived-mode pages-directory-mode special-mode "Pages-Directory" "Mode for handling the pages-directory buffer. Move point to one of the lines in this buffer, then use \\[pages-directory-goto] to go to the same line in the pages buffer." - - (kill-all-local-variables) - (use-local-map pages-directory-mode-map) - (setq major-mode 'pages-directory-mode) - (setq mode-name "Pages-Directory") (make-local-variable 'pages-buffer) (make-local-variable 'pages-pos-list) - (make-local-variable 'pages-directory-buffer-narrowing-p) - (run-mode-hooks 'pages-directory-mode-hook)) + (make-local-variable 'pages-directory-buffer-narrowing-p)) (defun pages-directory-goto () "Go to the corresponding line in the pages buffer." commit 223429c09bb457f686693a6280339a4888bbad1c Author: Alan Mackenzie Date: Sat Aug 27 15:45:17 2016 +0000 Handle template delimiters in C++ member init constructs. * lisp/progmodes/cc-engine.el (c-back-over-list-of-member-inits): Add handling for "<....>"s. diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index 940d7a4..ecee57e 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el @@ -7410,7 +7410,8 @@ comment at the start of cc-engine.el for more info." (defmacro c-back-over-list-of-member-inits () ;; Go back over a list of elements, each looking like: ;; () , - ;; or {} , + ;; or {} , (with possibly a <....> expressions + ;; following the ). ;; when we are putatively immediately after a comma. Stop when we don't see ;; a comma. If either of or bracketed is missing, ;; throw nil to 'level. If the terminating } or ) is unmatched, throw nil @@ -7423,6 +7424,11 @@ comment at the start of cc-engine.el for more info." (when (not (c-go-list-backward)) (throw 'done nil)) (c-backward-syntactic-ws) + (while (eq (char-before) ?>) + (when (not (c-backward-<>-arglist nil)) + (throw 'done nil)) + (c-backward-syntactic-ws)) + (c-backward-syntactic-ws) (when (not (c-back-over-compound-identifier)) (throw 'level nil)) (c-backward-syntactic-ws)))