emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 9ef8a3b: C++ Mode: Handle "if constexpr (...)" with a simple stat


From: Alan Mackenzie
Subject: master 9ef8a3b: C++ Mode: Handle "if constexpr (...)" with a simple statement correctly
Date: Wed, 3 Mar 2021 06:57:39 -0500 (EST)

branch: master
commit 9ef8a3bfca192777e7cf8b4748d188249a517582
Author: Alan Mackenzie <acm@muc.de>
Commit: Alan Mackenzie <acm@muc.de>

    C++ Mode: Handle "if constexpr (...)" with a simple statement correctly
    
    * lisp/progmodes/cc-engine.el (c-beginning-of-statement-1): Add a check and
    handling for c-block-stmt-hangon-key in the main loop.
---
 lisp/progmodes/cc-engine.el | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index 079985a..5a8b2f4 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -1184,6 +1184,15 @@ comment at the start of cc-engine.el for more info."
                           ;; suitable error.
                           (setq pre-stmt-found t)
                           (throw 'loop nil))
+                        ;; Handle C++'s `constexpr', etc.
+                        (if (save-excursion
+                              (and (looking-at c-block-stmt-hangon-key)
+                                   (progn
+                                     (c-backward-syntactic-ws lim)
+                                     (c-safe (c-backward-sexp) t))
+                                   (looking-at c-block-stmt-2-key)
+                                   (setq pos (point))))
+                            (goto-char pos))
                         (cond
                          ;; Have we moved into a macro?
                          ((and (not macro-start)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]