]> code.delx.au - gnu-emacs/blobdiff - lisp/progmodes/cc-engine.el
Don't quote symbols 'like-this' in docstrings etc.
[gnu-emacs] / lisp / progmodes / cc-engine.el
index 9a6e975dd93158ff77eae58ea870cee2054ce72a..a0f44a23bca00c2e76fcb0b074d6111dfcf3c166 100644 (file)
@@ -1,6 +1,6 @@
 ;;; cc-engine.el --- core syntax guessing engine for CC mode -*- coding: utf-8 -*-
 
-;; Copyright (C) 1985, 1987, 1992-2014 Free Software Foundation, Inc.
+;; Copyright (C) 1985, 1987, 1992-2015 Free Software Foundation, Inc.
 
 ;; Authors:    2001- Alan Mackenzie
 ;;             1998- Martin Stjernholm
 
 (defmacro c-declare-lang-variables ()
   `(progn
-     ,@(mapcan (lambda (init)
-                `(,(if (elt init 2)
-                       `(defvar ,(car init) nil ,(elt init 2))
-                     `(defvar ,(car init) nil))
-                  (make-variable-buffer-local ',(car init))))
-              (cdr c-lang-variable-inits))))
+     ,@(c--mapcan (lambda (init)
+                   `(,(if (elt init 2)
+                          `(defvar ,(car init) nil ,(elt init 2))
+                        `(defvar ,(car init) nil))
+                     (make-variable-buffer-local ',(car init))))
+                (cdr c-lang-variable-inits))))
 (c-declare-lang-variables)
 
 \f
@@ -2277,7 +2277,9 @@ comment at the start of cc-engine.el for more info."
          (while
              ;; Add an element to `c-state-nonlit-pos-cache' each iteration.
              (and
-              (<= (setq npos (+ pos c-state-nonlit-pos-interval)) here)
+              (setq npos
+                    (when (<= (+ pos c-state-nonlit-pos-interval) here)
+                      (+ pos c-state-nonlit-pos-interval)))
 
               ;; Test for being in a literal.  If so, go to after it.
               (progn
@@ -2304,7 +2306,9 @@ comment at the start of cc-engine.el for more info."
          ;; Add one extra element above HERE so as to to avoid the previous
          ;; expensive calculation when the next call is close to the current
          ;; one.  This is especially useful when inside a large macro.
-         (setq c-state-nonlit-pos-cache (cons npos c-state-nonlit-pos-cache)))
+         (when npos
+           (setq c-state-nonlit-pos-cache
+                 (cons npos c-state-nonlit-pos-cache))))
 
        (if (> pos c-state-nonlit-pos-cache-limit)
            (setq c-state-nonlit-pos-cache-limit pos))
@@ -3069,7 +3073,7 @@ comment at the start of cc-engine.el for more info."
       (setq dropped-cons (consp (car c-state-cache)))
       (setq c-state-cache (cdr c-state-cache))
       (setq pos pa))
-    ;; At this stage, (> pos here);
+    ;; At this stage, (>= pos here);
     ;; (< (c-state-cache-top-lparen) here)  (or is nil).
 
     (cond
@@ -3131,16 +3135,20 @@ comment at the start of cc-engine.el for more info."
        nil))                           ; for the cond
 
      ((save-restriction
-        (narrow-to-region too-far-back (point-max))
-        (setq ren (c-safe (c-sc-scan-lists pos -1 -1))))
-
+       (narrow-to-region too-far-back (point-max))
+       (setq ren (c-safe (c-sc-scan-lists pos -1 -1))))
       ;; CASE 3: After a }/)/] before `here''s BOL.
       (list (1+ ren) (and dropped-cons pos) nil)) ; Return value
 
+     ((progn (setq good-pos (c-state-lit-beg (c-point 'bopl here-bol)))
+            (>= cache-pos good-pos))
+      ;; CASE 3.5: Just after an existing entry in `c-state-cache' on `here''s
+      ;; line or the previous line.
+      (list cache-pos nil nil))
+
      (t
       ;; CASE 4; Best of a bad job: BOL before `here-bol', or beginning of
       ;; literal containing it.
-      (setq good-pos (c-state-lit-beg (c-point 'bopl here-bol)))
       (list good-pos (and dropped-cons good-pos) nil)))))
 
 
@@ -4608,7 +4616,7 @@ comment at the start of cc-engine.el for more info."
 (defun c-literal-type (range)
   "Convenience function that given the result of `c-literal-limits',
 returns nil or the type of literal that the range surrounds, one
-of the symbols 'c, 'c++ or 'string.  It's much faster than using
+of the symbols `c', `c++' or `string'.  It's much faster than using
 `c-in-literal' and is intended to be used when you need both the
 type of a literal and its limits.
 
@@ -7968,7 +7976,7 @@ comment at the start of cc-engine.el for more info."
   ;; This should be called with point inside an argument list.
   ;;
   ;; Only one level of enclosing parentheses is considered, so for
-  ;; instance `nil' is returned when in a function call within an asm
+  ;; instance nil is returned when in a function call within an asm
   ;; operand.
   ;;
   ;; This function might do hidden buffer changes.