emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 5155144 2/2: Merge branch 'master' of git.savannah.


From: Eli Zaretskii
Subject: [Emacs-diffs] master 5155144 2/2: Merge branch 'master' of git.savannah.gnu.org:/srv/git/emacs
Date: Tue, 12 Jul 2016 13:19:38 +0000 (UTC)

branch: master
commit 5155144bd4cece3bab200a0eb613ffcdef523202
Merge: 1048151 a1db933
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>

    Merge branch 'master' of git.savannah.gnu.org:/srv/git/emacs
---
 lisp/progmodes/cc-engine.el |   10 +++----
 lisp/progmodes/cc-fonts.el  |   66 +++++++++++++++++++++++++------------------
 lisp/progmodes/cc-mode.el   |   22 +++++++++------
 3 files changed, 57 insertions(+), 41 deletions(-)

diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index 48b9e5e..8648bec 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -6039,7 +6039,7 @@ comment at the start of cc-engine.el for more info."
                      (search-backward "\"" (max (- (point) 17) (point-min)) t))
                  (not (bobp)))))
           (eq (char-before) ?R)
-          (looking-at "\"\\([^ ()\\\n\r\t]\\{,16\\}\\)("))
+          (looking-at "\"\\([^ ()\\\n\r\t]\\{0,16\\}\\)("))
        (setq open-quote-pos (point)
              open-paren-pos (match-end 1)
              id (match-string-no-properties 1))
