]> code.delx.au - gnu-emacs/commitdiff
Merge trivially safe differences from standalone CC-mode.
authorStefan Monnier <monnier@iro.umontreal.ca>
Sat, 4 Oct 2014 04:03:49 +0000 (00:03 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Sat, 4 Oct 2014 04:03:49 +0000 (00:03 -0400)
* lisp/progmodes/cc-mode.el (c-initialize-cc-mode): Don't quote a symbol
just to then pass it to `symbol-value'.
(prog-mode): Provide fallback definition, if needed.
* lisp/progmodes/cc-langs.el: Always load `cl'.  Don't load `cl-lib'.
Remove "cl-" prefix accordingly.
* lisp/progmodes/cc-fonts.el (c-font-lock-invalid-string): Use integerp or
characterp depending on the type of characters.
(c-font-lock-enum-tail): Remove unused var `start'.
* lisp/progmodes/cc-engine.el: Load CL at compile-time.
(c-declare-lang-variables): Use mapcan.
(c-append-to-state-cache): Remove unused var `ce+1'.
(c-parse-state-state): Make buffer-local.
(c-ssb-lit-begin): Remove unused var `pps-end-pos'.
(c-just-after-func-arglist-p): Remove unused var `end'.
* lisp/progmodes/cc-defs.el: Load cc-fix if delete-dups is undefined.
(c-<-as-paren-syntax, c->-as-paren-syntax): Move definition earlier.
(c-make-keywords-re): Use delete-dups.
(c-get-current-file): Avoid file-name-base.
* lisp/progmodes/cc-cmds.el (c-electric-lt-gt): Remove unused var
`close-paren-inserted'.
* lisp/progmodes/cc-awk.el (c-forward-sws): Remove unused declaration.

lisp/ChangeLog
lisp/progmodes/cc-awk.el
lisp/progmodes/cc-cmds.el
lisp/progmodes/cc-defs.el
lisp/progmodes/cc-engine.el
lisp/progmodes/cc-fonts.el
lisp/progmodes/cc-guess.el
lisp/progmodes/cc-langs.el
lisp/progmodes/cc-menus.el
lisp/progmodes/cc-mode.el
lisp/progmodes/cc-vars.el

index 3591afde4ac6f86e422cd11736bb3f8d0d9543f7..75dac546c0ff53ec7b55dba2df7bef8bbfa0604a 100644 (file)
@@ -1,5 +1,28 @@
 2014-10-04  Stefan Monnier  <monnier@iro.umontreal.ca>
 
+       Merge trivially safe differences from standalone CC-mode.
+       * progmodes/cc-mode.el (c-initialize-cc-mode): Don't quote a symbol
+       just to then pass it to `symbol-value'.
+       (prog-mode): Provide fallback definition, if needed.
+       * progmodes/cc-langs.el: Always load `cl'.  Don't load `cl-lib'.
+       Remove "cl-" prefix accordingly.
+       * progmodes/cc-fonts.el (c-font-lock-invalid-string): Use integerp or
+       characterp depending on the type of characters.
+       (c-font-lock-enum-tail): Remove unused var `start'.
+       * progmodes/cc-engine.el: Load CL at compile-time.
+       (c-declare-lang-variables): Use mapcan.
+       (c-append-to-state-cache): Remove unused var `ce+1'.
+       (c-parse-state-state): Make buffer-local.
+       (c-ssb-lit-begin): Remove unused var `pps-end-pos'.
+       (c-just-after-func-arglist-p): Remove unused var `end'.
+       * progmodes/cc-defs.el: Load cc-fix if delete-dups is undefined.
+       (c-<-as-paren-syntax, c->-as-paren-syntax): Move definition earlier.
+       (c-make-keywords-re): Use delete-dups.
+       (c-get-current-file): Avoid file-name-base.
+       * progmodes/cc-cmds.el (c-electric-lt-gt): Remove unused var
+       `close-paren-inserted'.
+       * progmodes/cc-awk.el (c-forward-sws): Remove unused declaration.
+
        * progmodes/python.el: Avoid building unneeded markers.
        (python-font-lock-keywords, python-indent-dedent-line)
        (python-fill-paren, python-shell-completion-complete-or-indent):
index 44d69d7d0f1e653d25dddd2cad1dbde4f8b61997..d57d601cd7aa5935a8b00486af7b782c5ab2e08a 100644 (file)
@@ -61,7 +61,6 @@
 (cc-bytecomp-defun c-backward-token-1)
 (cc-bytecomp-defun c-beginning-of-statement-1)
 (cc-bytecomp-defun c-backward-sws)
-(cc-bytecomp-defun c-forward-sws)
 
 (defvar awk-mode-syntax-table
   (let ((st (make-syntax-table)))
index 4f205d62a4cd3f714ac4a06ca035ddde120640d7..afbd577b10dc71fb503c9891ba7760343bd70d7d 100644 (file)
@@ -1090,7 +1090,7 @@ numeric argument is supplied, or the point is inside a literal."
 
   (interactive "*P")
   (let ((c-echo-syntactic-information-p nil)
-       final-pos close-paren-inserted found-delim case-fold-search)
+       final-pos found-delim case-fold-search)
 
     (self-insert-command (prefix-numeric-value arg))
     (setq final-pos (point))
index 5d528caabb263c3467cad65797e23e5e8e6b95e2..dc31fde131dce09288cddaabac41d200aece6c2d 100644 (file)
               font-lock-keywords)))
       (cc-load "cc-fix")))
 
