emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 368b9bb: Fix absence of c-noise-macro-name-re, etc.


From: Alan Mackenzie
Subject: [Emacs-diffs] master 368b9bb: Fix absence of c-noise-macro-name-re, etc., in languages which don't use it
Date: Fri, 25 Mar 2016 18:27:21 +0000

branch: master
commit 368b9bb45f125061506d43af4bd4791ab2cfd7b9
Author: Alan Mackenzie <address@hidden>
Commit: Alan Mackenzie <address@hidden>

    Fix absence of c-noise-macro-name-re, etc., in languages which don't use it
    
    * lisp/progmodes/cc-engine.el (c-forward-keyword-prefixed-id, 
c-forward-type)
    (c-forward-declarator, c-forward-decl-or-cast-1, 
c-backward-over-enum-header)
    (c-guess-basic-syntax): Check c-opt-cpp-prefix before `looking-at'
    c-noise-macro-with-parens-name-re.
    
    * lisp/progmodes/cc-fonts.el (c-complex-decl-matchers): The same as for
    cc-engine.el.
    
    * lisp/progmodes/cc-mode.el (c-basic-common-init): Add call to
    `c-make-noise-macro-regexps'.
    (c-mode, c++-mode, objc-mode): Remove calls to `c-make-noise-macro-regexps'.
    
    * lisp/progmodes/cc-vars.el (c-noise-macro-with-parens-name-re)
    (c-noise-macro-with-re): Initialize to "\\<\\>" rather than nil.
---
 lisp/progmodes/cc-engine.el |   30 ++++++++++++++++++++----------
 lisp/progmodes/cc-fonts.el  |    4 +++-
 lisp/progmodes/cc-mode.el   |    4 +---
 lisp/progmodes/cc-vars.el   |    4 ++--
 4 files changed, 26 insertions(+), 16 deletions(-)

diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index f9eae21..e04929a 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -5838,7 +5838,8 @@ comment at the start of cc-engine.el for more info."
                nil
              (cond ((looking-at c-keywords-regexp)
                     (c-forward-keyword-clause 1))
-                   ((looking-at c-noise-macro-with-parens-name-re)
+                   ((and c-opt-cpp-prefix
+                         (looking-at c-noise-macro-with-parens-name-re))
                     (c-forward-noise-clause)))))
      (when (memq res '(t known found prefix))
        ,(when (eq type 'ref)
@@ -6506,7 +6507,8 @@ comment at the start of cc-engine.el for more info."
       (while (cond
              ((looking-at c-decl-hangon-key)
               (c-forward-keyword-clause 1))
-             ((looking-at c-noise-macro-with-parens-name-re)
+             ((and c-opt-cpp-prefix
+                   (looking-at c-noise-macro-with-parens-name-re))
               (c-forward-noise-clause))))
 
       (setq pos (point))
@@ -6911,7 +6913,8 @@ comment at the start of cc-engine.el for more info."
                  (cond
                   ((looking-at c-decl-hangon-key)
                    (c-forward-keyword-clause 1))
-                  ((looking-at c-noise-macro-with-parens-name-re)
+                  ((and c-opt-cpp-prefix
+                        (looking-at c-noise-macro-with-parens-name-re))
                    (c-forward-noise-clause))
                   ((and (looking-at c-type-decl-prefix-key)
                         (if (and (c-major-mode-is 'c++-mode)
@@ -6966,7 +6969,8 @@ comment at the start of cc-engine.el for more info."
              (while (cond
                      ((looking-at c-decl-hangon-key)
                       (c-forward-keyword-clause 1))
-                     ((looking-at c-noise-macro-with-parens-name-re)
+                     ((and c-opt-cpp-prefix
+                           (looking-at c-noise-macro-with-parens-name-re))
                       (c-forward-noise-clause))))
              (<= (point) limit))
 
@@ -7161,7 +7165,8 @@ comment at the start of cc-engine.el for more info."
            (save-excursion
              (c-forward-keyword-clause 1)
              (setq kwd-clause-end (point))))
-          ((looking-at c-noise-macro-with-parens-name-re)
+          ((and c-opt-cpp-prefix
+                (looking-at c-noise-macro-with-parens-name-re))
            (setq noise-start (point))
            (c-forward-noise-clause)
            (setq kwd-clause-end (point))))
@@ -7267,7 +7272,8 @@ comment at the start of cc-engine.el for more info."
       (while
          (cond ((looking-at c-decl-hangon-key)
                 (c-forward-keyword-clause 1))
-               ((looking-at c-noise-macro-with-parens-name-re)
+               ((and c-opt-cpp-prefix
+                     (looking-at c-noise-macro-with-parens-name-re))
                 (c-forward-noise-clause))))
       (setq id-start (point)))
 
@@ -9038,7 +9044,8 @@ comment at the start of cc-engine.el for more info."
          ((eq (char-after) ?\()
           (and (eq (c-backward-token-2) 0)
                (or (looking-at c-decl-hangon-key)
-                   (looking-at c-noise-macro-with-parens-name-re))))
+                   (and c-opt-cpp-prefix
+                        (looking-at c-noise-macro-with-parens-name-re)))))
 
          ((and c-recognize-<>-arglists
                (eq (char-after) ?<)
@@ -10303,7 +10310,8 @@ comment at the start of cc-engine.el for more info."
              (while (cond
                      ((looking-at c-specifier-key)
                       (c-forward-keyword-clause 1))
-                     ((looking-at c-noise-macro-with-parens-name-re)
+                     ((and c-opt-cpp-prefix
+                           (looking-at c-noise-macro-with-parens-name-re))
                       (c-forward-noise-clause))))
              (setq placeholder (c-point 'boi))
              (or (consp special-brace-list)
@@ -10359,7 +10367,8 @@ comment at the start of cc-engine.el for more info."
              (while (cond
                      ((looking-at c-specifier-key)
                       (c-forward-keyword-clause 1))
-                     ((looking-at c-noise-macro-with-parens-name-re)
+                     ((and c-opt-cpp-prefix
+                           (looking-at c-noise-macro-with-parens-name-re))
                       (c-forward-noise-clause))))
              (c-add-syntax 'defun-open (c-point 'boi))
              ;; Bogus to use bol here, but it's the legacy.  (Resolved,
@@ -10994,7 +11003,8 @@ comment at the start of cc-engine.el for more info."
            (while (cond
                    ((looking-at c-specifier-key)
                     (c-forward-keyword-clause 1))
-                   ((looking-at c-noise-macro-with-parens-name-re)
+                   ((and c-opt-cpp-prefix
+                         (looking-at c-noise-macro-with-parens-name-re))
                     (c-forward-noise-clause))))
            (c-add-syntax 'brace-list-open (c-point 'boi))))
 
diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el
index a7097b9..67e88a3 100644
--- a/lisp/progmodes/cc-fonts.el
+++ b/lisp/progmodes/cc-fonts.el
@@ -1705,7 +1705,9 @@ on level 2 only and so aren't combined with 
`c-complex-decl-matchers'."
                                              (looking-at "@[A-Za-z0-9]+")))
                                 (c-forward-keyword-clause 1)
                                 t)
