emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] scratch/gnus-cloud 71a9236 08/15: Merge branch 'master' of


From: Teodor Zlatanov
Subject: [Emacs-diffs] scratch/gnus-cloud 71a9236 08/15: Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs
Date: Tue, 5 Jul 2016 02:22:47 +0000 (UTC)

branch: scratch/gnus-cloud
commit 71a9236da4e7f94c86c1cad921d99914d86f83d8
Merge: 08ca49d 4b9ac23
Author: Ted Zlatanov <address@hidden>
Commit: Ted Zlatanov <address@hidden>

    Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs
---
 lisp/progmodes/cc-fonts.el |   67 +++++++++++++++++++++++---------------------
 lisp/progmodes/cc-mode.el  |    5 ++--
 2 files changed, 38 insertions(+), 34 deletions(-)

diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el
index 52f0b0d..f122a95 100644
--- a/lisp/progmodes/cc-fonts.el
+++ b/lisp/progmodes/cc-fonts.el
@@ -1522,28 +1522,28 @@ casts and declarations are fontified.  Used on level 2 
and higher."
        (unless (or (eobp)
                    (looking-at "\\s(\\|\\s)"))
          (forward-char))
-       (setq bod-res (car (c-beginning-of-decl-1 decl-search-lim)))
-       (if (and (eq bod-res 'same)
-                (save-excursion
-                  (c-backward-syntactic-ws)
-                  (eq (char-before) ?\})))
-           (c-beginning-of-decl-1 decl-search-lim))
-
-       ;; We're now putatively at the declaration.
-       (setq paren-state (c-parse-state))
-       ;; At top level or inside a "{"?
-       (if (or (not (setq encl-pos
-                          (c-most-enclosing-brace paren-state)))
-               (eq (char-after encl-pos) ?\{))
-           (progn
-             (when (looking-at c-typedef-key) ; "typedef"
-               (setq is-typedef t)
-               (goto-char (match-end 0))
-               (c-forward-syntactic-ws))
-             ;; At a real declaration?
-             (if (memq (c-forward-type t) '(t known found decltype))
-                 (c-font-lock-declarators limit t is-typedef)))
-         nil)))))
+       (c-syntactic-skip-backward "^;{}" decl-search-lim t)
+       (when (eq (char-before) ?})
+         (c-go-list-backward)  ; brace block of struct, etc.?
+         (c-syntactic-skip-backward "^;{}" decl-search-lim t))
+       (when (or (bobp)
+                 (memq (char-before) '(?\; ?{ ?})))
+         (c-forward-syntactic-ws)
+         ;; We're now putatively at the declaration.
+         (setq paren-state (c-parse-state))
+         ;; At top level or inside a "{"?
+         (if (or (not (setq encl-pos
+                            (c-most-enclosing-brace paren-state)))
+                 (eq (char-after encl-pos) ?\{))
+             (progn
+               (when (looking-at c-typedef-key) ; "typedef"
+                 (setq is-typedef t)
+                 (goto-char (match-end 0))
+                 (c-forward-syntactic-ws))
+               ;; At a real declaration?
+               (if (memq (c-forward-type t) '(t known found decltype))
+                   (c-font-lock-declarators limit t is-typedef)))))))
+    nil))
 
 (defun c-font-lock-enclosing-decls (limit)
   ;; Fontify the declarators of (nested) declarations we're in the middle of.
@@ -1557,7 +1557,7 @@ casts and declarations are fontified.  Used on level 2 
and higher."
   ;; Fontification".
   (let* ((paren-state (c-parse-state))
         (decl-search-lim (c-determine-limit 1000))
-        decl-context in-typedef ps-elt)
+        in-typedef ps-elt)
     ;; Are we in any nested struct/union/class/etc. braces?
     (while paren-state
       (setq ps-elt (car paren-state)
@@ -1565,15 +1565,18 @@ casts and declarations are fontified.  Used on level 2 
and higher."
       (when (and (atom ps-elt)
                 (eq (char-after ps-elt) ?\{))
        (goto-char ps-elt)
-       (setq decl-context (c-beginning-of-decl-1 decl-search-lim)
-             in-typedef (looking-at c-typedef-key))
-       (if in-typedef (c-forward-token-2))
-       (when (and c-opt-block-decls-with-vars-key
-                  (looking-at c-opt-block-decls-with-vars-key))
-         (goto-char ps-elt)
-         (when (c-safe (c-forward-sexp))
-           (c-forward-syntactic-ws)
-           (c-font-lock-declarators limit t in-typedef)))))))
+       (c-syntactic-skip-backward "^;{}" decl-search-lim)
+       (when (or (bobp)
+                 (memq (char-before) '(?\; ?})))
+         (c-forward-syntactic-ws)
+         (setq in-typedef (looking-at c-typedef-key))
+         (if in-typedef (c-forward-token-2))
+         (when (and c-opt-block-decls-with-vars-key
+                    (looking-at c-opt-block-decls-with-vars-key))
+           (goto-char ps-elt)
+           (when (c-safe (c-forward-sexp))
+             (c-forward-syntactic-ws)
+             (c-font-lock-declarators limit t in-typedef))))))))
 
 (defun c-font-lock-raw-strings (limit)
   ;; Fontify C++ raw strings.
diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el
index 5ad7a01..6711a02 100644
--- a/lisp/progmodes/cc-mode.el
+++ b/lisp/progmodes/cc-mode.el
@@ -1310,9 +1310,10 @@ Note that the style variables are always made local to 
the buffer."
     (while
        ;; Go to a less nested declaration each time round this loop.
        (and
-        (eq (car (c-beginning-of-decl-1 bod-lim)) 'same)
+        (c-syntactic-skip-backward "^;{}" bod-lim t)
         (> (point) bod-lim)
-        (progn (setq bo-decl (point))
+        (progn (c-forward-syntactic-ws)
+               (setq bo-decl (point))
                ;; Are we looking at a keyword such as "template" or
                ;; "typedef" which can decorate a type, or the type itself?
                (when (or (looking-at c-prefix-spec-kwds-re)



reply via email to

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