+;; XEmacs 21.4 doesn't have `delete-dups'.
+(eval-and-compile
+  (if (and (not (fboundp 'delete-dups))
+          (not (featurep 'cc-fix)))
+      (cc-load "cc-fix")))
 \f
 ;;; Variables also used at compile time.
 
@@ -913,6 +918,12 @@ MODE is either a mode symbol or a list of mode symbols."
                               (cc-bytecomp-fboundp 'delete-extent)
                               (cc-bytecomp-fboundp 'map-extents))))
 
+(defconst c-<-as-paren-syntax '(4 . ?>))
+(put 'c-<-as-paren-syntax 'syntax-table c-<-as-paren-syntax)
+
+(defconst c->-as-paren-syntax '(5 . ?<))
+(put 'c->-as-paren-syntax 'syntax-table c->-as-paren-syntax)
+
 ;; `c-put-char-property' is complex enough in XEmacs and Emacs < 21 to
 ;; make it a function.
 (defalias 'c-put-char-property-fun
@@ -1188,9 +1199,6 @@ been put there by c-put-char-property.  POINT remains unchanged."
     (if (< (point) start)
        (goto-char (point-max)))))
 
-(defconst c-<-as-paren-syntax '(4 . ?>))
-(put 'c-<-as-paren-syntax 'syntax-table c-<-as-paren-syntax)
-
 (defsubst c-mark-<-as-paren (pos)
   ;; Mark the "<" character at POS as a template opener using the
   ;; `syntax-table' property via the `category' property.
@@ -1201,9 +1209,6 @@ been put there by c-put-char-property.  POINT remains unchanged."
   ;; cheaply.  We use this, for instance, in `c-parse-state'.
   (c-put-char-property pos 'category 'c-<-as-paren-syntax))
 
-(defconst c->-as-paren-syntax '(5 . ?<))
-(put 'c->-as-paren-syntax 'syntax-table c->-as-paren-syntax)
-
 (defsubst c-mark->-as-paren (pos)
   ;; Mark the ">" character at POS as an sexp list closer using the
   ;; syntax-table property.
@@ -1419,8 +1424,8 @@ Notably, null elements in LIST are ignored."
 
 (defun c-make-keywords-re (adorn list &optional mode)
   "Make a regexp that matches all the strings the list.
-Duplicates and nil elements in the list are removed.  The resulting
-regexp may contain zero or more submatch expressions.
+Duplicates and nil elements in the list are removed.  The
+resulting regexp may contain zero or more submatch expressions.
 
 If ADORN is t there will be at least one submatch and the first
 surrounds the matched alternative, and the regexp will also not match
@@ -1438,11 +1443,7 @@ The optional MODE specifies the language to get `c-nonsymbol-key' from
 when it's needed.  The default is the current language taken from
 `c-buffer-is-cc-mode'."
 
-  (let (unique)
-    (dolist (elt list)
-      (unless (member elt unique)
-       (push elt unique)))
-    (setq list (delete nil unique)))
+  (setq list (delete nil (delete-dups list)))
   (if list
       (let (re)
 
@@ -1638,13 +1639,13 @@ non-nil, a caret is prepended to invert the set."
                  "support for the `syntax-table' text property "
                  "is required.")))
 
-       ;; Find out if generic comment delimiters work.
+       ;; Find out if "\\s!" (generic comment delimiters) work.
        (c-safe
          (modify-syntax-entry ?x "!")
          (if (string-match "\\s!" "x")
              (setq list (cons 'gen-comment-delim list))))
 
-       ;; Find out if generic string delimiters work.
+       ;; Find out if "\\s|" (generic string delimiters) work.
        (c-safe
          (modify-syntax-entry ?x "|")
          (if (string-match "\\s|" "x")
@@ -1691,7 +1692,8 @@ non-nil, a caret is prepended to invert the set."
       (kill-buffer buf))
 
     ;; See if `parse-partial-sexp' returns the eighth element.
-    (if (c-safe (>= (length (save-excursion (parse-partial-sexp (point) (point))))
+    (if (c-safe (>= (length (save-excursion
+                             (parse-partial-sexp (point) (point))))
                    10))
        (setq list (cons 'pps-extended-state list))
       (error (concat
@@ -1707,9 +1709,8 @@ might be present:
 
 '8-bit              8 bit syntax entry flags (XEmacs style).
 '1-bit              1 bit syntax entry flags (Emacs style).
-'argumentative-bod-function         beginning-of-defun passes ARG through
-                    to a non-null beginning-of-defun-function.  It is assumed
-                   the end-of-defun does the same thing.
+'argumentative-bod-function        beginning-of-defun and end-of-defun pass
+                   ARG through to beginning/end-of-defun-function.
 'syntax-properties  It works to override the syntax for specific characters
                    in the buffer with the 'syntax-table property.  It's
                    always set - CC Mode no longer works in emacsen without
@@ -1803,18 +1804,18 @@ system."
     (error "Unknown base mode `%s'" base-mode))
   (put mode 'c-fallback-mode base-mode))
 
-(defvar c-lang-constants (make-vector 151 0)
-  "Obarray used as a cache to keep track of the language constants.
-The constants stored are those defined by `c-lang-defconst' and the values
-computed by `c-lang-const'.  It's mostly used at compile time but it's not
-stored in compiled files.
+(defvar c-lang-constants (make-vector 151 0))
+;;   Obarray used as a cache to keep track of the language constants.
+;; The constants stored are those defined by `c-lang-defconst' and the values
+;; computed by `c-lang-const'.  It's mostly used at compile time but it's not
+;; stored in compiled files.
 
-The obarray contains all the language constants as symbols.  The
-value cells hold the evaluated values as alists where each car is
-the mode name symbol and the corresponding cdr is the evaluated
-value in that mode.  The property lists hold the source definitions
-and other miscellaneous data.  The obarray might also contain
-various other symbols, but those don't have any variable bindings.")
+;; The obarray contains all the language constants as symbols.  The
+;; value cells hold the evaluated values as alists where each car is
+;; the mode name symbol and the corresponding cdr is the evaluated
+;; value in that mode.  The property lists hold the source definitions
+;; and other miscellaneous data.  The obarray might also contain
+;; various other symbols, but those don't have any variable bindings.
 
 (defvar c-lang-const-expansion nil)
 
@@ -1831,7 +1832,9 @@ various other symbols, but those don't have any variable bindings.")
               (t
                ;; Being evaluated interactively.
                (buffer-file-name)))))
-    (and file (file-name-base file))))
+    (and file
+        (file-name-sans-extension
+         (file-name-nondirectory file)))))
 
 (defmacro c-lang-defconst-eval-immediately (form)
   "Can be used inside a VAL in `c-lang-defconst' to evaluate FORM
index 224ea36a22a6442b21cd030d2fd516667aeefe54..d17be71a2d1c7a5a1470e81a485974ba7e366076 100644 (file)
 (cc-require-when-compile 'cc-langs)
 (cc-require 'cc-vars)
 
+(eval-when-compile (require 'cl))
+
 \f
 ;; Make declarations for all the `c-lang-defvar' variables in cc-langs.
 
 (defmacro c-declare-lang-variables ()
   `(progn
-     ,@(apply 'nconc
-             (mapcar (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)))))
+     ,@(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
@@ -826,7 +827,6 @@ comment at the start of cc-engine.el for more info."
            ;; Record this as the first token if not starting inside it.
            (setq tok start))
 
-
        ;; The following while loop goes back one sexp (balanced parens,
        ;; etc. with contents, or symbol or suchlike) each iteration.  This
        ;; movement is accomplished with a call to c-backward-sexp approx 170
@@ -2159,7 +2159,6 @@ comment at the start of cc-engine.el for more info."
 ;; the middle of the desert, as long as it is not within a brace pair
 ;; recorded in `c-state-cache' or a paren/bracket pair.
 
-
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; We maintain a simple cache of positions which aren't in a literal, so as to
 ;; speed up testing for non-literality.
@@ -2780,7 +2779,7 @@ comment at the start of cc-engine.el for more info."
        paren+1               ; Pos after some opening or closing paren.
        paren+1s              ; A list of `paren+1's; used to determine a
                              ; good-pos.
-       bra+1 ce+1            ; just after L/R bra-ces.
+       bra+1                 ; just after L bra-ce.
        bra+1s                ; list of OLD values of bra+1.
        mstart)               ; start of a macro.
 
@@ -3392,6 +3391,7 @@ comment at the start of cc-engine.el for more info."
 
 (defvar c-parse-state-point nil)
 (defvar c-parse-state-state nil)
+(make-variable-buffer-local 'c-parse-state-state)
 (defun c-record-parse-state-state ()
   (setq c-parse-state-point (point))
   (setq c-parse-state-state
@@ -4166,7 +4166,7 @@ comment at the start of cc-engine.el for more info."
   ;; Use `parse-partial-sexp' from a safe position down to the point to check
   ;; if it's outside comments and strings.
   (save-excursion
-    (let ((pos (point)) safe-pos state pps-end-pos)
+    (let ((pos (point)) safe-pos state)
       ;; Pick a safe position as close to the point as possible.
       ;;
       ;; FIXME: Consult `syntax-ppss' here if our cache doesn't give a good
@@ -4860,14 +4860,17 @@ comment at the start of cc-engine.el for more info."
   ;; it should return non-nil to ensure that the next search will find them.
   ;;
   ;; Such a spot is:
-  ;; o  The first token after bob.
-  ;; o  The first token after the end of submatch 1 in
-  ;;    `c-decl-prefix-or-start-re' when that submatch matches.
-  ;; o  The start of each `c-decl-prefix-or-start-re' match when
-  ;;    submatch 1 doesn't match.
-  ;; o  The first token after the end of each occurrence of the
-  ;;    `c-type' text property with the value `c-decl-end', provided
-  ;;    `c-type-decl-end-used' is set.
+  ;; o The first token after bob.
+  ;; o The first token after the end of submatch 1 in
+  ;;   `c-decl-prefix-or-start-re' when that submatch matches.  This
+  ;;   submatch is typically a (L or R) brace or paren, a ;, or a ,.
+  ;; o The start of each `c-decl-prefix-or-start-re' match when
+  ;;   submatch 1 doesn't match.  This is, for example, the keyword
+  ;;   "class" in Pike.
+  ;; o The start of a previously recognized declaration; "recognized"
+  ;;   means that the last char of the previous token has a `c-type'
+  ;;   text property with the value `c-decl-end'; this only holds
+  ;;   when `c-type-decl-end-used' is set.
   ;;
   ;; Only a spot that match CFD-DECL-RE and whose face is in the
   ;; CFD-FACE-CHECKLIST list causes CFD-FUN to be called.  The face
@@ -4899,7 +4902,7 @@ comment at the start of cc-engine.el for more info."
   ;;
   ;; This function might do hidden buffer changes.
 
-  (let ((cfd-start-pos (point))
+  (let ((cfd-start-pos (point))                ; never changed
        (cfd-buffer-end (point-max))
        ;; The end of the token preceding the decl spot last found
        ;; with `c-decl-prefix-or-start-re'.  `cfd-limit' if there's
@@ -4938,10 +4941,20 @@ comment at the start of cc-engine.el for more info."
       ;; statement or declaration, which is earlier than the first
       ;; returned match.
 
+      ;; This `cond' moves back over any literals or macros.  It has special
+      ;; handling for when the region being searched is entirely within a
+      ;; macro.  It sets `cfd-continue-pos' (unless we've reached
+      ;; `cfd-limit').
       (cond
        ;; First we need to move to a syntactically relevant position.
        ;; Begin by backing out of comment or string literals.
+       ;;
+       ;; This arm of the cond actually triggers if we're in a literal,
+       ;; and cfd-limit is at most at BONL.
        ((and
+        ;; This arm of the `and' moves backwards out of a literal when
+        ;; the face at point is a literal face.  In this case, its value
+        ;; is always non-nil.
         (when (c-got-face-at (point) c-literal-faces)
           ;; Try to use the faces to back up to the start of the
           ;; literal.  FIXME: What if the point is on a declaration
@@ -4970,7 +4983,7 @@ comment at the start of cc-engine.el for more info."
             (let ((range (c-literal-limits)))
               (if range (goto-char (car range)))))
 
-          (setq start-in-literal (point)))
+          (setq start-in-literal (point))) ; end of `and' arm.
 
         ;; The start is in a literal.  If the limit is in the same
         ;; one we don't have to find a syntactic position etc.  We
@@ -4985,18 +4998,18 @@ comment at the start of cc-engine.el for more info."
                                (point) 'face nil cfd-limit))
                    (and (< (point) cfd-limit)
                         (c-got-face-at (point) c-literal-faces))))
-          (= (point) cfd-limit)))
+          (= (point) cfd-limit)))      ; end of `cond' arm condition
 
        ;; Completely inside a literal.  Set up variables to trig the
        ;; (< cfd-continue-pos cfd-start-pos) case below and it'll
        ;; find a suitable start position.
-       (setq cfd-continue-pos start-in-literal))
+       (setq cfd-continue-pos start-in-literal)) ; end of `cond' arm
 
        ;; Check if the region might be completely inside a macro, to
        ;; optimize that like the completely-inside-literal above.
        ((save-excursion
          (and (= (forward-line 1) 0)
-              (bolp)                   ; forward-line has funny behavior at eob.
+              (bolp)                 ; forward-line has funny behavior at eob.
               (>= (point) cfd-limit)
               (progn (backward-char)
                      (eq (char-before) ?\\))))
@@ -5006,6 +5019,8 @@ comment at the start of cc-engine.el for more info."
        (setq cfd-continue-pos (1- cfd-start-pos)
              start-in-macro t))
 
+       ;; The default arm of the `cond' moves back over any macro we're in
+       ;; and over any syntactic WS.  It sets `c-find-decl-syntactic-pos'.
        (t
        ;; Back out of any macro so we don't miss any declaration
        ;; that could follow after it.
@@ -5052,10 +5067,10 @@ comment at the start of cc-engine.el for more info."
                  (< (point) cfd-limit))
            ;; Do an initial search now.  In the bob case above it's
            ;; only done to search for a `c-decl-end' spot.
-           (c-find-decl-prefix-search))
+           (c-find-decl-prefix-search)) ; sets cfd-continue-pos
 
          (setq c-find-decl-match-pos (and (< cfd-match-pos cfd-start-pos)
-                                          cfd-match-pos)))))
+                                          cfd-match-pos))))) ; end of `cond'
 
       ;; Advance `cfd-continue-pos' if it's before the start position.
       ;; The closest continue position that might have effect at or
@@ -5114,7 +5129,7 @@ comment at the start of cc-engine.el for more info."
          ;; `cfd-match-pos' so we can continue at the start position.
          ;; (Note that we don't get here if the first match is below
          ;; it.)
-         (goto-char cfd-start-pos)))
+         (goto-char cfd-start-pos)))   ; end of `cond'
 
        ;; Delete found matches if they are before our new continue
        ;; position, so that `c-find-decl-prefix-search' won't back up
@@ -5123,7 +5138,7 @@ comment at the start of cc-engine.el for more info."
        (when (and cfd-re-match (< cfd-re-match cfd-continue-pos))
          (setq cfd-re-match nil))
        (when (and cfd-prop-match (< cfd-prop-match cfd-continue-pos))
-         (setq cfd-prop-match nil)))
+         (setq cfd-prop-match nil)))   ; end of `when'
 
       (if syntactic-pos
          ;; This is the normal case and we got a proper syntactic
@@ -5144,9 +5159,10 @@ comment at the start of cc-engine.el for more info."
        ;; good start position for the search, so do it.
        (c-find-decl-prefix-search)))
 
-    ;; Now loop.  Round what?  (ACM, 2006/7/5).  We already got the first match.
-
+    ;; Now loop, one decl spot per iteration.  We already have the first
+    ;; match in `cfd-match-pos'.
     (while (progn
+            ;; Go foward over "false matches", one per iteration.
             (while (and
                     (< cfd-match-pos cfd-limit)
 
@@ -5187,10 +5203,10 @@ comment at the start of cc-engine.el for more info."
                          (goto-char cfd-continue-pos)
                          t)))
 
-                    (< (point) cfd-limit))
-              (c-find-decl-prefix-search))
+                    (< (point) cfd-limit)) ; end of "false matches" condition
+              (c-find-decl-prefix-search)) ; end of "false matches" loop
 
-            (< (point) cfd-limit))
+            (< (point) cfd-limit))   ; end of condition for "decl-spot" while
 
       (when (and
             (>= (point) cfd-start-pos)
@@ -5218,7 +5234,7 @@ comment at the start of cc-engine.el for more info."
                   ;; The matched token was the last thing in the macro,
                   ;; so the whole match is bogus.
                   (setq cfd-macro-end 0)
-                  nil))))
+                  nil))))              ; end of when condition
 
        (c-debug-put-decl-spot-faces cfd-match-pos (point))
        (if (funcall cfd-fun cfd-match-pos (/= cfd-macro-end 0))
@@ -5531,8 +5547,6 @@ comment at the start of cc-engine.el for more info."
       (when need-new-end
        (and (> new-end c-new-END) (setq c-new-END new-end))))))
 
-
-
 (defun c-after-change-check-<>-operators (beg end)
   ;; This is called from `after-change-functions' when
   ;; c-recognize-<>-arglists' is set.  It ensures that no "<" or ">"
@@ -5867,7 +5881,6 @@ comment at the start of cc-engine.el for more info."
   ;; Recursive part of `c-forward-<>-arglist'.
   ;;
   ;; This function might do hidden buffer changes.
-
   (let ((start (point)) res pos tmp
        ;; Cover this so that any recorded found type ranges are
        ;; automatically lost if it turns out to not be an angle
@@ -5993,7 +6006,6 @@ comment at the start of cc-engine.el for more info."
                                       (c-keyword-member
                                        (c-keyword-sym (match-string 1))
                                        'c-<>-type-kwds)))))))
-
                      ;; It was an angle bracket arglist.
                      (setq c-record-found-types subres)
 
@@ -7100,36 +7112,35 @@ comment at the start of cc-engine.el for more info."
        (catch 'at-decl-or-cast
 
         ;; CASE 1
-       (when (> paren-depth 0)
-         ;; Encountered something inside parens that isn't matched by
-         ;; the `c-type-decl-*' regexps, so it's not a type decl
-         ;; expression.  Try to skip out to the same paren depth to
-         ;; not confuse the cast check below.
-         (c-safe (goto-char (scan-lists (point) 1 paren-depth)))
-         ;; If we've found a specifier keyword then it's a
-         ;; declaration regardless.
-         (throw 'at-decl-or-cast (eq at-decl-or-cast t)))
-
-       (setq at-decl-end
-             (looking-at (cond ((eq context '<>) "[,>]")
-                               (context "[,\)]")
-                               (t "[,;]"))))
-
-       ;; Now we've collected info about various characteristics of
-       ;; the construct we're looking at.  Below follows a decision
-       ;; tree based on that.  It's ordered to check more certain
-       ;; signs before less certain ones.
-
-       (if got-identifier
-           (progn
-
-             ;; CASE 2
-             (when (and (or at-type maybe-typeless)
-                        (not (or got-prefix got-parens)))
-               ;; Got another identifier directly after the type, so it's a
-               ;; declaration.
-               (throw 'at-decl-or-cast t))
+        (when (> paren-depth 0)
+          ;; Encountered something inside parens that isn't matched by
+          ;; the `c-type-decl-*' regexps, so it's not a type decl
+          ;; expression.  Try to skip out to the same paren depth to
+          ;; not confuse the cast check below.
+          (c-safe (goto-char (scan-lists (point) 1 paren-depth)))
+          ;; If we've found a specifier keyword then it's a
+          ;; declaration regardless.
+          (throw 'at-decl-or-cast (eq at-decl-or-cast t)))
+
+        (setq at-decl-end
+              (looking-at (cond ((eq context '<>) "[,>]")
+                                (context "[,\)]")
+                                (t "[,;]"))))
+
+        ;; Now we've collected info about various characteristics of
+        ;; the construct we're looking at.  Below follows a decision
+        ;; tree based on that.  It's ordered to check more certain
+        ;; signs before less certain ones.
+
+        (if got-identifier
+            (progn
 
+              ;; CASE 2
+              (when (and (or at-type maybe-typeless)
+                         (not (or got-prefix got-parens)))
+                ;; Got another identifier directly after the type, so it's a
+                ;; declaration.
+                (throw 'at-decl-or-cast t))
 
               (when (and got-parens
                          (not got-prefix)
@@ -7151,9 +7162,9 @@ comment at the start of cc-engine.el for more info."
                 (c-fdoc-shift-type-backward)))
 
           ;; Found no identifier.
-         (if backup-at-type
-             (progn
 
+          (if backup-at-type
+              (progn
 
                 ;; CASE 3
                 (when (= (point) start)
@@ -7176,251 +7187,251 @@ comment at the start of cc-engine.el for more info."
                     (setq backup-if-not-cast t)
                     (throw 'at-decl-or-cast t)))
 
-               ;; CASE 4
-               (when (and got-suffix
-                          (not got-prefix)
-                          (not got-parens))
-                 ;; Got a plain list of identifiers followed by some suffix.
-                 ;; If this isn't a cast then the last identifier probably is
-                 ;; the declared one and we should back up to the previous
-                 ;; type.
-                 (setq backup-if-not-cast t)
-                 (throw 'at-decl-or-cast t)))
-
-           ;; CASE 5
-           (when (eq at-type t)
-             ;; If the type is known we know that there can't be any
-             ;; identifier somewhere else, and it's only in declarations in
-             ;; e.g. function prototypes and in casts that the identifier may
-             ;; be left out.
-             (throw 'at-decl-or-cast t))
-
-           (when (= (point) start)
-             ;; Only got a single identifier (parsed as a type so far).
-             ;; CASE 6
-             (if (and
-                  ;; Check that the identifier isn't at the start of an
-                  ;; expression.
-                  at-decl-end
-                  (cond
-                   ((eq context 'decl)
-                    ;; Inside an arglist that contains declarations.  If K&R
-                    ;; style declarations and parenthesis style initializers
-                    ;; aren't allowed then the single identifier must be a
-                    ;; type, else we require that it's known or found
-                    ;; (primitive types are handled above).
-                    (or (and (not c-recognize-knr-p)
-                             (not c-recognize-paren-inits))
-                        (memq at-type '(known found))))
-                   ((eq context '<>)
-                    ;; Inside a template arglist.  Accept known and found
-                    ;; types; other identifiers could just as well be
-                    ;; constants in C++.
-                    (memq at-type '(known found)))))
-                 (throw 'at-decl-or-cast t)
-               ;; CASE 7
-               ;; Can't be a valid declaration or cast, but if we've found a
-               ;; specifier it can't be anything else either, so treat it as
-               ;; an invalid/unfinished declaration or cast.
-               (throw 'at-decl-or-cast at-decl-or-cast))))
-
-         (if (and got-parens
-                  (not got-prefix)
-                  (not context)
-                  (not (eq at-type t))
-                  (or backup-at-type
-                      maybe-typeless
-                      backup-maybe-typeless
-                      (when c-recognize-typeless-decls
-                        (or (not got-suffix)
-                            (not (looking-at
-                                  c-after-suffixed-type-maybe-decl-key))))))
-             ;; Got an empty paren pair and a preceding type that probably
-             ;; really is the identifier.  Shift the type backwards to make
-             ;; the last one the identifier.  This is analogous to the
-             ;; "backtracking" done inside the `c-type-decl-suffix-key' loop
-             ;; above.
-             ;;
-             ;; Exception: In addition to the conditions in that
-             ;; "backtracking" code, do not shift backward if we're not
-             ;; looking at either `c-after-suffixed-type-decl-key' or "[;,]".
-             ;; Since there's no preceding type, the shift would mean that
-             ;; the declaration is typeless.  But if the regexp doesn't match
-             ;; then we will simply fall through in the tests below and not
-             ;; recognize it at all, so it's better to try it as an abstract
-             ;; declarator instead.
-             (c-fdoc-shift-type-backward)
-
-           ;; Still no identifier.
-           ;; CASE 8
-           (when (and got-prefix (or got-parens got-suffix))
-             ;; Require `got-prefix' together with either `got-parens' or
-             ;; `got-suffix' to recognize it as an abstract declarator:
-             ;; `got-parens' only is probably an empty function call.
-             ;; `got-suffix' only can build an ordinary expression together
-             ;; with the preceding identifier which we've taken as a type.
-             ;; We could actually accept on `got-prefix' only, but that can
-             ;; easily occur temporarily while writing an expression so we
-             ;; avoid that case anyway.  We could do a better job if we knew
-             ;; the point when the fontification was invoked.
-             (throw 'at-decl-or-cast t))
-
-           ;; CASE 9
-           (when (and at-type
-                      (not got-prefix)
-                      (not got-parens)
-                      got-suffix-after-parens
-                      (eq (char-after got-suffix-after-parens) ?\())
-             ;; Got a type, no declarator but a paren suffix. I.e. it's a
-             ;; normal function call after all (or perhaps a C++ style object
-             ;; instantiation expression).
-             (throw 'at-decl-or-cast nil))))
-
-       ;; CASE 10
-       (when at-decl-or-cast
-         ;; By now we've located the type in the declaration that we know
-         ;; we're in.
-         (throw 'at-decl-or-cast t))
-
-       ;; CASE 11
-       (when (and got-identifier
-                  (not context)
-                  (looking-at c-after-suffixed-type-decl-key)
-                  (if (and got-parens
+                ;; CASE 4
+                (when (and got-suffix
                            (not got-prefix)
-                           (not got-suffix)
-                           (not (eq at-type t)))
-                      ;; Shift the type backward in the case that there's a
-                      ;; single identifier inside parens.  That can only
-                      ;; occur in K&R style function declarations so it's
-                      ;; more likely that it really is a function call.
-                      ;; Therefore we only do this after
-                      ;; `c-after-suffixed-type-decl-key' has matched.
-                      (progn (c-fdoc-shift-type-backward) t)
-                    got-suffix-after-parens))
-         ;; A declaration according to `c-after-suffixed-type-decl-key'.
-         (throw 'at-decl-or-cast t))
-
-       ;; CASE 12
-       (when (and (or got-prefix (not got-parens))
-                  (memq at-type '(t known)))
-         ;; It's a declaration if a known type precedes it and it can't be a
-         ;; function call.
-         (throw 'at-decl-or-cast t))
-
-       ;; If we get here we can't tell if this is a type decl or a normal
-       ;; expression by looking at it alone.  (That's under the assumption
-       ;; that normal expressions always can look like type decl expressions,
-       ;; which isn't really true but the cases where it doesn't hold are so
-       ;; uncommon (e.g. some placements of "const" in C++) it's not worth
-       ;; the effort to look for them.)
+                           (not got-parens))
+                  ;; Got a plain list of identifiers followed by some suffix.
+                  ;; If this isn't a cast then the last identifier probably is
+                  ;; the declared one and we should back up to the previous
+                  ;; type.
+                  (setq backup-if-not-cast t)
+                  (throw 'at-decl-or-cast t)))
+
+            ;; CASE 5
+            (when (eq at-type t)
+              ;; If the type is known we know that there can't be any
+              ;; identifier somewhere else, and it's only in declarations in
+              ;; e.g. function prototypes and in casts that the identifier may
+              ;; be left out.
+              (throw 'at-decl-or-cast t))
+
+            (when (= (point) start)
+              ;; Only got a single identifier (parsed as a type so far).
+              ;; CASE 6
+              (if (and
+                   ;; Check that the identifier isn't at the start of an
+                   ;; expression.
+                   at-decl-end
+                   (cond
+                    ((eq context 'decl)
+                     ;; Inside an arglist that contains declarations.  If K&R
+                     ;; style declarations and parenthesis style initializers
+                     ;; aren't allowed then the single identifier must be a
+                     ;; type, else we require that it's known or found
+                     ;; (primitive types are handled above).
+                     (or (and (not c-recognize-knr-p)
+                              (not c-recognize-paren-inits))
+                         (memq at-type '(known found))))
+                    ((eq context '<>)
+                     ;; Inside a template arglist.  Accept known and found
+                     ;; types; other identifiers could just as well be
+                     ;; constants in C++.
+                     (memq at-type '(known found)))))
+                  (throw 'at-decl-or-cast t)
+                ;; CASE 7
+                ;; Can't be a valid declaration or cast, but if we've found a
+                ;; specifier it can't be anything else either, so treat it as
+                ;; an invalid/unfinished declaration or cast.
+                (throw 'at-decl-or-cast at-decl-or-cast))))
+
+          (if (and got-parens
+                   (not got-prefix)
+                   (not context)
+                   (not (eq at-type t))
+                   (or backup-at-type
+                       maybe-typeless
+                       backup-maybe-typeless
+                       (when c-recognize-typeless-decls
+                         (or (not got-suffix)
+                             (not (looking-at
+                                   c-after-suffixed-type-maybe-decl-key))))))
+              ;; Got an empty paren pair and a preceding type that probably
+              ;; really is the identifier.  Shift the type backwards to make
+              ;; the last one the identifier.  This is analogous to the
+              ;; "backtracking" done inside the `c-type-decl-suffix-key' loop
+              ;; above.
+              ;;
+              ;; Exception: In addition to the conditions in that
+              ;; "backtracking" code, do not shift backward if we're not
+              ;; looking at either `c-after-suffixed-type-decl-key' or "[;,]".
+              ;; Since there's no preceding type, the shift would mean that
+              ;; the declaration is typeless.  But if the regexp doesn't match
+              ;; then we will simply fall through in the tests below and not
+              ;; recognize it at all, so it's better to try it as an abstract
+              ;; declarator instead.
+              (c-fdoc-shift-type-backward)
+
+            ;; Still no identifier.
+            ;; CASE 8
+            (when (and got-prefix (or got-parens got-suffix))
+              ;; Require `got-prefix' together with either `got-parens' or
+              ;; `got-suffix' to recognize it as an abstract declarator:
+              ;; `got-parens' only is probably an empty function call.
+              ;; `got-suffix' only can build an ordinary expression together
+              ;; with the preceding identifier which we've taken as a type.
+              ;; We could actually accept on `got-prefix' only, but that can
+              ;; easily occur temporarily while writing an expression so we
+              ;; avoid that case anyway.  We could do a better job if we knew
+              ;; the point when the fontification was invoked.
+              (throw 'at-decl-or-cast t))
+
+            ;; CASE 9
+            (when (and at-type
+                       (not got-prefix)
+                       (not got-parens)
+                       got-suffix-after-parens
+                       (eq (char-after got-suffix-after-parens) ?\())
+              ;; Got a type, no declarator but a paren suffix. I.e. it's a
+              ;; normal function call after all (or perhaps a C++ style object
+              ;; instantiation expression).
+              (throw 'at-decl-or-cast nil))))
+
+        ;; CASE 10
+        (when at-decl-or-cast
+          ;; By now we've located the type in the declaration that we know
+          ;; we're in.
+          (throw 'at-decl-or-cast t))
+
+        ;; CASE 11
+        (when (and got-identifier
+                   (not context)
+                   (looking-at c-after-suffixed-type-decl-key)
+                   (if (and got-parens
+                            (not got-prefix)
+                            (not got-suffix)
+                            (not (eq at-type t)))
+                       ;; Shift the type backward in the case that there's a
+                       ;; single identifier inside parens.  That can only
+                       ;; occur in K&R style function declarations so it's
+                       ;; more likely that it really is a function call.
+                       ;; Therefore we only do this after
+                       ;; `c-after-suffixed-type-decl-key' has matched.
+                       (progn (c-fdoc-shift-type-backward) t)
+                     got-suffix-after-parens))
+          ;; A declaration according to `c-after-suffixed-type-decl-key'.
+          (throw 'at-decl-or-cast t))
+
+        ;; CASE 12
+        (when (and (or got-prefix (not got-parens))
+                   (memq at-type '(t known)))
+          ;; It's a declaration if a known type precedes it and it can't be a
+          ;; function call.
+          (throw 'at-decl-or-cast t))
+
+        ;; If we get here we can't tell if this is a type decl or a normal
+        ;; expression by looking at it alone.  (That's under the assumption
+        ;; that normal expressions always can look like type decl expressions,
+        ;; which isn't really true but the cases where it doesn't hold are so
+        ;; uncommon (e.g. some placements of "const" in C++) it's not worth
+        ;; the effort to look for them.)
 
 ;;; 2008-04-16: commented out the next form, to allow the function to recognize
 ;;; "foo (int bar)" in CC (an implicit type (in class foo) without a semicolon)
 ;;; as a(n almost complete) declaration, enabling it to be fontified.
-       ;; CASE 13
-       ;; (unless (or at-decl-end (looking-at "=[^=]"))
-       ;; If this is a declaration it should end here or its initializer(*)
-       ;; should start here, so check for allowed separation tokens.  Note
-       ;; that this rule doesn't work e.g. with a K&R arglist after a
-       ;; function header.
-       ;;
-       ;; *) Don't check for C++ style initializers using parens
-       ;; since those already have been matched as suffixes.
-       ;;
-       ;; If `at-decl-or-cast' is then we've found some other sign that
-       ;; it's a declaration or cast, so then it's probably an
-       ;; invalid/unfinished one.
-       ;;  (throw 'at-decl-or-cast at-decl-or-cast))
-
-       ;; Below are tests that only should be applied when we're certain to
-       ;; not have parsed halfway through an expression.
-
-       ;; CASE 14
-       (when (memq at-type '(t known))
-         ;; The expression starts with a known type so treat it as a
-         ;; declaration.
-         (throw 'at-decl-or-cast t))
-
-       ;; CASE 15
-       (when (and (c-major-mode-is 'c++-mode)
-                  ;; In C++ we check if the identifier is a known type, since
-                  ;; (con|de)structors use the class name as identifier.
-                  ;; We've always shifted over the identifier as a type and
-                  ;; then backed up again in this case.
-                  identifier-type
-                  (or (memq identifier-type '(found known))
-                      (and (eq (char-after identifier-start) ?~)
-                           ;; `at-type' probably won't be 'found for
-                           ;; destructors since the "~" is then part of the
-                           ;; type name being checked against the list of
-                           ;; known types, so do a check without that
-                           ;; operator.
-                           (or (save-excursion
-                                 (goto-char (1+ identifier-start))
-                                 (c-forward-syntactic-ws)
-                                 (c-with-syntax-table
-                                     c-identifier-syntax-table
-                                   (looking-at c-known-type-key)))
-                               (save-excursion
-                                 (goto-char (1+ identifier-start))
-                                 ;; We have already parsed the type earlier,
-                                 ;; so it'd be possible to cache the end
-                                 ;; position instead of redoing it here, but
-                                 ;; then we'd need to keep track of another
-                                 ;; position everywhere.
-                                 (c-check-type (point)
-                                               (progn (c-forward-type)
-                                                      (point))))))))
-         (throw 'at-decl-or-cast t))
-
-       (if got-identifier
-           (progn
-             ;; CASE 16
-             (when (and got-prefix-before-parens
-                        at-type
-                        (or at-decl-end (looking-at "=[^=]"))
-                        (not context)
-                        (not got-suffix))
-               ;; Got something like "foo * bar;".  Since we're not inside an
-               ;; arglist it would be a meaningless expression because the
-               ;; result isn't used.  We therefore choose to recognize it as
-               ;; a declaration.  Do not allow a suffix since it could then
-               ;; be a function call.
-               (throw 'at-decl-or-cast t))
-
-             ;; CASE 17
-             (when (and (or got-suffix-after-parens
-                            (looking-at "=[^=]"))
-                        (eq at-type 'found)
-                        (not (eq context 'arglist)))
-               ;; Got something like "a (*b) (c);" or "a (b) = c;".  It could
-               ;; be an odd expression or it could be a declaration.  Treat
-               ;; it as a declaration if "a" has been used as a type
-               ;; somewhere else (if it's a known type we won't get here).
-               (throw 'at-decl-or-cast t)))
-
-         ;; CASE 18
-         (when (and context
-                    (or got-prefix
-                        (and (eq context 'decl)
-                             (not c-recognize-paren-inits)
-                             (or got-parens got-suffix))))
-           ;; Got a type followed by an abstract declarator.  If `got-prefix'
-           ;; is set it's something like "a *" without anything after it.  If
-           ;; `got-parens' or `got-suffix' is set it's "a()", "a[]", "a()[]",
-           ;; or similar, which we accept only if the context rules out
-           ;; expressions.
-           (throw 'at-decl-or-cast t)))
-
-       ;; If we had a complete symbol table here (which rules out
-       ;; `c-found-types') we should return t due to the disambiguation rule
-       ;; (in at least C++) that anything that can be parsed as a declaration
-       ;; is a declaration.  Now we're being more defensive and prefer to
-       ;; highlight things like "foo (bar);" as a declaration only if we're
-       ;; inside an arglist that contains declarations.
-       ;; CASE 19
-       (eq context 'decl))))
+        ;; CASE 13
+        ;;     (unless (or at-decl-end (looking-at "=[^=]"))
+        ;; If this is a declaration it should end here or its initializer(*)
+        ;; should start here, so check for allowed separation tokens.  Note
+        ;; that this rule doesn't work e.g. with a K&R arglist after a
+        ;; function header.
+        ;;
+        ;; *) Don't check for C++ style initializers using parens
+        ;; since those already have been matched as suffixes.
+        ;;
+        ;; If `at-decl-or-cast' is then we've found some other sign that
+        ;; it's a declaration or cast, so then it's probably an
+        ;; invalid/unfinished one.
+        ;;       (throw 'at-decl-or-cast at-decl-or-cast))
+
+        ;; Below are tests that only should be applied when we're certain to
+        ;; not have parsed halfway through an expression.
+
+        ;; CASE 14
+        (when (memq at-type '(t known))
+          ;; The expression starts with a known type so treat it as a
+          ;; declaration.
+          (throw 'at-decl-or-cast t))
+
+        ;; CASE 15
+        (when (and (c-major-mode-is 'c++-mode)
+                   ;; In C++ we check if the identifier is a known type, since
+                   ;; (con|de)structors use the class name as identifier.
+                   ;; We've always shifted over the identifier as a type and
+                   ;; then backed up again in this case.
+                   identifier-type
+                   (or (memq identifier-type '(found known))
+                       (and (eq (char-after identifier-start) ?~)
+                            ;; `at-type' probably won't be 'found for
+                            ;; destructors since the "~" is then part of the
+                            ;; type name being checked against the list of
+                            ;; known types, so do a check without that
+                            ;; operator.
+                            (or (save-excursion
+                                  (goto-char (1+ identifier-start))
+                                  (c-forward-syntactic-ws)
+                                  (c-with-syntax-table
+                                      c-identifier-syntax-table
+                                    (looking-at c-known-type-key)))
+                                (save-excursion
+                                  (goto-char (1+ identifier-start))
+                                  ;; We have already parsed the type earlier,
+                                  ;; so it'd be possible to cache the end
+                                  ;; position instead of redoing it here, but
+                                  ;; then we'd need to keep track of another
+                                  ;; position everywhere.
+                                  (c-check-type (point)
+                                                (progn (c-forward-type)
+                                                       (point))))))))
+          (throw 'at-decl-or-cast t))
+
+        (if got-identifier
+            (progn
+              ;; CASE 16
+              (when (and got-prefix-before-parens
+                         at-type
+                         (or at-decl-end (looking-at "=[^=]"))
+                         (not context)
+                         (not got-suffix))
+                ;; Got something like "foo * bar;".  Since we're not inside an
+                ;; arglist it would be a meaningless expression because the
+                ;; result isn't used.  We therefore choose to recognize it as
+                ;; a declaration.  Do not allow a suffix since it could then
+                ;; be a function call.
+                (throw 'at-decl-or-cast t))
+
+              ;; CASE 17
+              (when (and (or got-suffix-after-parens
+                             (looking-at "=[^=]"))
+                         (eq at-type 'found)
+                         (not (eq context 'arglist)))
+                ;; Got something like "a (*b) (c);" or "a (b) = c;".  It could
+                ;; be an odd expression or it could be a declaration.  Treat
+                ;; it as a declaration if "a" has been used as a type
+                ;; somewhere else (if it's a known type we won't get here).
+                (throw 'at-decl-or-cast t)))
+
+          ;; CASE 18
+          (when (and context
+                     (or got-prefix
+                         (and (eq context 'decl)
+                              (not c-recognize-paren-inits)
+                              (or got-parens got-suffix))))
+            ;; Got a type followed by an abstract declarator.  If `got-prefix'
+            ;; is set it's something like "a *" without anything after it.  If
+            ;; `got-parens' or `got-suffix' is set it's "a()", "a[]", "a()[]",
+            ;; or similar, which we accept only if the context rules out
+            ;; expressions.
+            (throw 'at-decl-or-cast t)))
+
+        ;; If we had a complete symbol table here (which rules out
+        ;; `c-found-types') we should return t due to the disambiguation rule
+        ;; (in at least C++) that anything that can be parsed as a declaration
+        ;; is a declaration.  Now we're being more defensive and prefer to
+        ;; highlight things like "foo (bar);" as a declaration only if we're
+        ;; inside an arglist that contains declarations.
+         ;; CASE 19
+        (eq context 'decl))))
 
     ;; The point is now after the type decl expression.
 
@@ -7609,10 +7620,10 @@ comment at the start of cc-engine.el for more info."
                    (c-put-c-type-property (1- (point)) 'c-decl-end)
                    t)
 
-             ;; It's an unfinished label.  We consider the keyword enough
-             ;; to recognize it as a label, so that it gets fontified.
-             ;; Leave the point at the end of it, but don't put any
-             ;; `c-decl-end' marker.
+               ;; It's an unfinished label.  We consider the keyword enough
+               ;; to recognize it as a label, so that it gets fontified.
+               ;; Leave the point at the end of it, but don't put any
+               ;; `c-decl-end' marker.
                (goto-char kwd-end)
                t))))
 
@@ -7797,69 +7808,69 @@ comment at the start of cc-engine.el for more info."
   ;;
   ;; This function might do hidden buffer changes.
 
-    (let ((start (point))
-         start-char
-         (c-promote-possible-types t)
-         lim
-         ;; Turn off recognition of angle bracket arglists while parsing
-         ;; types here since the protocol reference list might then be
-         ;; considered part of the preceding name or superclass-name.
-         c-recognize-<>-arglists)
-
-      (if (or
-          (when (looking-at
-                 (eval-when-compile
-                   (c-make-keywords-re t
-                     (append (c-lang-const c-protection-kwds objc)
-                             '("@end"))
-                     'objc-mode)))
-            (goto-char (match-end 1))
-            t)
+  (let ((start (point))
+       start-char
+       (c-promote-possible-types t)
+       lim
+       ;; Turn off recognition of angle bracket arglists while parsing
+       ;; types here since the protocol reference list might then be
+       ;; considered part of the preceding name or superclass-name.
+       c-recognize-<>-arglists)
+
+    (if (or
+        (when (looking-at
+               (eval-when-compile
+                 (c-make-keywords-re t
+                   (append (c-lang-const c-protection-kwds objc)
+                           '("@end"))
+                   'objc-mode)))
+          (goto-char (match-end 1))
+          t)
 
-          (and
-           (looking-at
-            (eval-when-compile
-              (c-make-keywords-re t
-                '("@interface" "@implementation" "@protocol")
-                'objc-mode)))
+        (and
+         (looking-at
+          (eval-when-compile
+            (c-make-keywords-re t
+              '("@interface" "@implementation" "@protocol")
+              'objc-mode)))
 
-           ;; Handle the name of the class itself.
-           (progn
-;            (c-forward-token-2) ; 2006/1/13 This doesn't move if the token's
-;            at EOB.
-             (goto-char (match-end 0))
-             (setq lim (point))
-             (c-skip-ws-forward)
-             (c-forward-type))
-
-           (catch 'break
-             ;; Look for ": superclass-name" or "( category-name )".
-             (when (looking-at "[:\(]")
-               (setq start-char (char-after))
+         ;; Handle the name of the class itself.
+         (progn
+            ;; (c-forward-token-2) ; 2006/1/13 This doesn't move if the token's
+            ;; at EOB.
+           (goto-char (match-end 0))
+           (setq lim (point))
+           (c-skip-ws-forward)
+           (c-forward-type))
+
+         (catch 'break
+           ;; Look for ": superclass-name" or "( category-name )".
+           (when (looking-at "[:\(]")
+             (setq start-char (char-after))
+             (forward-char)
+             (c-forward-syntactic-ws)
+             (unless (c-forward-type) (throw 'break nil))
+             (when (eq start-char ?\()
+               (unless (eq (char-after) ?\)) (throw 'break nil))
                (forward-char)
-               (c-forward-syntactic-ws)
-               (unless (c-forward-type) (throw 'break nil))
-               (when (eq start-char ?\()
-                 (unless (eq (char-after) ?\)) (throw 'break nil))
-                 (forward-char)
-                 (c-forward-syntactic-ws)))
-
-             ;; Look for a protocol reference list.
-             (if (eq (char-after) ?<)
-                 (let ((c-recognize-<>-arglists t)
-                       (c-parse-and-markup-<>-arglists t)
-                       c-restricted-<>-arglists)
-                   (c-forward-<>-arglist t))
-               t))))
+               (c-forward-syntactic-ws)))
 
-         (progn
-           (c-backward-syntactic-ws lim)
-           (c-clear-c-type-property start (1- (point)) 'c-decl-end)
-           (c-put-c-type-property (1- (point)) 'c-decl-end)
-           t)
+           ;; Look for a protocol reference list.
+           (if (eq (char-after) ?<)
+               (let ((c-recognize-<>-arglists t)
+                     (c-parse-and-markup-<>-arglists t)
+                     c-restricted-<>-arglists)
+                 (c-forward-<>-arglist t))
+             t))))
 
-       (c-clear-c-type-property start (point) 'c-decl-end)
-       nil)))
+       (progn
+         (c-backward-syntactic-ws lim)
+         (c-clear-c-type-property start (1- (point)) 'c-decl-end)
+         (c-put-c-type-property (1- (point)) 'c-decl-end)
+         t)
+
+      (c-clear-c-type-property start (point) 'c-decl-end)
+      nil)))
 
 (defun c-beginning-of-inheritance-list (&optional lim)
   ;; Go to the first non-whitespace after the colon that starts a
@@ -7946,7 +7957,7 @@ comment at the start of cc-engine.el for more info."
   ;;
   ;; This function might do hidden buffer changes.
 
-  (let ((beg (point)) end id-start)
+  (let ((beg (point)) id-start)
     (and
      (eq (c-beginning-of-statement-1 lim) 'same)
 
@@ -8036,54 +8047,54 @@ comment at the start of cc-engine.el for more info."
                   (throw 'knr nil)))
 
            (if after-rparen
-           ;; We're inside a paren.  Could it be our argument list....?
-             (if
-                 (and
-                  (progn
-                    (goto-char after-rparen)
-                    (unless (c-go-list-backward) (throw 'knr nil)) ;
-               ;; FIXME!!!  What about macros between the parens?  2007/01/20
-                    (setq before-lparen (point)))
+               ;; We're inside a paren.  Could it be our argument list....?
+               (if
+                   (and
+                    (progn
+                      (goto-char after-rparen)
+                      (unless (c-go-list-backward) (throw 'knr nil)) ;
+                      ;; FIXME!!!  What about macros between the parens?  2007/01/20
+                      (setq before-lparen (point)))
 
-                  ;; It can't be the arg list if next token is ; or {
-                  (progn (goto-char after-rparen)
-                         (c-forward-syntactic-ws)
-                         (not (memq (char-after) '(?\; ?\{ ?\=))))
+                    ;; It can't be the arg list if next token is ; or {
+                    (progn (goto-char after-rparen)
+                           (c-forward-syntactic-ws)
+                           (not (memq (char-after) '(?\; ?\{ ?\=))))
 
-                  ;; Is the thing preceding the list an identifier (the
-                  ;; function name), or a macro expansion?
-                  (progn
-                    (goto-char before-lparen)
-                    (eq (c-backward-token-2) 0)
-                    (or (eq (c-on-identifier) (point))
-                        (and (eq (char-after) ?\))
-                             (c-go-up-list-backward)
-                             (eq (c-backward-token-2) 0)
-                             (eq (c-on-identifier) (point)))))
-
-                  ;; Have we got a non-empty list of comma-separated
-                  ;; identifiers?
-                  (progn
-                    (goto-char before-lparen)
-                    (c-forward-token-2) ; to first token inside parens
-                    (and
-                     (c-on-identifier)
-                     (c-forward-token-2)
-                     (catch 'id-list
-                       (while (eq (char-after) ?\,)
-                         (c-forward-token-2)
-                         (unless (c-on-identifier) (throw 'id-list nil))
-                         (c-forward-token-2))
-                       (eq (char-after) ?\))))))
-
-                 ;; ...Yes.  We've identified the function's argument list.
-                 (throw 'knr
-                      (progn (goto-char after-rparen)
-                             (c-forward-syntactic-ws)
-                             (point)))
-
-               ;; ...No.  The current parens aren't the function's arg list.
-               (goto-char before-lparen))
+                    ;; Is the thing preceding the list an identifier (the
+                    ;; function name), or a macro expansion?
+                    (progn
+                      (goto-char before-lparen)
+                      (eq (c-backward-token-2) 0)
+                      (or (eq (c-on-identifier) (point))
+                          (and (eq (char-after) ?\))
+                               (c-go-up-list-backward)
+                               (eq (c-backward-token-2) 0)
+                               (eq (c-on-identifier) (point)))))
+
+                    ;; Have we got a non-empty list of comma-separated
+                    ;; identifiers?
+                    (progn
+                      (goto-char before-lparen)
+                      (c-forward-token-2) ; to first token inside parens
+                      (and
+                       (c-on-identifier)
+                       (c-forward-token-2)
+                       (catch 'id-list
+                         (while (eq (char-after) ?\,)
+                           (c-forward-token-2)
+                           (unless (c-on-identifier) (throw 'id-list nil))
+                           (c-forward-token-2))
+                         (eq (char-after) ?\))))))
+
+                   ;; ...Yes.  We've identified the function's argument list.
+                   (throw 'knr
+                          (progn (goto-char after-rparen)
+                                 (c-forward-syntactic-ws)
+                                 (point)))
+
+                 ;; ...No.  The current parens aren't the function's arg list.
+                 (goto-char before-lparen))
 
              (or (c-go-list-backward)  ; backwards over [ .... ]
                  (throw 'knr nil)))))))))
@@ -8289,7 +8300,7 @@ comment at the start of cc-engine.el for more info."
                   (and
                    (progn
                      (while  ; keep going back to "[;={"s until we either find
-                           ; no more, or get to one which isn't an "operator ="
+                           ; no more, or get to one which isn't an "operator ="
                          (and (c-syntactic-re-search-forward "[;={]" start t t t)
                               (eq (char-before) ?=)
                               c-overloadable-operators-regexp
@@ -8612,86 +8623,86 @@ comment at the start of cc-engine.el for more info."
        (while (and (not bufpos)
                   containing-sexp)
         (when paren-state
-            (if (consp (car paren-state))
-                (setq lim (cdr (car paren-state))
-                      paren-state (cdr paren-state))
-              (setq lim (car paren-state)))
-            (when paren-state
-              (setq next-containing (car paren-state)
-                    paren-state (cdr paren-state))))
-          (goto-char containing-sexp)
-          (if (c-looking-at-inexpr-block next-containing next-containing)
-              ;; We're in an in-expression block of some kind.  Do not
-              ;; check nesting.  We deliberately set the limit to the
-              ;; containing sexp, so that c-looking-at-inexpr-block
-              ;; doesn't check for an identifier before it.
-              (setq containing-sexp nil)
-            ;; see if the open brace is preceded by = or [...] in
-            ;; this statement, but watch out for operator=
-            (setq braceassignp 'dontknow)
-            (c-backward-token-2 1 t lim)
-            ;; Checks to do only on the first sexp before the brace.
-            (when (and c-opt-inexpr-brace-list-key
-                       (eq (char-after) ?\[))
-              ;; In Java, an initialization brace list may follow
-              ;; directly after "new Foo[]", so check for a "new"
-              ;; earlier.
-              (while (eq braceassignp 'dontknow)
-                (setq braceassignp
-                      (cond ((/= (c-backward-token-2 1 t lim) 0) nil)
-                            ((looking-at c-opt-inexpr-brace-list-key) t)
-                            ((looking-at "\\sw\\|\\s_\\|[.[]")
-                             ;; Carry on looking if this is an
-                             ;; identifier (may contain "." in Java)
-                             ;; or another "[]" sexp.
-                             'dontknow)
-                            (t nil)))))
-            ;; Checks to do on all sexps before the brace, up to the
-            ;; beginning of the statement.
+          (if (consp (car paren-state))
+              (setq lim (cdr (car paren-state))
+                    paren-state (cdr paren-state))
+            (setq lim (car paren-state)))
+          (when paren-state
+            (setq next-containing (car paren-state)
+                  paren-state (cdr paren-state))))
+        (goto-char containing-sexp)
+        (if (c-looking-at-inexpr-block next-containing next-containing)
+            ;; We're in an in-expression block of some kind.  Do not
+            ;; check nesting.  We deliberately set the limit to the
+            ;; containing sexp, so that c-looking-at-inexpr-block
+            ;; doesn't check for an identifier before it.
+            (setq containing-sexp nil)
+          ;; see if the open brace is preceded by = or [...] in
+          ;; this statement, but watch out for operator=
+          (setq braceassignp 'dontknow)
+          (c-backward-token-2 1 t lim)
+          ;; Checks to do only on the first sexp before the brace.
+          (when (and c-opt-inexpr-brace-list-key
+                     (eq (char-after) ?\[))
+            ;; In Java, an initialization brace list may follow
+            ;; directly after "new Foo[]", so check for a "new"
+            ;; earlier.
             (while (eq braceassignp 'dontknow)
-              (cond ((eq (char-after) ?\;)
-                     (setq braceassignp nil))
-                    ((and class-key
-                          (looking-at class-key))
-                     (setq braceassignp nil))
-                    ((eq (char-after) ?=)
-                     ;; We've seen a =, but must check earlier tokens so
-                     ;; that it isn't something that should be ignored.
-                     (setq braceassignp 'maybe)
-                     (while (and (eq braceassignp 'maybe)
-                                 (zerop (c-backward-token-2 1 t lim)))
-                       (setq braceassignp
-                             (cond
-                              ;; Check for operator =
-                              ((and c-opt-op-identifier-prefix
-                                    (looking-at c-opt-op-identifier-prefix))
-                               nil)
-                              ;; Check for `<opchar>= in Pike.
-                              ((and (c-major-mode-is 'pike-mode)
-                                    (or (eq (char-after) ?`)
-                                        ;; Special case for Pikes
-                                        ;; `[]=, since '[' is not in
-                                        ;; the punctuation class.
-                                        (and (eq (char-after) ?\[)
-                                             (eq (char-before) ?`))))
-                               nil)
-                              ((looking-at "\\s.") 'maybe)
-                              ;; make sure we're not in a C++ template
-                              ;; argument assignment
-                              ((and
-                                (c-major-mode-is 'c++-mode)
-                                (save-excursion
-                                  (let ((here (point))
-                                        (pos< (progn
-                                                (skip-chars-backward "^<>")
-                                                (point))))
-                                    (and (eq (char-before) ?<)
-                                         (not (c-crosses-statement-barrier-p
-                                               pos< here))
-                                         (not (c-in-literal))
-                                         ))))
-                               nil)
-                              (t t))))))
+              (setq braceassignp
+                    (cond ((/= (c-backward-token-2 1 t lim) 0) nil)
+                          ((looking-at c-opt-inexpr-brace-list-key) t)
+                          ((looking-at "\\sw\\|\\s_\\|[.[]")
+                           ;; Carry on looking if this is an
+                           ;; identifier (may contain "." in Java)
+                           ;; or another "[]" sexp.
+                           'dontknow)
+                          (t nil)))))
+          ;; Checks to do on all sexps before the brace, up to the
+          ;; beginning of the statement.
+          (while (eq braceassignp 'dontknow)
+            (cond ((eq (char-after) ?\;)
+                   (setq braceassignp nil))
+                  ((and class-key
+                        (looking-at class-key))
+                   (setq braceassignp nil))
+                  ((eq (char-after) ?=)
+                   ;; We've seen a =, but must check earlier tokens so
+                   ;; that it isn't something that should be ignored.
+                   (setq braceassignp 'maybe)
+                   (while (and (eq braceassignp 'maybe)
+                               (zerop (c-backward-token-2 1 t lim)))
+                     (setq braceassignp
+                           (cond
+                            ;; Check for operator =
+                            ((and c-opt-op-identifier-prefix
+                                  (looking-at c-opt-op-identifier-prefix))
+                             nil)
+                            ;; Check for `<opchar>= in Pike.
+                            ((and (c-major-mode-is 'pike-mode)
+                                  (or (eq (char-after) ?`)
+                                      ;; Special case for Pikes
+                                      ;; `[]=, since '[' is not in
+                                      ;; the punctuation class.
+                                      (and (eq (char-after) ?\[)
+                                           (eq (char-before) ?`))))
+                             nil)
+                            ((looking-at "\\s.") 'maybe)
+                            ;; make sure we're not in a C++ template
+                            ;; argument assignment
+                            ((and
+                              (c-major-mode-is 'c++-mode)
+                              (save-excursion
+                                (let ((here (point))
+                                      (pos< (progn
+                                              (skip-chars-backward "^<>")
+                                              (point))))
+                                  (and (eq (char-before) ?<)
+                                       (not (c-crosses-statement-barrier-p
+                                             pos< here))
+                                       (not (c-in-literal))
+                                       ))))
+                             nil)
+                            (t t))))))
             (if (and (eq braceassignp 'dontknow)
                      (/= (c-backward-token-2 1 t lim) 0))
                 (setq braceassignp nil)))
@@ -9214,7 +9225,7 @@ comment at the start of cc-engine.el for more info."
                     (max (c-point 'boi paren-pos) (point))))
                   (t (c-add-syntax 'defun-block-intro nil))))
 
-                (c-add-syntax 'statement-block-intro nil)))
+             (c-add-syntax 'statement-block-intro nil)))
 
          (if (= paren-pos boi)
              ;; Always done if the open brace was at boi.  The
@@ -10327,7 +10338,6 @@ comment at the start of cc-engine.el for more info."
          (c-add-syntax 'topmost-intro-cont (c-point 'boi)))
         ))
 
-
        ;; (CASE 6 has been removed.)
 
        ;; CASE 7: line is an expression, not a statement.  Most
index c056091ca46e1e1de0589c05448464dc498d8dba..1c389bc36656fc3c55a874b4d662bf23a6e536db 100644 (file)
              (parse-sexp-lookup-properties
               (cc-eval-when-compile
                 (boundp 'parse-sexp-lookup-properties))))
-
-         ;; (while (re-search-forward ,regexp limit t)
-         ;;   (unless (progn
-         ;;          (goto-char (match-beginning 0))
-         ;;          (c-skip-comments-and-strings limit))
-         ;;     (goto-char (match-end 0))
-         ;;     ,@(mapcar
-         ;;     (lambda (highlight)
-         ;;       (if (integerp (car highlight))
-         ;;           (progn
-         ;;             (unless (eq (nth 2 highlight) t)
-         ;;               (error
-         ;;                "The override flag must currently be t in %s"
-         ;;                highlight))
-         ;;             (when (nth 3 highlight)
-         ;;               (error
-         ;;                "The laxmatch flag may currently not be set in %s"
-         ;;                highlight))
-         ;;             `(save-match-data
-         ;;                (c-put-font-lock-face
-         ;;                 (match-beginning ,(car highlight))
-         ;;                 (match-end ,(car highlight))
-         ;;                 ,(elt highlight 1))))
-         ;;         (when (nth 3 highlight)
-         ;;           (error "Match highlights currently not supported in %s"
-         ;;                  highlight))
-         ;;         `(progn
-         ;;            ,(nth 1 highlight)
-         ;;            (save-match-data ,(car highlight))
-         ;;            ,(nth 2 highlight))))
-         ;;     highlights)))
          ,(c-make-font-lock-search-form regexp highlights))
-
        nil)))
 
   (defun c-make-font-lock-BO-decl-search-function (regexp &rest highlights)
@@ -716,7 +684,11 @@ stuff.  Used on level 1 and higher."
   (let ((start (1- (point))))
     (save-excursion
       (and (eq (elt (parse-partial-sexp start (c-point 'eol)) 8) start)
-          (if (integerp c-multiline-string-start-char)
+          (if (if (eval-when-compile (integerp ?c))
+                  ;; Emacs
+                  (integerp c-multiline-string-start-char)
+                ;; XEmacs
+                (characterp c-multiline-string-start-char))
               ;; There's no multiline string start char before the
               ;; string, so newlines aren't allowed.
               (not (eq (char-before start) c-multiline-string-start-char))
@@ -1151,7 +1123,6 @@ casts and declarations are fontified.  Used on level 2 and higher."
       (when list
        ;; Jump past any initializer or function prototype to see if
        ;; there's a ',' to continue at.
-
        (cond ((eq id-face 'font-lock-function-name-face)
               ;; Skip a parenthesized initializer (C++) or a function
               ;; prototype.
@@ -1219,8 +1190,8 @@ casts and declarations are fontified.  Used on level 2 and higher."
          ;; o - nil, if not in an arglist at all.  This includes the
          ;;   parenthesized condition which follows "if", "while", etc.
          context
-         ;; The position of the next token after the closing paren of
-         ;; the last detected cast.
+         ;; A list of starting positions of possible type declarations, or of
+         ;; the typedef preceding one, if any.
          last-cast-end
          ;; The result from `c-forward-decl-or-cast-1'.
          decl-or-cast
@@ -1564,9 +1535,7 @@ casts and declarations are fontified.  Used on level 2 and higher."
   ;; Note that this function won't attempt to fontify beyond the end of the
   ;; current enum block, if any.
   (let* ((paren-state (c-parse-state))
-        (encl-pos (c-most-enclosing-brace paren-state))
-        (start (point))
-       )
+        (encl-pos (c-most-enclosing-brace paren-state)))
     (when (and
           encl-pos
           (eq (char-after encl-pos) ?\{)
index 5424e8d4a61e7bcd1491538c654a01d2b66c70e9..f46ae0ff42683425977e65708590872ac8a09bc2 100644 (file)
@@ -519,7 +519,8 @@ is called with one argument, the guessed style."
       (goto-char (point-min))
       (when (search-forward (concat "("
                                    (symbol-name (car needs-markers))
-                                   " ") nil t)
+                                   " ")
+                            nil t)
        (move-end-of-line 1)
        (comment-dwim nil)
        (insert " Guessed value"))
index bc3fb66d3e1125e2deec447fa5b4d94c591a9e00..16f1dbfc6d69f787c6ddc93edcb29d825f54614c 100644 (file)
 
 
 ;; This file is not always loaded.  See note above.
-;; Except it is always loaded - see bug#17463.
-;;;(cc-external-require 'cl)
-(require 'cl-lib)
+(cc-external-require 'cl)
 
 \f
 ;;; Setup for the `c-lang-defvar' system.
@@ -253,14 +251,14 @@ the evaluated constant value at compile time."
     (unless xlate
       (setq xlate 'identity))
     (c-with-syntax-table (c-lang-const c-mode-syntax-table)
-      (cl-delete-duplicates
-       (cl-mapcan (lambda (opgroup)
+      (delete-duplicates
+       (mapcan (lambda (opgroup)
                 (when (if (symbolp (car opgroup))
                           (when (funcall opgroup-filter (car opgroup))
                             (setq opgroup (cdr opgroup))
                             t)
                         t)
-                  (cl-mapcan (lambda (op)
+                  (mapcan (lambda (op)
                             (when (funcall op-filter op)
                               (let ((res (funcall xlate op)))
                                 (if (listp res) res (list res)))))
@@ -301,7 +299,8 @@ the evaluated constant value at compile time."
        ["Set Style..."                   c-set-style t]
        ["Show Current Style Name"        (message
                                          "Style Name: %s"
-                                         c-indentation-style) t]
+                                         c-indentation-style)
+                                         t]
        ["Guess Style from this Buffer"   c-guess-buffer-no-install t]
        ["Install the Last Guessed Style..." c-guess-install
        (and c-guess-guessed-offsets-alist
@@ -1155,7 +1154,7 @@ operators."
 (c-lang-defconst c-all-op-syntax-tokens
   ;; List of all tokens in the punctuation and parenthesis syntax
   ;; classes.
-  t (cl-delete-duplicates (append (c-lang-const c-other-op-syntax-tokens)
+  t (delete-duplicates (append (c-lang-const c-other-op-syntax-tokens)
                               (c-lang-const c-operator-list))
                       :test 'string-equal))
 
@@ -1587,13 +1586,14 @@ properly."
 (c-lang-defvar c-syntactic-eol (c-lang-const c-syntactic-eol))
 
 \f
-;;; Defun functions
-
-;; The Emacs variables beginning-of-defun-function and
-;; end-of-defun-function will be set so that commands like
-;; `mark-defun' and `narrow-to-defun' work right.  The key sequences
-;; C-M-a and C-M-e are, however, bound directly to the CC Mode
-;; functions, allowing optimization for large n.
+;;; Defun handling.
+
+;; The Emacs variables beginning-of-defun-function and end-of-defun-function
+;; will be set so that commands like `mark-defun' and `narrow-to-defun' work
+;; right.  In older Emacsen, the key sequences C-M-a and C-M-e are, however,
+;; bound directly to the CC Mode functions, allowing optimisation for large n.
+;; From Emacs 23, this isn't necessary any more, since n is passed to the two
+;; functions.
 (c-lang-defconst beginning-of-defun-function
   "Function to which beginning-of-defun-function will be set."
   t 'c-beginning-of-defun
@@ -1754,7 +1754,7 @@ not the type face."
 (c-lang-defconst c-type-start-kwds
   ;; All keywords that can start a type (i.e. are either a type prefix
   ;; or a complete type).
-  t (cl-delete-duplicates (append (c-lang-const c-primitive-type-kwds)
+  t (delete-duplicates (append (c-lang-const c-primitive-type-kwds)
                               (c-lang-const c-type-prefix-kwds)
                               (c-lang-const c-type-modifier-kwds))
                       :test 'string-equal))
@@ -1998,7 +1998,7 @@ one of `c-type-list-kwds', `c-ref-list-kwds',
   ;; something is a type or just some sort of macro in front of the
   ;; declaration.  They might be ambiguous with types or type
   ;; prefixes.
-  t (cl-delete-duplicates (append (c-lang-const c-class-decl-kwds)
+  t (delete-duplicates (append (c-lang-const c-class-decl-kwds)
                               (c-lang-const c-brace-list-decl-kwds)
                               (c-lang-const c-other-block-decl-kwds)
                               (c-lang-const c-typedef-decl-kwds)
@@ -2192,7 +2192,7 @@ type identifiers separated by arbitrary tokens."
   pike '("array" "function" "int" "mapping" "multiset" "object" "program"))
 
 (c-lang-defconst c-paren-any-kwds
-  t (cl-delete-duplicates (append (c-lang-const c-paren-nontype-kwds)
+  t (delete-duplicates (append (c-lang-const c-paren-nontype-kwds)
                               (c-lang-const c-paren-type-kwds))
                       :test 'string-equal))
 
@@ -2218,7 +2218,7 @@ assumed to be set if this isn't nil."
 
 (c-lang-defconst c-<>-sexp-kwds
   ;; All keywords that can be followed by an angle bracket sexp.
-  t (cl-delete-duplicates (append (c-lang-const c-<>-type-kwds)
+  t (delete-duplicates (append (c-lang-const c-<>-type-kwds)
                               (c-lang-const c-<>-arglist-kwds))
                       :test 'string-equal))
 
@@ -2278,7 +2278,7 @@ Keywords here should also be in `c-block-stmt-1-kwds'."
 
 (c-lang-defconst c-block-stmt-kwds
   ;; Union of `c-block-stmt-1-kwds' and `c-block-stmt-2-kwds'.
-  t (cl-delete-duplicates (append (c-lang-const c-block-stmt-1-kwds)
+  t (delete-duplicates (append (c-lang-const c-block-stmt-1-kwds)
                               (c-lang-const c-block-stmt-2-kwds))
                       :test 'string-equal))
 
@@ -2382,7 +2382,7 @@ This construct is \"<keyword> <expression> :\"."
 (c-lang-defconst c-expr-kwds
   ;; Keywords that can occur anywhere in expressions.  Built from
   ;; `c-primary-expr-kwds' and all keyword operators in `c-operators'.
-  t (cl-delete-duplicates
+  t (delete-duplicates
      (append (c-lang-const c-primary-expr-kwds)
             (c-filter-ops (c-lang-const c-operator-list)
                           t
@@ -2486,7 +2486,7 @@ Note that Java specific rules are currently applied to tell this from
 
 (c-lang-defconst c-keywords
   ;; All keywords as a list.
-  t (cl-delete-duplicates
+  t (delete-duplicates
      (c-lang-defconst-eval-immediately
       `(append ,@(mapcar (lambda (kwds-lang-const)
                           `(c-lang-const ,kwds-lang-const))
@@ -2826,7 +2826,7 @@ possible for good performance."
 (c-lang-defvar c-block-prefix-charset (c-lang-const c-block-prefix-charset))
 
 (c-lang-defconst c-type-decl-prefix-key
-  "Regexp matching the declarator operators that might precede the
+  "Regexp matching any declarator operator that might precede the
 identifier in a declaration, e.g. the \"*\" in \"char *argv\".  This
 regexp should match \"(\" if parentheses are valid in declarators.
 The end of the first submatch is taken as the end of the operator.
@@ -3025,7 +3025,8 @@ identifier or one of the keywords on `c-<>-type-kwds' or
 expression is considered to be a type."
   t (or (consp (c-lang-const c-<>-type-kwds))
        (consp (c-lang-const c-<>-arglist-kwds)))
-  java t)
+  java t)          ; 2008-10-19.  This is crude.  The syntax for java
+                   ; generics is not yet coded in CC Mode.
 (c-lang-defvar c-recognize-<>-arglists (c-lang-const c-recognize-<>-arglists))
 
 (c-lang-defconst c-enums-contain-decls
@@ -3249,7 +3250,7 @@ accomplish that conveniently."
                             ;; `c-lang-const' will expand to the evaluated
                             ;; constant immediately in `macroexpand-all'
                             ;; below.
-                             (cl-mapcan
+                             (mapcan
                               (lambda (init)
                                 `(current-var ',(car init)
                                   ,(car init) ,(macroexpand-all
index 67425a0c82c9d1a44debb079041161a627f600ef..735c2cbf1ede30e2953bda7195acc13815bacbc0 100644 (file)
@@ -361,7 +361,7 @@ Example:
            p (1+ p))
       (cond
        ;; Is CHAR part of a objc token?
-       ((and (not inargvar)     ; Ignore if CHAR is part of an argument variable.
+       ((and (not inargvar)   ; Ignore if CHAR is part of an argument variable.
             (eq 0 betweenparen) ; Ignore if CHAR is in parentheses.
             (or (and (<= ?a char) (<= char ?z))
                 (and (<= ?A char) (<= char ?Z))
index 1ce076734ff656b03416ffe308c0cac97c1f2a35..cb138d5f8b6ab2d351c5bbf38a1d4a41b1764e3b 100644 (file)
@@ -185,8 +185,7 @@ control).  See \"cc-mode.el\" for more info."
            (run-hooks 'c-initialization-hook)
            ;; Fix obsolete variables.
            (if (boundp 'c-comment-continuation-stars)
-               (setq c-block-comment-prefix
-                     (symbol-value 'c-comment-continuation-stars)))
+               (setq c-block-comment-prefix c-comment-continuation-stars))
            (add-hook 'change-major-mode-hook 'c-leave-cc-mode-mode)
            (setq c-initialization-ok t)
            ;; Connect up with Emacs's electric-indent-mode, for >= Emacs 24.4
@@ -1322,6 +1321,7 @@ This function is called from `c-common-init', once per mode initialization."
 ;;;###autoload (add-to-list 'auto-mode-alist '("\\.i\\'" . c-mode))
 ;;;###autoload (add-to-list 'auto-mode-alist '("\\.ii\\'" . c++-mode))
 
+(unless (fboundp 'prog-mode) (defalias 'prog-mode 'fundamental-mode))
 
 ;;;###autoload
 (define-derived-mode c-mode prog-mode "C"
index a8d627f94d4148052bffd964c8ffd5f37094f391..ac8dbfc4c450f38c8c4595d4d08b27ac0c62967a 100644 (file)
@@ -275,13 +275,18 @@ nil."
   "*Controls the operation of the TAB key.
 If t, hitting TAB always just indents the current line.  If nil, hitting
 TAB indents the current line if point is at the left margin or in the
-line's indentation, otherwise it calls `c-insert-tab-function' to
-insert a `real' tab character.  If some other value (neither nil nor t),
-then inserts a tab only within literals (comments and strings), but
-always reindents the line.
-
-Note: the variable `c-comment-only-line-offset' also controls the
-indentation of lines containing only comments."
+line's indentation, otherwise it inserts a `real' tab character \(see
+note\).         If some other value (not nil or t), then tab is inserted only
+within literals \(comments and strings), but the line is always
+reindented.
+
+Note: The value of `indent-tabs-mode' will determine whether a real
+tab character will be inserted, or the equivalent number of spaces.
+When inserting a tab, actually the function stored in the variable
+`c-insert-tab-function' is called.
+
+Note: indentation of lines containing only comments is also controlled
+by the `c-comment-only-line-offset' variable."
   :type '(radio
          (const :tag "TAB key always indents, never inserts TAB" t)
          (const :tag "TAB key indents in left margin, otherwise inserts TAB" nil)
@@ -920,7 +925,7 @@ Only currently supported behavior is `alignleft'."
 (defcustom c-special-indent-hook nil
   "*Hook for user defined special indentation adjustments.
 This hook gets called after each line is indented by the mode.  It is only
-called if `c-syntactic-indentation' is non-nil."
+called when `c-syntactic-indentation' is non-nil."
   :type 'hook
   :group 'c)
 
@@ -1689,7 +1694,8 @@ as designated in the variable `c-file-style'.")
 ;; It isn't possible to specify a doc-string without specifying an
 ;; initial value with `defvar', so the following two variables have been
 ;; given doc-strings by setting the property `variable-documentation'
-;; directly.  It's really good not to have an initial value for
+;; directly.  C-h v will read this documentation only for versions of GNU
+;; Emacs from 22.1.  It's really good not to have an initial value for
 ;; variables like these that always should be dynamically bound, so it's
 ;; worth the inconvenience.