@@ -6121,7 +6121,7 @@ comment at the start of cc-engine.el for more info."
               (concat "\\("                                 ; 1
                       c-anchored-cpp-prefix                 ; 2
                       "\\)\\|\\("                           ; 3
-                      "R\"\\([^ ()\\\n\r\t]\\{,16\\}\\)("   ; 4
+                      "R\"\\([^ ()\\\n\r\t]\\{0,16\\}\\)("  ; 4
                       "\\)")
               finish t))
     (when (save-excursion
@@ -6140,7 +6140,7 @@ comment at the start of cc-engine.el for more info."
          (goto-char (match-end 2))     ; after the "#".
          (while (and (< (point) eom)
                      (c-syntactic-re-search-forward
-                      "R\"\\([^ ()\\\n\r\t]\\{,16\\}\\)(" eom t))
+                      "R\"\\([^ ()\\\n\r\t]\\{0,16\\}\\)(" eom t))
            (c-depropertize-raw-string
             (match-string-no-properties 1) ; id
             (1+ (match-beginning 0))       ; open quote
@@ -6275,7 +6275,7 @@ comment at the start of cc-engine.el for more info."
                 (concat "\\("                                 ; 1
                         c-anchored-cpp-prefix                 ; 2
                         "\\)\\|\\("                           ; 3
-                        "R\"\\([^ ()\\\n\r\t]\\{,16\\}\\)("   ; 4
+                        "R\"\\([^ ()\\\n\r\t]\\{0,16\\}\\)("  ; 4
                         "\\)")
                 c-new-END t))
       (when (save-excursion
@@ -6294,7 +6294,7 @@ comment at the start of cc-engine.el for more info."
            (goto-char (match-end 2))   ; after the "#".
            (while (and (< (point) eom)
                        (c-syntactic-re-search-forward
-                        "R\"\\([^ ()\\\n\r\t]\\{,16\\}\\)(" eom t))
+                        "R\"\\([^ ()\\\n\r\t]\\{0,16\\}\\)(" eom t))
              (c-propertize-raw-string-opener
               (match-string-no-properties 1) ; id
               (1+ (match-beginning 0))       ; open quote
diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el
index dfc2c06..b45686c 100644
--- a/lisp/progmodes/cc-fonts.el
+++ b/lisp/progmodes/cc-fonts.el
@@ -1542,33 +1542,45 @@ casts and declarations are fontified.  Used on level 2 
and higher."
   ;; font-lock-keyword-face.  It always returns NIL to inhibit this and
   ;; prevent a repeat invocation.  See elisp/lispref page "Search-based
   ;; Fontification".
-  (while (search-forward-regexp
-         "R\\(\"\\)\\([^ ()\\\n\r\t]\\{,16\\}\\)(" limit t)
-    (when
-       (or (and (eobp)
-                (eq (c-get-char-property (1- (point)) 'face)
-                    'font-lock-warning-face))
-           (eq (c-get-char-property (point) 'face) 'font-lock-string-face)
-           (and (equal (c-get-char-property (match-end 2) 'syntax-table) '(1))
-                (equal (c-get-char-property (match-beginning 1) 'syntax-table)
-                       '(1))))
-      (let ((paren-prop (c-get-char-property (1- (point)) 'syntax-table)))
-       (if paren-prop
-           (progn
-             (c-put-font-lock-face (match-beginning 0) (match-end 0)
-                                   'font-lock-warning-face)
-             (when
-                 (and
-                  (equal paren-prop '(15))
-                  (not (c-search-forward-char-property 'syntax-table '(15) 
limit)))
-               (goto-char limit)))
-         (c-put-font-lock-face (match-beginning 1) (match-end 2) 'default)
-         (when (search-forward-regexp
-                (concat ")\\(" (regexp-quote (match-string-no-properties 2))
-                        "\\)\"")
-                limit t)
-           (c-put-font-lock-face (match-beginning 1) (point)
-                                 'default))))))
+  (let* ((state (c-state-semi-pp-to-literal (point)))
+        (string-start (and (eq (cadr state) 'string)
+                           (car (cddr state))))
+        (raw-id (and string-start
+                     (save-excursion
+                       (goto-char string-start)
+                       (and (eq (char-before) ?R)
+                            (looking-at "\"\\([^ ()\\\n\r\t]\\{0,16\\}\\)(")
+                            (match-string-no-properties 1))))))
+    (while (< (point) limit)
+      (if raw-id
+         (progn
+           (if (search-forward-regexp (concat ")\\(" (regexp-quote raw-id) 
"\\)\"")
+                                      limit 'limit)
+               (c-put-font-lock-face (match-beginning 1) (point) 'default))
+           (setq raw-id nil))
+
+       (when (search-forward-regexp
+              "R\\(\"\\)\\([^ ()\\\n\r\t]\\{0,16\\}\\)(" limit 'limit)
+         (when
+             (or (and (eobp)
+                      (eq (c-get-char-property (1- (point)) 'face)
+                          'font-lock-warning-face))
+                 (eq (c-get-char-property (point) 'face) 
'font-lock-string-face)
+                 (and (equal (c-get-char-property (match-end 2) 'syntax-table) 
'(1))
+                      (equal (c-get-char-property (match-beginning 1) 
'syntax-table)
+                             '(1))))
+           (let ((paren-prop (c-get-char-property (1- (point)) 'syntax-table)))
+             (if paren-prop
+                 (progn
+                   (c-put-font-lock-face (match-beginning 0) (match-end 0)
+                                         'font-lock-warning-face)
+                   (when
+                       (and
+                        (equal paren-prop '(15))
+                        (not (c-search-forward-char-property 'syntax-table 
'(15) limit)))
+                     (goto-char limit)))
+               (c-put-font-lock-face (match-beginning 1) (match-end 2) 
'default)
+               (setq raw-id (match-string-no-properties 2)))))))))
   nil)
 
 (c-lang-defconst c-simple-decl-matchers
diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el
index 6711a02..04d2ed6 100644
--- a/lisp/progmodes/cc-mode.el
+++ b/lisp/progmodes/cc-mode.el
@@ -924,14 +924,16 @@ Note that the style variables are always made local to 
the buffer."
   ;; before change function.
   (goto-char c-new-BEG)
   (c-beginning-of-macro)
-  (setq c-new-BEG (point))
+  (when (< (point) c-new-BEG)
+    (setq c-new-BEG (max (point) (c-determine-limit 500 c-new-BEG))))
 
   (goto-char c-new-END)
   (when (c-beginning-of-macro)
     (c-end-of-macro)
     (or (eobp) (forward-char)))         ; Over the terminating NL which may be 
marked
                                 ; with a c-cpp-delimiter category property
-  (setq c-new-END (point)))
+  (when (> (point) c-new-END)
+    (setq c-new-END (min (point) (c-determine-+ve-limit 500 c-new-END)))))
 
 (defun c-depropertize-new-text (beg end old-len)
   ;; Remove from the new text in (BEG END) any and all text properties which
@@ -959,15 +961,17 @@ Note that the style variables are always made local to 
the buffer."
   ;; Point is undefined on both entry and exit to this function.  The buffer
   ;; will have been widened on entry.
   ;;
+  ;; c-new-BEG has already been extended in `c-extend-region-for-CPP' so we
+  ;; don't need to repeat the exercise here.
+  ;;
   ;; This function is in the C/C++/ObjC value of 
`c-before-font-lock-functions'.
   (goto-char endd)
-  (if (c-beginning-of-macro)
-      (c-end-of-macro))
-  (setq c-new-END (max endd c-new-END (point)))
-  ;; Determine the region, (c-new-BEG c-new-END), which will get font
-  ;; locked.  This restricts the region should there be long macros.
-  (setq c-new-BEG (max c-new-BEG (c-determine-limit 500 begg))
-       c-new-END (min c-new-END (c-determine-+ve-limit 500 endd))))
+  (when (c-beginning-of-macro)
+    (c-end-of-macro)
+    ;; Determine the region, (c-new-BEG c-new-END), which will get font
+    ;; locked.  This restricts the region should there be long macros.
+    (setq c-new-END (min (max c-new-END (point))
+                        (c-determine-+ve-limit 500 c-new-END)))))
 
 (defun c-neutralize-CPP-line (beg end)
   ;; BEG and END bound a region, typically a preprocessor line.  Put a



reply via email to

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