-                              (when (looking-at 
c-noise-macro-with-parens-name-re)
+                              (when (and c-opt-cpp-prefix
+                                         (looking-at
+                                          c-noise-macro-with-parens-name-re))
                                 (c-forward-noise-clause)
                                 t)))
                          ,(if (c-major-mode-is 'c++-mode)
diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el
index 9ebe6f7..a53c86c 100644
--- a/lisp/progmodes/cc-mode.el
+++ b/lisp/progmodes/cc-mode.el
@@ -596,6 +596,7 @@ that requires a literal mode spec at compile time."
                                     (not (string-equal c-indentation-style
                                                        style)))))))
   (c-setup-paragraph-variables)
+  (c-make-noise-macro-regexps)
 
   ;; we have to do something special for c-offsets-alist so that the
   ;; buffer local value has its own alist structure.
@@ -1493,7 +1494,6 @@ Key bindings:
        abbrev-mode t)
   (use-local-map c-mode-map)
   (c-init-language-vars-for 'c-mode)
-  (c-make-noise-macro-regexps)
   (c-make-macro-with-semi-re) ; matches macro names whose expansion ends with ;
   (c-common-init 'c-mode)
   (easy-menu-add c-c-menu)
@@ -1549,7 +1549,6 @@ Key bindings:
        abbrev-mode t)
   (use-local-map c++-mode-map)
   (c-init-language-vars-for 'c++-mode)
-  (c-make-noise-macro-regexps)
   (c-make-macro-with-semi-re) ; matches macro names whose expansion ends with ;
   (c-common-init 'c++-mode)
   (easy-menu-add c-c++-menu)
@@ -1603,7 +1602,6 @@ Key bindings:
        abbrev-mode t)
   (use-local-map objc-mode-map)
   (c-init-language-vars-for 'objc-mode)
-  (c-make-noise-macro-regexps)
   (c-make-macro-with-semi-re) ; matches macro names whose expansion ends with ;
   (c-common-init 'objc-mode)
   (easy-menu-add c-objc-menu)
diff --git a/lisp/progmodes/cc-vars.el b/lisp/progmodes/cc-vars.el
index a695718..33ea152 100644
--- a/lisp/progmodes/cc-vars.el
+++ b/lisp/progmodes/cc-vars.el
@@ -1619,8 +1619,8 @@ names)."))
   :type 'c-extra-types-widget
   :group 'c)
 
-(defvar c-noise-macro-with-parens-name-re nil)
-(defvar c-noise-macro-name-re nil)
+(defvar c-noise-macro-with-parens-name-re "\\<\\>")
+(defvar c-noise-macro-name-re "\\<\\>")
 
 (defcustom c-noise-macro-names nil
   "A list of names of macros which expand to nothing, or compiler extensions



reply via email to

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