emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 4309d15: When looking for the end of a declarator,


From: Alan Mackenzie
Subject: [Emacs-diffs] master 4309d15: When looking for the end of a declarator, prevent macros fouling up the search
Date: Tue, 22 Aug 2017 13:08:37 -0400 (EDT)

branch: master
commit 4309d1574ae86244751600171b605b2b2eca4697
Author: Alan Mackenzie <address@hidden>
Commit: Alan Mackenzie <address@hidden>

    When looking for the end of a declarator, prevent macros fouling up the 
search
    
    The practical implication of this bug was a random jit-lock chunk remaining
    entirely unfontified.
    
    * lisp/progmodes/cc-mode (c-fl-decl-end): If point starts inside a macro,
    restrict two forward searches to the end of that macro.
---
 lisp/progmodes/cc-mode.el | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el
index 0bf89b9..48a6619 100644
--- a/lisp/progmodes/cc-mode.el
+++ b/lisp/progmodes/cc-mode.el
@@ -1549,10 +1549,13 @@ Note that this is a strict tail, so won't match, e.g. 
\"0x....\".")
     (c-backward-syntactic-ws)
     (when (setq pos1 (c-on-identifier))
       (goto-char pos1)
-      (when (and (c-forward-declarator)
-                (eq (c-forward-token-2) 0))
-       (c-backward-syntactic-ws)
-       (point)))))
+      (let ((lim (save-excursion
+                  (and (c-beginning-of-macro)
+                       (progn (c-end-of-macro) (point))))))
+       (when (and (c-forward-declarator lim)
+                  (eq (c-forward-token-2 1 nil lim) 0))
+         (c-backward-syntactic-ws)
+         (point))))))
 
 (defun c-change-expand-fl-region (_beg _end _old-len)
   ;; Expand the region (c-new-BEG c-new-END) to an after-change font-lock



reply via email to

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