emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] trunk r117853: CC-mode: Set open-paren-in-column-0-is-defu


From: Stefan Monnier
Subject: [Emacs-diffs] trunk r117853: CC-mode: Set open-paren-in-column-0-is-defun-start to nil;
Date: Wed, 10 Sep 2014 16:32:45 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 117853
revision-id: address@hidden
parent: address@hidden
committer: Stefan Monnier <address@hidden>
branch nick: trunk
timestamp: Wed 2014-09-10 12:32:36 -0400
message:
  CC-mode: Set open-paren-in-column-0-is-defun-start to nil;
  plus misc cleanup.
  * lisp/progmodes/cc-mode.el (c-basic-common-init):
  Set open-paren-in-column-0-is-defun-start.
  (adaptive-fill-first-line-regexp, font-lock-syntactic-keywords):
  Remove declarations, unused.
  (run-mode-hooks): Remove declaration.
  (font-lock-defaults): Use plain `defvar' to declare.
  (c-run-mode-hooks): Test existence of run-mode-hooks with fboundp.
  * lisp/progmodes/cc-langs.el (c-filter-ops): Avoid `setq'.
  (c-make-mode-syntax-table): Don't micro-optimize.
  (c-keywords, c-keyword-member-alist): Simplify.
  (c-kwds-lang-consts): Don't eval at compile-time.
  (c-primary-expr-regexp): Comment out unused vars.
  * lisp/progmodes/cc-fonts.el (c-font-lock-context): Declare at top-level.
  (c-font-byte-compile): New var.
  (c--compile): New function.  Use it instead of `byte-compile'.
  (c-cpp-matchers): Quote the value returned by
  `c-make-syntactic-matcher' in case it's not self-evaluating.
  (c-basic-matchers-before): Avoid a plain MATCHER as keyword, wrap it in
  parentheses instead (in case MATCHER happens to be a list).
  (c-font-lock-enum-tail): Remove unused var `start'.
  (c-font-lock-objc-methods): Silence byte-compiler warnings.
  * lisp/progmodes/cc-engine.el (c-syntactic-re-search-forward): Sink an `if'
  test into an argument.
  * lisp/progmodes/cc-defs.el (c-point, c-major-mode-is, c-put-char-property)
  (c-get-char-property): Don't use `eval' just to unquote a constant.
  (c-use-extents): Remove.  Use (featurep 'xemacs), compiled
  more efficiently.
  (c-put-char-property-fun): Don't call `byte-compile' by hand.
  (c-clear-char-property, c-clear-char-properties): Check that `property'
  is a quoted constant.
  (c-emacs-features): Remove `infodock', `syntax-properties', and
  `pps-extended-state' (never used), `8-bit' and `1-bit' (use (featurep
  'xemacs) instead).  Use `with-temp-buffer' and let-bind vars after
  changing buffer, so we don't have to setq them again afterwards.
  (c-lang-const): Remove redundant symbolp assertions.
  (c-find-assignment-for-mode): Use `or'.
  * lisp/Makefile.in (compile-one-process): Remove cc-mode dependency.
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/Makefile.in               
makefile.in-20091113204419-o5vbwnq5f7feedwu-1831
  lisp/progmodes/cc-defs.el      ccdefs.el-20091113204419-o5vbwnq5f7feedwu-1226
  lisp/progmodes/cc-engine.el    
ccengine.el-20091113204419-o5vbwnq5f7feedwu-1227
  lisp/progmodes/cc-fonts.el     ccfonts.el-20091113204419-o5vbwnq5f7feedwu-2930
  lisp/progmodes/cc-langs.el     cclangs.el-20091113204419-o5vbwnq5f7feedwu-1228
  lisp/progmodes/cc-mode.el      ccmode.el-20091113204419-o5vbwnq5f7feedwu-1230
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2014-09-09 20:39:31 +0000
+++ b/lisp/ChangeLog    2014-09-10 16:32:36 +0000
@@ -1,3 +1,45 @@
+2014-09-10  Stefan Monnier  <address@hidden>
+
+       CC-mode: Set open-paren-in-column-0-is-defun-start to nil;
+       plus misc cleanup.
+       * progmodes/cc-mode.el (c-basic-common-init):
+       Set open-paren-in-column-0-is-defun-start.
+       (adaptive-fill-first-line-regexp, font-lock-syntactic-keywords):
+       Remove declarations, unused.
+       (run-mode-hooks): Remove declaration.
+       (font-lock-defaults): Use plain `defvar' to declare.
+       (c-run-mode-hooks): Test existence of run-mode-hooks with fboundp.
+       * progmodes/cc-langs.el (c-filter-ops): Avoid `setq'.
+       (c-make-mode-syntax-table): Don't micro-optimize.
+       (c-keywords, c-keyword-member-alist): Simplify.
+       (c-kwds-lang-consts): Don't eval at compile-time.
+       (c-primary-expr-regexp): Comment out unused vars.
+       * progmodes/cc-fonts.el (c-font-lock-context): Declare at top-level.
+       (c-font-byte-compile): New var.
+       (c--compile): New function.  Use it instead of `byte-compile'.
+       (c-cpp-matchers): Quote the value returned by
+       `c-make-syntactic-matcher' in case it's not self-evaluating.
+       (c-basic-matchers-before): Avoid a plain MATCHER as keyword, wrap it in
+       parentheses instead (in case MATCHER happens to be a list).
+       (c-font-lock-enum-tail): Remove unused var `start'.
+       (c-font-lock-objc-methods): Silence byte-compiler warnings.
+       * progmodes/cc-engine.el (c-syntactic-re-search-forward): Sink an `if'
+       test into an argument.
+       * progmodes/cc-defs.el (c-point, c-major-mode-is, c-put-char-property)
+       (c-get-char-property): Don't use `eval' just to unquote a constant.
+       (c-use-extents): Remove.  Use (featurep 'xemacs), compiled
+       more efficiently.
+       (c-put-char-property-fun): Don't call `byte-compile' by hand.
+       (c-clear-char-property, c-clear-char-properties): Check that `property'
+       is a quoted constant.
+       (c-emacs-features): Remove `infodock', `syntax-properties', and
+       `pps-extended-state' (never used), `8-bit' and `1-bit' (use (featurep
+       'xemacs) instead).  Use `with-temp-buffer' and let-bind vars after
+       changing buffer, so we don't have to setq them again afterwards.
+       (c-lang-const): Remove redundant symbolp assertions.
+       (c-find-assignment-for-mode): Use `or'.
+       * Makefile.in (compile-one-process): Remove cc-mode dependency.
+
 2014-09-09  Sam Steingold  <address@hidden>
 
        * progmodes/sql.el (sql-default-directory): Fix type annotation.

=== modified file 'lisp/Makefile.in'
--- a/lisp/Makefile.in  2014-09-09 15:08:08 +0000
+++ b/lisp/Makefile.in  2014-09-10 16:32:36 +0000
@@ -387,7 +387,7 @@
 # There is no reason to use this rule unless you only have a single
 # core and CPU time is an issue.
 .PHONY: compile-one-process
-compile-one-process: $(LOADDEFS) compile-first $(lisp)/progmodes/cc-mode.elc
+compile-one-process: $(LOADDEFS) compile-first
        $(emacs) $(BYTE_COMPILE_FLAGS) \
            --eval "(batch-byte-recompile-directory 0)" $(lisp)
 

=== modified file 'lisp/progmodes/cc-defs.el'
--- a/lisp/progmodes/cc-defs.el 2014-08-28 20:37:13 +0000
+++ b/lisp/progmodes/cc-defs.el 2014-09-10 16:32:36 +0000
@@ -195,7 +195,7 @@
 to it is returned.  This function does not modify the point or the mark."
 
   (if (eq (car-safe position) 'quote)
-      (let ((position (eval position)))
+      (let ((position (nth 1 position)))
        (cond
 
         ((eq position 'bol)
@@ -885,7 +885,7 @@
       `(c-lang-major-mode-is ,mode)
 
     (if (eq (car-safe mode) 'quote)
-       (let ((mode (eval mode)))
+       (let ((mode (nth 1 mode)))
          (if (listp mode)
              `(memq c-buffer-is-cc-mode ',mode)
            `(eq c-buffer-is-cc-mode ',mode)))
@@ -900,26 +900,10 @@
 ;; properties set on a single character and that never spread to any
 ;; other characters.
 
-(eval-and-compile
-  ;; Constant used at compile time to decide whether or not to use
-  ;; XEmacs extents.  Check all the extent functions we'll use since
-  ;; some packages might add compatibility aliases for some of them in
-  ;; Emacs.
-  (defconst c-use-extents (and (cc-bytecomp-fboundp 'extent-at)
-                              (cc-bytecomp-fboundp 'set-extent-property)
-                              (cc-bytecomp-fboundp 'set-extent-properties)
-                              (cc-bytecomp-fboundp 'make-extent)
-                              (cc-bytecomp-fboundp 'extent-property)
-                              (cc-bytecomp-fboundp 'delete-extent)
-                              (cc-bytecomp-fboundp 'map-extents))))
-
 ;; `c-put-char-property' is complex enough in XEmacs and Emacs < 21 to
 ;; make it a function.
 (defalias 'c-put-char-property-fun
-  (cc-eval-when-compile
-    (cond (c-use-extents
-          ;; XEmacs.
-          (byte-compile
+  (cond ((featurep 'xemacs)
            (lambda (pos property value)
              (let ((ext (extent-at pos nil property)))
                (if ext
@@ -928,20 +912,19 @@
                                         (cons property
                                               (cons value
                                                     '(start-open t
-                                                      end-open t)))))))))
+                                                    end-open t))))))))
 
          ((not (cc-bytecomp-boundp 'text-property-default-nonsticky))
           ;; In Emacs < 21 we have to mess with the `rear-nonsticky' property.
-          (byte-compile
            (lambda (pos property value)
              (put-text-property pos (1+ pos) property value)
              (let ((prop (get-text-property pos 'rear-nonsticky)))
                (or (memq property prop)
                    (put-text-property pos (1+ pos)
                                       'rear-nonsticky
-                                      (cons property prop)))))))
+                                    (cons property prop))))))
          ;; This won't be used for anything.
-         (t 'ignore))))
+        (t #'ignore)))
 (cc-bytecomp-defun c-put-char-property-fun) ; Make it known below.
 
 (defmacro c-put-char-property (pos property value)
@@ -956,42 +939,38 @@
   ;; 21) then it's assumed that the property is present on it.
   ;;
   ;; This macro does a hidden buffer change.
-  (setq property (eval property))
-  (if (or c-use-extents
+  (if (or (featurep 'xemacs)
          (not (cc-bytecomp-boundp 'text-property-default-nonsticky)))
       ;; XEmacs and Emacs < 21.
-      `(c-put-char-property-fun ,pos ',property ,value)
+      `(c-put-char-property-fun ,pos ,property ,value)
     ;; In Emacs 21 we got the `rear-nonsticky' property covered
     ;; by `text-property-default-nonsticky'.
     `(let ((-pos- ,pos))
-       (put-text-property -pos- (1+ -pos-) ',property ,value))))
+       (put-text-property -pos- (1+ -pos-) ,property ,value))))
 
 (defmacro c-get-char-property (pos property)
   ;; Get the value of the given property on the character at POS if
   ;; it's been put there by `c-put-char-property'.  PROPERTY is
   ;; assumed to be constant.
-  (setq property (eval property))
-  (if c-use-extents
+  (if (featurep 'xemacs)
       ;; XEmacs.
-      `(let ((ext (extent-at ,pos nil ',property)))
-        (if ext (extent-property ext ',property)))
+      `(let ((ext (extent-at ,pos nil ,property)))
+        (if ext (extent-property ext ,property)))
     ;; Emacs.
-    `(get-text-property ,pos ',property)))
+    `(get-text-property ,pos ,property)))
 
 ;; `c-clear-char-property' is complex enough in Emacs < 21 to make it
 ;; a function, since we have to mess with the `rear-nonsticky' property.
 (defalias 'c-clear-char-property-fun
-  (cc-eval-when-compile
-    (unless (or c-use-extents
+  (unless (or (featurep 'xemacs)
                (cc-bytecomp-boundp 'text-property-default-nonsticky))
-      (byte-compile
        (lambda (pos property)
         (when (get-text-property pos property)
           (remove-text-properties pos (1+ pos) (list property nil))
           (put-text-property pos (1+ pos)
                              'rear-nonsticky
                              (delq property (get-text-property
-                                             pos 'rear-nonsticky)))))))))
+                                           pos 'rear-nonsticky)))))))
 (cc-bytecomp-defun c-clear-char-property-fun) ; Make it known below.
 
 (defmacro c-clear-char-property (pos property)
@@ -1000,8 +979,10 @@
   ;; constant.
   ;;
   ;; This macro does a hidden buffer change.
-  (setq property (eval property))
-  (cond (c-use-extents
+  (if (eq 'quote (car-safe property))
+      (setq property (nth 1 property))
+    (error "`property' should be a quoted constant"))
+  (cond ((featurep 'xemacs)
         ;; XEmacs.
         `(let ((ext (extent-at ,pos nil ',property)))
            (if ext (delete-extent ext))))
@@ -1026,8 +1007,10 @@
   ;; `syntax-table'.
   ;;
   ;; This macro does hidden buffer changes.
-  (setq property (eval property))
-  (if c-use-extents
+  (if (eq 'quote (car-safe property))
+      (setq property (nth 1 property))
+    (error "`property' should be a quoted constant"))
+  (if (featurep 'xemacs)
       ;; XEmacs.
       `(map-extents (lambda (ext ignored)
                      (delete-extent ext))
@@ -1097,7 +1080,7 @@
 which have the value VALUE, as tested by `equal'.  These
 properties are assumed to be over individual characters, having
 been put there by c-put-char-property.  POINT remains unchanged."
-  (if c-use-extents
+  (if (featurep 'xemacs)
     ;; XEmacs
       `(let ((-property- ,property))
         (map-extents (lambda (ext val)
@@ -1561,32 +1544,6 @@
 (defconst c-emacs-features
   (let (list)
 
-    (if (boundp 'infodock-version)
-       ;; I've no idea what this actually is, but it's legacy. /mast
-       (setq list (cons 'infodock list)))
-
-    ;; XEmacs uses 8-bit modify-syntax-entry flags.
-    ;; Emacs uses a 1-bit flag.  We will have to set up our
-    ;; syntax tables differently to handle this.
-    (let ((table (copy-syntax-table))
-         entry)
-      (modify-syntax-entry ?a ". 12345678" table)
-      (cond
-       ;; Emacs
-       ((arrayp table)
-       (setq entry (aref table ?a))
-       ;; In Emacs, table entries are cons cells
-       (if (consp entry) (setq entry (car entry))))
-       ;; XEmacs
-       ((fboundp 'get-char-table)
-       (setq entry (get-char-table ?a table)))
-       ;; incompatible
-       (t (error "CC Mode is incompatible with this version of Emacs")))
-      (setq list (cons (if (= (logand (lsh entry -16) 255) 255)
-                          '8-bit
-                        '1-bit)
-                      list)))
-
     ;; Check whether beginning/end-of-defun call
     ;; beginning/end-of-defun-function nicely, passing through the
     ;; argument and respecting the return code.
@@ -1609,35 +1566,12 @@
                               (not (end-of-defun))))
          (setq list (cons 'argumentative-bod-function list))))
 
-    (let ((buf (generate-new-buffer " test"))
-         parse-sexp-lookup-properties
-         parse-sexp-ignore-comments
-         lookup-syntax-properties)     ; XEmacs
-      (with-current-buffer buf
+    (with-temp-buffer
+      (let ((parse-sexp-lookup-properties t)
+            (parse-sexp-ignore-comments t)
+            (lookup-syntax-properties t))      ; XEmacs
        (set-syntax-table (make-syntax-table))
 
-       ;; For some reason we have to set some of these after the
-       ;; buffer has been made current.  (Specifically,
-       ;; `parse-sexp-ignore-comments' in Emacs 21.)
-       (setq parse-sexp-lookup-properties t
-             parse-sexp-ignore-comments t
-             lookup-syntax-properties t)
-
-       ;; Find out if the `syntax-table' text property works.
-       (modify-syntax-entry ?< ".")
-       (modify-syntax-entry ?> ".")
-       (insert "<()>")
-       (c-mark-<-as-paren (point-min))
-       (c-mark->-as-paren (+ 3 (point-min)))
-       (goto-char (point-min))
-       (c-forward-sexp)
-       (if (= (point) (+ 4 (point-min)))
-           (setq list (cons 'syntax-properties list))
-         (error (concat
-                 "CC Mode is incompatible with this version of Emacs - "
-                 "support for the `syntax-table' text property "
-                 "is required.")))
-
        ;; Find out if generic comment delimiters work.
        (c-safe
          (modify-syntax-entry ?x "!")
@@ -1674,11 +1608,11 @@
            (cond
             ;; XEmacs.  Afaik this is currently an Emacs-only
             ;; feature, but it's good to be prepared.
-            ((memq '8-bit list)
+            ((featurep 'xemacs)
              (modify-syntax-entry ?/ ". 1456")
              (modify-syntax-entry ?* ". 23"))
             ;; Emacs
-            ((memq '1-bit list)
+            (t
              (modify-syntax-entry ?/ ". 124b")
              (modify-syntax-entry ?* ". 23")))
            (modify-syntax-entry ?\n "> b")
@@ -1687,16 +1621,7 @@
            (if (bobp)
                (setq list (cons 'col-0-paren list)))))
 
-       (set-buffer-modified-p nil))
-      (kill-buffer buf))
-
-    ;; See if `parse-partial-sexp' returns the eighth element.
-    (if (c-safe (>= (length (save-excursion (parse-partial-sexp (point) 
(point))))
-                   10))
-       (setq list (cons 'pps-extended-state list))
-      (error (concat
-             "CC Mode is incompatible with this version of Emacs - "
-             "`parse-partial-sexp' has to return at least 10 elements.")))
+       (set-buffer-modified-p nil)))
 
     ;;(message "c-emacs-features: %S" list)
     list)
@@ -1705,29 +1630,16 @@
 features supporting those needed by CC Mode.  The following values
 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.
-'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
-                   this feature.
-'gen-comment-delim  Generic comment delimiters work
+`argumentative-bod-function'         `beginning-of-defun' passes ARG through
+                    to a non-null `beginning-of-defun-function.'  It is assumed
+                   that `end-of-defun' does the same thing.
+`gen-comment-delim'  Generic comment delimiters work
                    (i.e. the syntax class `!').
-'gen-string-delim   Generic string delimiters work
+`gen-string-delim'   Generic string delimiters work
                    (i.e. the syntax class `|').
-'pps-extended-state `parse-partial-sexp' returns a list with at least 10
-                   elements, i.e. it contains the position of the start of
-                   the last comment or string.  It's always set - CC Mode
-                    no longer works in emacsen without this feature.
-'posix-char-classes The regexp engine understands POSIX character classes.
-'col-0-paren        It's possible to turn off the ad-hoc rule that a paren
-                   in column zero is the start of a defun.
-'infodock           This is Infodock (based on XEmacs).
-
-'8-bit and '1-bit are mutually exclusive.")
+`posix-char-classes' The regexp engine understands POSIX character classes.
+`col-0-paren'        It's possible to turn off the ad-hoc rule that a paren
+                   in column zero is the start of a defun.")
 
 
 ;;; Some helper constants.
@@ -2023,11 +1935,6 @@
 language.  NAME and LANG are not evaluated so they should not be
 quoted."
 
-  (or (symbolp name)
-      (error "Not a symbol: %S" name))
-  (or (symbolp lang)
-      (error "Not a symbol: %S" lang))
-
   (let ((sym (intern (symbol-name name) c-lang-constants))
        (mode (when lang (intern (concat (symbol-name lang) "-mode")))))
 
@@ -2188,57 +2095,56 @@
        value))))
 
 (defun c-find-assignment-for-mode (source-pos mode match-any-lang _name)
-  ;; Find the first assignment entry that applies to MODE at or after
-  ;; SOURCE-POS.  If MATCH-ANY-LANG is non-nil, entries with `t' as
-  ;; the language list are considered to match, otherwise they don't.
-  ;; On return SOURCE-POS is updated to point to the next assignment
-  ;; after the returned one.  If no assignment is found,
-  ;; `c-lang--novalue' is returned as a magic value.
-  ;;
-  ;; SOURCE-POS is a vector that points out a specific assignment in
-  ;; the double alist that's used in the `source' property.  The first
-  ;; element is the position in the top alist which is indexed with
-  ;; the source files, and the second element is the position in the
-  ;; nested bindings alist.
-  ;;
-  ;; NAME is only used for error messages.
+  "Find the first assignment entry that applies to MODE at or after
+SOURCE-POS.  If MATCH-ANY-LANG is non-nil, entries with `t' as
+the language list are considered to match, otherwise they don't.
+On return SOURCE-POS is updated to point to the next assignment
+after the returned one.  If no assignment is found,
+`c-lang--novalue' is returned as a magic value.
+
+SOURCE-POS is a vector that points out a specific assignment in
+the double alist that's used in the `source' property.  The first
+element is the position in the top alist which is indexed with
+the source files, and the second element is the position in the
+nested bindings alist.
+
+NAME is only used for error messages."
 
   (catch 'found
     (let ((file-entry (elt source-pos 0))
          (assignment-entry (elt source-pos 1))
          assignment)
 
-      (while (if assignment-entry
-                t
-              ;; Handled the last assignment from one file, begin on the
-              ;; next.  Due to the check in `c-lang-defconst', we know
-              ;; there's at least one.
-              (when file-entry
-
-                (unless (aset source-pos 1
-                              (setq assignment-entry (cdar file-entry)))
-                  ;; The file containing the source definitions has not
-                  ;; been loaded.
-                  (let ((file (symbol-name (caar file-entry)))
-                        (c-lang-constants-under-evaluation nil))
-                    ;;(message (concat "Loading %s to get the source "
-                    ;;                 "value for language constant %s")
-                    ;;         file name)
-                    (load file nil t))
-
-                  (unless (setq assignment-entry (cdar file-entry))
-                    ;; The load didn't fill in the source for the
-                    ;; constant as expected.  The situation is
-                    ;; probably that a derived mode was written for
-                    ;; and compiled with another version of CC Mode,
-                    ;; and the requested constant isn't in the
-                    ;; currently loaded one.  Put in a dummy
-                    ;; assignment that matches no language.
-                    (setcdr (car file-entry)
-                            (setq assignment-entry (list (list nil))))))
-
-                (aset source-pos 0 (setq file-entry (cdr file-entry)))
-                t))
+      (while (or assignment-entry
+                 ;; Handled the last assignment from one file, begin on the
+                 ;; next.  Due to the check in `c-lang-defconst', we know
+                 ;; there's at least one.
+                 (when file-entry
+
+                   (unless (aset source-pos 1
+                                 (setq assignment-entry (cdar file-entry)))
+                     ;; The file containing the source definitions has not
+                     ;; been loaded.
+                     (let ((file (symbol-name (caar file-entry)))
+                           (c-lang-constants-under-evaluation nil))
+                       ;;(message (concat "Loading %s to get the source "
+                       ;;                      "value for language constant 
%s")
+                       ;;              file name)
+                       (load file nil t))
+
+                     (unless (setq assignment-entry (cdar file-entry))
+                       ;; The load didn't fill in the source for the
+                       ;; constant as expected.  The situation is
+                       ;; probably that a derived mode was written for
+                       ;; and compiled with another version of CC Mode,
+                       ;; and the requested constant isn't in the
+                       ;; currently loaded one.  Put in a dummy
+                       ;; assignment that matches no language.
+                       (setcdr (car file-entry)
+                               (setq assignment-entry (list (list nil))))))
+
+                   (aset source-pos 0 (setq file-entry (cdr file-entry)))
+                   t))
 
        (setq assignment (car assignment-entry))
        (aset source-pos 1

=== modified file 'lisp/progmodes/cc-engine.el'
--- a/lisp/progmodes/cc-engine.el       2014-08-24 20:50:11 +0000
+++ b/lisp/progmodes/cc-engine.el       2014-09-10 16:32:36 +0000
@@ -2222,6 +2222,8 @@
        ((and (not not-in-delimiter)    ; inside a comment starter
             (not (bobp))
             (progn (backward-char)
+                    ;; FIXME: We never add category-properties to
+                    ;; c-emacs-features!
                    (and (not (and (memq 'category-properties c-emacs-features)
                                   (looking-at "\\s!")))
                         (looking-at c-comment-start-regexp))))
@@ -4119,10 +4121,10 @@
                                 (c-end-of-current-token last-token-end-pos))
                               (setq last-token-end-pos (point))))))
                 ;; Inside a token.
-                (if lookbehind-submatch
-                    ;; See the NOTE above.
-                    (goto-char state-pos)
-                  (goto-char (min last-token-end-pos bound))))
+                (goto-char (if lookbehind-submatch
+                                ;; See the NOTE above.
+                               state-pos
+                             (min last-token-end-pos bound))))
 
                (t
                 ;; A real match.

=== modified file 'lisp/progmodes/cc-fonts.el'
--- a/lisp/progmodes/cc-fonts.el        2014-08-24 20:50:11 +0000
+++ b/lisp/progmodes/cc-fonts.el        2014-09-10 16:32:36 +0000
@@ -201,17 +201,18 @@
   :version "24.1"
   :group 'c)
 
+;; This indicates the "font locking context", and is set just before
+;; fontification is done.  If non-nil, it says, e.g., point starts
+;; from within a #if preprocessor construct.
+(defvar c-font-lock-context nil)
+(make-variable-buffer-local 'c-font-lock-context)
+(cc-bytecomp-defvar c-font-lock-context)
+
 (eval-and-compile
   ;; We need the following definitions during compilation since they're
   ;; used when the `c-lang-defconst' initializers are evaluated.  Define
   ;; them at runtime too for the sake of derived modes.
 
-  ;; This indicates the "font locking context", and is set just before
-  ;; fontification is done.  If non-nil, it says, e.g., point starts
-  ;; from within a #if preprocessor construct.
-  (defvar c-font-lock-context nil)
-  (make-variable-buffer-local 'c-font-lock-context)
-
   (defmacro c-put-font-lock-face (from to face)
     ;; Put a face on a region (overriding any existing face) in the way
     ;; font-lock would do it.  In XEmacs that means putting an
@@ -272,18 +273,29 @@
                    (c-got-face-at (point) c-literal-faces))))
       t))
 
+  (defvar c-font-byte-compile t
+    "If non-nil, byte-compile the dynamically-generated functions.")
+
+  (defun c--compile (exp)
+    (cond
+     ((byte-code-function-p exp) (error "Already byte-compiled: %S" exp))
+     ((not (eq (car-safe exp) 'lambda))
+      (error "Expected a (lambda ..): %S" exp))
+     (c-font-byte-compile (byte-compile exp))
+     (t (eval (macroexpand-all exp)))))
+
   (defun c-make-syntactic-matcher (regexp)
-    ;; Returns a byte compiled function suitable for use in place of a
-    ;; regexp string in a `font-lock-keywords' matcher, except that
-    ;; only matches outside comments and string literals count.
-    ;;
-    ;; This function does not do any hidden buffer changes, but the
-    ;; generated functions will.  (They are however used in places
-    ;; covered by the font-lock context.)
-    (byte-compile
+    "Return a function suitable for use in place of a
+regexp string in a `font-lock-keywords' matcher, except that
+only matches outside comments and string literals count.
+
+This function does not do any hidden buffer changes, but the
+generated functions will.  (They are however used in places
+covered by the font-lock context.)"
+    (c--compile
      `(lambda (limit)
        (let (res)
-         (while (and (setq res (re-search-forward ,regexp limit t))
+          (while (and (setq res (re-search-forward ,regexp limit t))
                      (progn
                        (goto-char (match-beginning 0))
                        (or (c-skip-comments-and-strings limit)
@@ -332,34 +344,34 @@
            highlights))))
 
   (defun c-make-font-lock-search-function (regexp &rest highlights)
-    ;; This function makes a byte compiled function that works much like
-    ;; a matcher element in `font-lock-keywords'.  It cuts out a little
-    ;; bit of the overhead compared to a real matcher.  The main reason
-    ;; is however to pass the real search limit to the anchored
-    ;; matcher(s), since most (if not all) font-lock implementations
-    ;; arbitrarily limit anchored matchers to the same line, and also
-    ;; to insulate against various other irritating differences between
-    ;; the different (X)Emacs font-lock packages.
-    ;;
-    ;; REGEXP is the matcher, which must be a regexp.  Only matches
-    ;; where the beginning is outside any comment or string literal are
-    ;; significant.
-    ;;
-    ;; HIGHLIGHTS is a list of highlight specs, just like in
-    ;; `font-lock-keywords', with these limitations: The face is always
-    ;; overridden (no big disadvantage, since hits in comments etc are
-    ;; filtered anyway), there is no "laxmatch", and an anchored matcher
-    ;; is always a form which must do all the fontification directly.
-    ;; `limit' is a variable bound to the real limit in the context of
-    ;; the anchored matcher forms.
-    ;;
-    ;; This function does not do any hidden buffer changes, but the
-    ;; generated functions will.  (They are however used in places
-    ;; covered by the font-lock context.)
-
-    ;; Note: Replace `byte-compile' with `eval' to debug the generated
+    "This function makes a byte compiled function that works much like
+a matcher element in `font-lock-keywords'.  It cuts out a little
+bit of the overhead compared to a real matcher.  The main reason
+is however to pass the real search limit to the anchored
+matcher(s), since most (if not all) font-lock implementations
+arbitrarily limit anchored matchers to the same line, and also
+to insulate against various other irritating differences between
+the different (X)Emacs font-lock packages.
+
+REGEXP is the matcher, which must be a regexp.  Only matches
+where the beginning is outside any comment or string literal are
+significant.
+
+HIGHLIGHTS is a list of highlight specs, just like in
+`font-lock-keywords', with these limitations: The face is always
+overridden (no big disadvantage, since hits in comments etc are
+filtered anyway), there is no \"laxmatch\", and an anchored matcher
+is always a form which must do all the fontification directly.
+`limit' is a variable bound to the real limit in the context of
+the anchored matcher forms.
+
+This function does not do any hidden buffer changes, but the
+generated functions will.  (They are however used in places
+covered by the font-lock context.)"
+
+    ;; Note: Set c-font-byte-compile to nil to debug the generated
     ;; lambda more easily.
-    (byte-compile
+    (c--compile
      `(lambda (limit)
        (let ( ;; The font-lock package in Emacs is known to clobber
              ;; `parse-sexp-lookup-properties' (when it exists).
@@ -402,44 +414,44 @@
        nil)))
 
   (defun c-make-font-lock-BO-decl-search-function (regexp &rest highlights)
-    ;; This function makes a byte compiled function that first moves back
-    ;; to the beginning of the current declaration (if any), then searches
-    ;; forward for matcher elements (as in `font-lock-keywords') and
-    ;; fontifies them.
-    ;;
-    ;; The motivation for moving back to the declaration start is to
-    ;; establish a context for the current text when, e.g., a character
-    ;; is typed on a C++ inheritance continuation line, or a jit-lock
-    ;; chunk starts there.
-    ;;
-    ;; The new function works much like a matcher element in
-    ;; `font-lock-keywords'.  It cuts out a little bit of the overhead
-    ;; compared to a real matcher.  The main reason is however to pass the
-    ;; real search limit to the anchored matcher(s), since most (if not
-    ;; all) font-lock implementations arbitrarily limit anchored matchers
-    ;; to the same line, and also to insulate against various other
-    ;; irritating differences between the different (X)Emacs font-lock
-    ;; packages.
-    ;;
-    ;; REGEXP is the matcher, which must be a regexp.  Only matches
-    ;; where the beginning is outside any comment or string literal are
-    ;; significant.
-    ;;
-    ;; HIGHLIGHTS is a list of highlight specs, just like in
-    ;; `font-lock-keywords', with these limitations: The face is always
-    ;; overridden (no big disadvantage, since hits in comments etc are
-    ;; filtered anyway), there is no "laxmatch", and an anchored matcher
-    ;; is always a form which must do all the fontification directly.
-    ;; `limit' is a variable bound to the real limit in the context of
-    ;; the anchored matcher forms.
-    ;;
-    ;; This function does not do any hidden buffer changes, but the
-    ;; generated functions will.  (They are however used in places
-    ;; covered by the font-lock context.)
-
-    ;; Note: Replace `byte-compile' with `eval' to debug the generated
+    "This function makes a byte compiled function that first moves back
+to the beginning of the current declaration (if any), then searches
+forward for matcher elements (as in `font-lock-keywords') and
+fontifies them.
+
+The motivation for moving back to the declaration start is to
+establish a context for the current text when, e.g., a character
+is typed on a C++ inheritance continuation line, or a jit-lock
+chunk starts there.
+
+The new function works much like a matcher element in
+`font-lock-keywords'.  It cuts out a little bit of the overhead
+compared to a real matcher.  The main reason is however to pass the
+real search limit to the anchored matcher(s), since most (if not
+all) font-lock implementations arbitrarily limit anchored matchers
+to the same line, and also to insulate against various other
+irritating differences between the different (X)Emacs font-lock
+packages.
+
+REGEXP is the matcher, which must be a regexp.  Only matches
+where the beginning is outside any comment or string literal are
+significant.
+
+HIGHLIGHTS is a list of highlight specs, just like in
+`font-lock-keywords', with these limitations: The face is always
+overridden (no big disadvantage, since hits in comments etc are
+filtered anyway), there is no \"laxmatch\", and an anchored matcher
+is always a form which must do all the fontification directly.
+`limit' is a variable bound to the real limit in the context of
+the anchored matcher forms.
+
+This function does not do any hidden buffer changes, but the
+generated functions will.  (They are however used in places
+covered by the font-lock context.)"
+
+    ;; Note: Set c-font-byte-compile to nil to debug the generated
     ;; lambda more easily.
-    (byte-compile
+    (c--compile
      `(lambda (limit)
        (let ( ;; The font-lock package in Emacs is known to clobber
              ;; `parse-sexp-lookup-properties' (when it exists).
@@ -457,40 +469,40 @@
        nil)))
 
   (defun c-make-font-lock-context-search-function (normal &rest state-stanzas)
-    ;; This function makes a byte compiled function that works much like
-    ;; a matcher element in `font-lock-keywords', with the following
-    ;; enhancement: the generated function will test for particular "font
-    ;; lock contexts" at the start of the region, i.e. is this point in
-    ;; the middle of some particular construct?  if so the generated
-    ;; function will first fontify the tail of the construct, before
-    ;; going into the main loop and fontify full constructs up to limit.
-    ;;
-    ;; The generated function takes one parameter called `limit', and
-    ;; will fontify the region between POINT and LIMIT.
-    ;;
-    ;; NORMAL is a list of the form (REGEXP HIGHLIGHTS .....), and is
-    ;; used to fontify the "regular" bit of the region.
-    ;; STATE-STANZAS is list of elements of the form (STATE LIM REGEXP
-    ;; HIGHLIGHTS), each element coding one possible font lock context.
-
-    ;; o - REGEXP is a font-lock regular expression (NOT a function),
-    ;; o - HIGHLIGHTS is a list of zero or more highlighters as defined
-    ;;   on page "Search-based Fontification" in the elisp manual.  As
-    ;;   yet (2009-06), they must have OVERRIDE set, and may not have
-    ;;   LAXMATCH set.
-    ;;
-    ;; o - STATE is the "font lock context" (e.g. in-cpp-expr) and is
-    ;;   not quoted.
-    ;; o - LIM is a lisp form whose evaluation will yield the limit
-    ;;   position in the buffer for fontification by this stanza.
-    ;;
-    ;; This function does not do any hidden buffer changes, but the
-    ;; generated functions will.  (They are however used in places
-    ;; covered by the font-lock context.)
-    ;;
-    ;; Note: Replace `byte-compile' with `eval' to debug the generated
+    "This function makes a byte compiled function that works much like
+a matcher element in `font-lock-keywords', with the following
+enhancement: the generated function will test for particular \"font
+lock contexts\" at the start of the region, i.e. is this point in
+the middle of some particular construct?  if so the generated
+function will first fontify the tail of the construct, before
+going into the main loop and fontify full constructs up to limit.
+
+The generated function takes one parameter called `limit', and
+will fontify the region between POINT and LIMIT.
+
+NORMAL is a list of the form (REGEXP HIGHLIGHTS .....), and is
+used to fontify the \"regular\" bit of the region.
+STATE-STANZAS is list of elements of the form (STATE LIM REGEXP
+HIGHLIGHTS), each element coding one possible font lock context.
+
+o - REGEXP is a font-lock regular expression (NOT a function),
+o - HIGHLIGHTS is a list of zero or more highlighters as defined
+  on page \"Search-based Fontification\" in the elisp manual.  As
+  yet (2009-06), they must have OVERRIDE set, and may not have
+  LAXMATCH set.
+
+o - STATE is the \"font lock context\" (e.g. in-cpp-expr) and is
+  not quoted.
+o - LIM is a lisp form whose evaluation will yield the limit
+  position in the buffer for fontification by this stanza.
+
+This function does not do any hidden buffer changes, but the
+generated functions will.  (They are however used in places
+covered by the font-lock context.)"
+
+    ;; Note: Set c-font-byte-compile to nil to debug the generated
     ;; lambda more easily.
-    (byte-compile
+    (c--compile
      `(lambda (limit)
        (let ( ;; The font-lock package in Emacs is known to clobber
              ;; `parse-sexp-lookup-properties' (when it exists).
@@ -522,10 +534,10 @@
     (form &rest &or ("quote" (&rest form)) ("`" (&rest form)) form)));))
 
 (defun c-fontify-recorded-types-and-refs ()
-  ;; Convert the ranges recorded on `c-record-type-identifiers' and
-  ;; `c-record-ref-identifiers' to fontification.
-  ;;
-  ;; This function does hidden buffer changes.
+  "Convert the ranges recorded on `c-record-type-identifiers' and
+`c-record-ref-identifiers' to fontification.
+  
+This function does hidden buffer changes."
   (let (elem)
     (while (consp c-record-type-identifiers)
       (setq elem (car c-record-type-identifiers)
@@ -581,7 +593,7 @@
 
                       ;; Use an anchored matcher to put paren syntax
                       ;; on the brackets.
-                      (,(byte-compile
+                      (,(c--compile
                          `(lambda (limit)
                             (let ((beg (match-beginning
                                         ,(+ ncle-depth re-depth sws-depth 1)))
@@ -683,10 +695,10 @@
                         "\\)")
                 `(,(1+ ncle-depth) c-preprocessor-face-name t)))
 
-             (eval . (list ,(c-make-syntactic-matcher
-                             (concat noncontinued-line-end
-                                     (c-lang-const c-opt-cpp-prefix)
-                                     "if\\(n\\)def\\>"))
+             (eval . (list ',(c-make-syntactic-matcher
+                               (concat noncontinued-line-end
+                                       (c-lang-const c-opt-cpp-prefix)
+                                       "if\\(n\\)def\\>"))
                            ,(+ ncle-depth 1)
                            c-negation-char-face-name
                            'append))
@@ -745,11 +757,11 @@
       ;; this, but it doesn't give the control we want since any
       ;; fontification done inside the function will be
       ;; unconditionally overridden.
-      ,(c-make-font-lock-search-function
-       ;; Match a char before the string starter to make
-       ;; `c-skip-comments-and-strings' work correctly.
-       (concat ".\\(" c-string-limit-regexp "\\)")
-       '((c-font-lock-invalid-string)))
+      (,(c-make-font-lock-search-function
+         ;; Match a char before the string starter to make
+         ;; `c-skip-comments-and-strings' work correctly.
+         (concat ".\\(" c-string-limit-regexp "\\)")
+         '((c-font-lock-invalid-string))))
 
       ;; Fontify keyword constants.
       ,@(when (c-lang-const c-constant-kwds)
@@ -801,7 +813,8 @@
                                    (c-backward-syntactic-ws)
                                    (setq id-end (point))
                                    (< (skip-chars-backward
-                                       ,(c-lang-const c-symbol-chars)) 0))
+                                       ,(c-lang-const c-symbol-chars))
+                                       0))
                                  (not (get-text-property (point) 'face)))
                        (c-put-font-lock-face (point) id-end
                                              c-reference-face-name)
@@ -809,7 +822,7 @@
                    nil
                    (goto-char (match-end 0)))))
 
-           `((,(byte-compile
+           `((,(c--compile
                 ;; Must use a function here since we match longer than
                 ;; we want to move before doing a new search.  This is
                 ;; not necessary for XEmacs since it restarts the
@@ -1564,9 +1577,7 @@
   ;; 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) ?\{)
@@ -1617,17 +1628,16 @@
   t `(;; Objective-C methods.
       ,@(when (c-major-mode-is 'objc-mode)
          `((,(c-lang-const c-opt-method-key)
-            (,(byte-compile
-               (lambda (limit)
-                 (let (;; The font-lock package in Emacs is known to clobber
-                       ;; `parse-sexp-lookup-properties' (when it exists).
-                       (parse-sexp-lookup-properties
-                        (cc-eval-when-compile
-                          (boundp 'parse-sexp-lookup-properties))))
-                   (save-restriction
-                     (narrow-to-region (point-min) limit)
-                     (c-font-lock-objc-method)))
-                 nil))
+            (,(lambda (limit)
+                 (let (;; The font-lock package in Emacs is known to clobber
+                       ;; `parse-sexp-lookup-properties' (when it exists).
+                       (parse-sexp-lookup-properties
+                        (cc-eval-when-compile
+                          (boundp 'parse-sexp-lookup-properties))))
+                   (save-restriction
+                     (narrow-to-region (point-min) limit)
+                     (c-font-lock-objc-method)))
+                 nil)
              (goto-char (match-end 1))))))
 
       ;; Fontify all type names and the identifiers in the
@@ -1742,7 +1752,7 @@
 
       ;; Fontify types preceded by `c-type-prefix-kwds' (e.g. "struct").
       ,@(when (c-lang-const c-type-prefix-kwds)
-         `((,(byte-compile
+         `((,(c--compile
               `(lambda (limit)
                  (c-fontify-types-and-refs
                      ((c-promote-possible-types t)
@@ -2295,7 +2305,7 @@
      limit
      "[-+]"
      nil
-     (lambda (match-pos inside-macro)
+     (lambda (_match-pos _inside-macro)
        (forward-char)
        (c-font-lock-objc-method))))
   nil)

=== modified file 'lisp/progmodes/cc-langs.el'
--- a/lisp/progmodes/cc-langs.el        2014-08-24 20:50:11 +0000
+++ b/lisp/progmodes/cc-langs.el        2014-09-10 16:32:36 +0000
@@ -153,8 +153,8 @@
        c-emacs-variable-inits-tail c-emacs-variable-inits))
 
 (defmacro c-lang-defvar (var val &optional doc)
-  "Declares the buffer local variable VAR to get the value VAL.  VAL is
-evaluated and assigned at mode initialization.  More precisely, VAL is
+  "Declare the buffer local variable VAR to get the value VAL.
+VAL is evaluated and assigned at mode initialization.  More precisely, VAL is
 evaluated and bound to VAR when the result from the macro
 `c-init-language-vars' is evaluated.
 
@@ -218,55 +218,54 @@
   ;; Some helper functions used when building the language constants.
 
   (defun c-filter-ops (ops opgroup-filter op-filter &optional xlate)
-    ;; Extract a subset of the operators in the list OPS in a DWIM:ey
-    ;; way.  The return value is a plain list of operators:
-    ;;
-    ;; OPS either has the structure of `c-operators', is a single
-    ;; group in `c-operators', or is a plain list of operators.
-    ;;
-    ;; OPGROUP-FILTER specifies how to select the operator groups.  It
-    ;; can be t to choose all groups, a list of group type symbols
-    ;; (such as 'prefix) to accept, or a function which will be called
-    ;; with the group symbol for each group and should return non-nil
-    ;; if that group is to be included.
-    ;;
-    ;; If XLATE is given, it's a function which is called for each
-    ;; matching operator and its return value is collected instead.
-    ;; If it returns a list, the elements are spliced directly into
-    ;; the final result, which is returned as a list with duplicates
-    ;; removed using `equal'.
-    ;;
-    ;; `c-mode-syntax-table' for the current mode is in effect during
-    ;; the whole procedure.
+    "Extract a subset of the operators in the list OPS in a DWIM:ey way.
+The return value is a plain list of operators:
+
+OPS either has the structure of `c-operators', is a single
+group in `c-operators', or is a plain list of operators.
+
+OPGROUP-FILTER specifies how to select the operator groups.  It
+can be t to choose all groups, a list of group type symbols
+\(such as 'prefix) to accept, or a function which will be called
+with the group symbol for each group and should return non-nil
+if that group is to be included.
+
+If XLATE is given, it's a function which is called for each
+matching operator and its return value is collected instead.
+If it returns a list, the elements are spliced directly into
+the final result, which is returned as a list with duplicates
+removed using `equal'.
+
+`c-mode-syntax-table' for the current mode is in effect during
+the whole procedure."
     (unless (listp (car-safe ops))
       (setq ops (list ops)))
-    (cond ((eq opgroup-filter t)
-          (setq opgroup-filter (lambda (opgroup) t)))
-         ((not (functionp opgroup-filter))
-          (setq opgroup-filter `(lambda (opgroup)
-                                  (memq opgroup ',opgroup-filter)))))
-    (cond ((eq op-filter t)
-          (setq op-filter (lambda (op) t)))
-         ((stringp op-filter)
-          (setq op-filter `(lambda (op)
-                             (string-match ,op-filter op)))))
-    (unless xlate
-      (setq xlate 'identity))
-    (c-with-syntax-table (c-lang-const c-mode-syntax-table)
-      (cl-delete-duplicates
-       (cl-mapcan (lambda (opgroup)
-                (when (if (symbolp (car opgroup))
-                          (when (funcall opgroup-filter (car opgroup))
-                            (setq opgroup (cdr opgroup))
-                            t)
-                        t)
-                  (cl-mapcan (lambda (op)
-                            (when (funcall op-filter op)
-                              (let ((res (funcall xlate op)))
-                                (if (listp res) res (list res)))))
-                          opgroup)))
-              ops)
-       :test 'equal))))
+    (let ((opgroup-filter
+           (cond ((eq opgroup-filter t) (lambda (opgroup) t))
+                 ((not (functionp opgroup-filter))
+                  `(lambda (opgroup) (memq opgroup ',opgroup-filter)))
+                 (t opgroup-filter)))
+          (op-filter
+           (cond ((eq op-filter t) (lambda (op) t))
+                 ((stringp op-filter) `(lambda (op) (string-match ,op-filter 
op)))
+                 (t op-filter))))
+      (unless xlate
+        (setq xlate #'identity))
+      (c-with-syntax-table (c-lang-const c-mode-syntax-table)
+        (cl-delete-duplicates
+         (cl-mapcan (lambda (opgroup)
+                      (when (if (symbolp (car opgroup))
+                                (when (funcall opgroup-filter (car opgroup))
+                                  (setq opgroup (cdr opgroup))
+                                  t)
+                              t)
+                        (cl-mapcan (lambda (op)
+                                     (when (funcall op-filter op)
+                                       (let ((res (funcall xlate op)))
+                                         (if (listp res) res (list res)))))
+                                   opgroup)))
+                    ops)
+         :test #'equal)))))
 
 
 ;;; Various mode specific values that aren't language related.
@@ -350,16 +349,12 @@
   ;; all languages now require dual comments, we make this the
   ;; default.
   (cond
-   ;; XEmacs
-   ((memq '8-bit c-emacs-features)
+   ((featurep 'xemacs)
     (modify-syntax-entry ?/  ". 1456" table)
     (modify-syntax-entry ?*  ". 23"   table))
-   ;; Emacs
-   ((memq '1-bit c-emacs-features)
+   (t
     (modify-syntax-entry ?/  ". 124b" table)
-    (modify-syntax-entry ?*  ". 23"   table))
-   ;; incompatible
-   (t (error "CC Mode is incompatible with this version of Emacs")))
+    (modify-syntax-entry ?*  ". 23"   table)))
 
   (modify-syntax-entry ?\n "> b"  table)
   ;; Give CR the same syntax as newline, for selective-display
@@ -368,19 +363,19 @@
 (c-lang-defconst c-make-mode-syntax-table
   "Functions that generates the mode specific syntax tables.
 The syntax tables aren't stored directly since they're quite large."
-  t `(lambda ()
-       (let ((table (make-syntax-table)))
-        (c-populate-syntax-table table)
-        ;; Mode specific syntaxes.
-        ,(cond ((or (c-major-mode-is 'objc-mode) (c-major-mode-is 'java-mode))
-                ;; Let '@' be part of symbols in ObjC to cope with
-                ;; its compiler directives as single keyword tokens.
-                ;; This is then necessary since it's assumed that
-                ;; every keyword is a single symbol.
-                `(modify-syntax-entry ?@ "_" table))
-               ((c-major-mode-is 'pike-mode)
-                `(modify-syntax-entry ?@ "." table)))
-        table)))
+  t (lambda ()
+      (let ((table (make-syntax-table)))
+        (c-populate-syntax-table table)
+        ;; Mode specific syntaxes.
+        (cond ((or (c-major-mode-is 'objc-mode) (c-major-mode-is 'java-mode))
+               ;; Let '@' be part of symbols in ObjC to cope with
+               ;; its compiler directives as single keyword tokens.
+               ;; This is then necessary since it's assumed that
+               ;; every keyword is a single symbol.
+               (modify-syntax-entry ?@ "_" table))
+              ((c-major-mode-is 'pike-mode)
+               (modify-syntax-entry ?@ "." table)))
+        table)))
 
 (c-lang-defconst c-mode-syntax-table
   ;; The syntax tables in evaluated form.  Only used temporarily when
@@ -398,8 +393,8 @@
   ;; CALLED!!!
   t   nil
   (java c++) `(lambda ()
-        (let ((table (funcall ,(c-lang-const c-make-mode-syntax-table))))
-          (modify-syntax-entry ?< "(>" table)
+                (let ((table (funcall ,(c-lang-const 
c-make-mode-syntax-table))))
+                  (modify-syntax-entry ?< "(>" table)
           (modify-syntax-entry ?> ")<" table)
           table)))
 (c-lang-defvar c++-template-syntax-table
@@ -419,9 +414,9 @@
            (let ((table (funcall ,(c-lang-const c-make-mode-syntax-table))))
              (modify-syntax-entry ?\( "." table)
              (modify-syntax-entry ?\) "." table)
-             (modify-syntax-entry ?\[ "." table)
-             (modify-syntax-entry ?\] "." table)
-             (modify-syntax-entry ?\{ "." table)
+              (modify-syntax-entry ?\[ "." table)
+              (modify-syntax-entry ?\] "." table)
+              (modify-syntax-entry ?\{ "." table)
              (modify-syntax-entry ?\} "." table)
              table))))
 (c-lang-defvar c-no-parens-syntax-table
@@ -1142,7 +1137,8 @@
   c++  (append '("&" "<%" "%>" "<:" ":>" "%:" "%:%:")
               (c-lang-const c-other-op-syntax-tokens))
   objc (append '("#" "##"              ; Used by cpp.
-                "+" "-") (c-lang-const c-other-op-syntax-tokens))
+                "+" "-")
+               (c-lang-const c-other-op-syntax-tokens))
   idl  (append '("#" "##")             ; Used by cpp.
               (c-lang-const c-other-op-syntax-tokens))
   pike (append '("..")
@@ -2469,27 +2465,24 @@
 
 ;; Note: No `*-kwds' language constants may be defined below this point.
 
-(eval-and-compile
-  (defconst c-kwds-lang-consts
-    ;; List of all the language constants that contain keyword lists.
-    (let (list)
-      (mapatoms (lambda (sym)
-                 (when (and (boundp sym)
-                            (string-match "-kwds\\'" (symbol-name sym)))
-                   ;; Make the list of globally interned symbols
-                   ;; instead of ones interned in `c-lang-constants'.
-                   (setq list (cons (intern (symbol-name sym)) list))))
-               c-lang-constants)
-      list)))
+(defconst c-kwds-lang-consts
+  ;; List of all the language constants that contain keyword lists.
+  (let (list)
+    (mapatoms (lambda (sym)
+                (when (and ;; (boundp sym)
+                       (string-match "-kwds\\'" (symbol-name sym)))
+                  ;; Make the list of globally interned symbols
+                  ;; instead of ones interned in `c-lang-constants'.
+                  (setq list (cons (intern (symbol-name sym)) list))))
+              c-lang-constants)
+    list))
 
 (c-lang-defconst c-keywords
   ;; All keywords as a list.
   t (cl-delete-duplicates
-     (c-lang-defconst-eval-immediately
-      `(append ,@(mapcar (lambda (kwds-lang-const)
-                          `(c-lang-const ,kwds-lang-const))
-                        c-kwds-lang-consts)
-              nil))
+     (apply #'append (mapcar (lambda (kwds-lang-const)
+                              (c-get-lang-constant kwds-lang-const))
+                            c-kwds-lang-consts))
      :test 'string-equal))
 
 (c-lang-defconst c-keywords-regexp
@@ -2501,18 +2494,10 @@
   ;; An alist with all the keywords in the cars.  The cdr for each
   ;; keyword is a list of the symbols for the `*-kwds' lists that
   ;; contains it.
-  t (let ((kwd-list-alist
-          (c-lang-defconst-eval-immediately
-           `(list ,@(mapcar (lambda (kwds-lang-const)
-                              `(cons ',kwds-lang-const
-                                     (c-lang-const ,kwds-lang-const)))
-                            c-kwds-lang-consts))))
-         lang-const kwd-list kwd
+  t (let (kwd-list kwd
          result-alist elem)
-      (while kwd-list-alist
-       (setq lang-const (caar kwd-list-alist)
-             kwd-list (cdar kwd-list-alist)
-             kwd-list-alist (cdr kwd-list-alist))
+      (dolist (lang-const c-kwds-lang-consts)
+       (setq kwd-list (c-get-lang-constant lang-const))
        (while kwd-list
          (setq kwd (car kwd-list)
                kwd-list (cdr kwd-list))
@@ -2598,12 +2583,13 @@
                            right-assoc-sequence)
                          t))
 
-          (unambiguous-prefix-ops (set-difference nonkeyword-prefix-ops
-                                                  in-or-postfix-ops
-                                                  :test 'string-equal))
-          (ambiguous-prefix-ops (intersection nonkeyword-prefix-ops
-                                              in-or-postfix-ops
-                                              :test 'string-equal)))
+          ;; (unambiguous-prefix-ops (cl-set-difference nonkeyword-prefix-ops
+          ;;                                      in-or-postfix-ops
+          ;;                                      :test 'string-equal))
+          ;; (ambiguous-prefix-ops (cl-intersection nonkeyword-prefix-ops
+          ;;                                  in-or-postfix-ops
+          ;;                                  :test 'string-equal))
+           )
 
       (concat
        "\\("

=== modified file 'lisp/progmodes/cc-mode.el'
--- a/lisp/progmodes/cc-mode.el 2014-03-04 04:03:34 +0000
+++ b/lisp/progmodes/cc-mode.el 2014-09-10 16:32:36 +0000
@@ -95,14 +95,9 @@
 (cc-require 'cc-menus)
 (cc-require 'cc-guess)
 
-;; Silence the compiler.
-(cc-bytecomp-defvar adaptive-fill-first-line-regexp) ; Emacs
-(cc-bytecomp-defun run-mode-hooks)     ; Emacs 21.1
-
 ;; We set these variables during mode init, yet we don't require
 ;; font-lock.
-(cc-bytecomp-defvar font-lock-defaults)
-(cc-bytecomp-defvar font-lock-syntactic-keywords)
+(defvar font-lock-defaults)
 
 ;; Menu support for both XEmacs and Emacs.  If you don't have easymenu
 ;; with your version of Emacs, you are incompatible!
@@ -552,11 +547,8 @@
   ;; heuristic that open parens in column 0 are defun starters.  Since
   ;; we have c-state-cache, that heuristic isn't useful and only causes
   ;; trouble, so turn it off.
-;; 2006/12/17: This facility is somewhat confused, and doesn't really seem
-;; helpful.  Comment it out for now.
-;;   (when (memq 'col-0-paren c-emacs-features)
-;;     (make-local-variable 'open-paren-in-column-0-is-defun-start)
-;;     (setq open-paren-in-column-0-is-defun-start nil))
+  (when (memq 'col-0-paren c-emacs-features)
+    (set (make-local-variable 'open-paren-in-column-0-is-defun-start) nil))
 
   (c-clear-found-types)
 
@@ -816,7 +808,7 @@
 (defmacro c-run-mode-hooks (&rest hooks)
   ;; Emacs 21.1 has introduced a system with delayed mode hooks that
   ;; requires the use of the new function `run-mode-hooks'.
-  (if (cc-bytecomp-fboundp 'run-mode-hooks)
+  (if (fboundp 'run-mode-hooks)
       `(run-mode-hooks ,@hooks)
     `(progn ,@(mapcar (lambda (hook) `(run-hooks ,hook)) hooks))))
 
@@ -1232,8 +1224,8 @@
          (font-lock-mark-block-function
           . c-mark-function)))
 
-  (make-local-variable 'font-lock-fontify-region-function)
-  (setq font-lock-fontify-region-function 'c-font-lock-fontify-region)
+  (set (make-local-variable 'font-lock-fontify-region-function)
+       #'c-font-lock-fontify-region)
 
   (if (featurep 'xemacs)
       (make-local-hook 'font-lock-mode-hook))


reply via email to

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