aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Monnier2014-09-10 12:32:36 -0400
committerStefan Monnier2014-09-10 12:32:36 -0400
commit47003633639a963d2a911d51bf69f4e29d36ff53 (patch)
tree0041ae3944db1134c13d15ab88ea159fc7ed4813
parenta2dcba1cf3acc322b7d0c45e5bfb12148f464e07 (diff)
downloademacs-47003633639a963d2a911d51bf69f4e29d36ff53.tar.gz
emacs-47003633639a963d2a911d51bf69f4e29d36ff53.zip
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.
-rw-r--r--lisp/ChangeLog42
-rw-r--r--lisp/Makefile.in2
-rw-r--r--lisp/progmodes/cc-defs.el260
-rw-r--r--lisp/progmodes/cc-engine.el10
-rw-r--r--lisp/progmodes/cc-fonts.el298
-rw-r--r--lisp/progmodes/cc-langs.el204
-rw-r--r--lisp/progmodes/cc-mode.el20
7 files changed, 387 insertions, 449 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 12f0f5e3218..998fa13bbba 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,45 @@
12014-09-10 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 CC-mode: Set open-paren-in-column-0-is-defun-start to nil;
4 plus misc cleanup.
5 * progmodes/cc-mode.el (c-basic-common-init):
6 Set open-paren-in-column-0-is-defun-start.
7 (adaptive-fill-first-line-regexp, font-lock-syntactic-keywords):
8 Remove declarations, unused.
9 (run-mode-hooks): Remove declaration.
10 (font-lock-defaults): Use plain `defvar' to declare.
11 (c-run-mode-hooks): Test existence of run-mode-hooks with fboundp.
12 * progmodes/cc-langs.el (c-filter-ops): Avoid `setq'.
13 (c-make-mode-syntax-table): Don't micro-optimize.
14 (c-keywords, c-keyword-member-alist): Simplify.
15 (c-kwds-lang-consts): Don't eval at compile-time.
16 (c-primary-expr-regexp): Comment out unused vars.
17 * progmodes/cc-fonts.el (c-font-lock-context): Declare at top-level.
18 (c-font-byte-compile): New var.
19 (c--compile): New function. Use it instead of `byte-compile'.
20 (c-cpp-matchers): Quote the value returned by
21 `c-make-syntactic-matcher' in case it's not self-evaluating.
22 (c-basic-matchers-before): Avoid a plain MATCHER as keyword, wrap it in
23 parentheses instead (in case MATCHER happens to be a list).
24 (c-font-lock-enum-tail): Remove unused var `start'.
25 (c-font-lock-objc-methods): Silence byte-compiler warnings.
26 * progmodes/cc-engine.el (c-syntactic-re-search-forward): Sink an `if'
27 test into an argument.
28 * progmodes/cc-defs.el (c-point, c-major-mode-is, c-put-char-property)
29 (c-get-char-property): Don't use `eval' just to unquote a constant.
30 (c-use-extents): Remove. Use (featurep 'xemacs), compiled
31 more efficiently.
32 (c-put-char-property-fun): Don't call `byte-compile' by hand.
33 (c-clear-char-property, c-clear-char-properties): Check that `property'
34 is a quoted constant.
35 (c-emacs-features): Remove `infodock', `syntax-properties', and
36 `pps-extended-state' (never used), `8-bit' and `1-bit' (use (featurep
37 'xemacs) instead). Use `with-temp-buffer' and let-bind vars after
38 changing buffer, so we don't have to setq them again afterwards.
39 (c-lang-const): Remove redundant symbolp assertions.
40 (c-find-assignment-for-mode): Use `or'.
41 * Makefile.in (compile-one-process): Remove cc-mode dependency.
42
12014-09-09 Sam Steingold <sds@gnu.org> 432014-09-09 Sam Steingold <sds@gnu.org>
2 44
3 * progmodes/sql.el (sql-default-directory): Fix type annotation. 45 * progmodes/sql.el (sql-default-directory): Fix type annotation.
diff --git a/lisp/Makefile.in b/lisp/Makefile.in
index 258cc3b8ae1..5733ea52715 100644
--- a/lisp/Makefile.in
+++ b/lisp/Makefile.in
@@ -387,7 +387,7 @@ compile-after-backup: backup-compiled-files compile-always
387# There is no reason to use this rule unless you only have a single 387# There is no reason to use this rule unless you only have a single
388# core and CPU time is an issue. 388# core and CPU time is an issue.
389.PHONY: compile-one-process 389.PHONY: compile-one-process
390compile-one-process: $(LOADDEFS) compile-first $(lisp)/progmodes/cc-mode.elc 390compile-one-process: $(LOADDEFS) compile-first
391 $(emacs) $(BYTE_COMPILE_FLAGS) \ 391 $(emacs) $(BYTE_COMPILE_FLAGS) \
392 --eval "(batch-byte-recompile-directory 0)" $(lisp) 392 --eval "(batch-byte-recompile-directory 0)" $(lisp)
393 393
diff --git a/lisp/progmodes/cc-defs.el b/lisp/progmodes/cc-defs.el
index 5d528caabb2..91c5773ebb4 100644
--- a/lisp/progmodes/cc-defs.el
+++ b/lisp/progmodes/cc-defs.el
@@ -195,7 +195,7 @@ If the referenced position doesn't exist, the closest accessible point
195to it is returned. This function does not modify the point or the mark." 195to it is returned. This function does not modify the point or the mark."
196 196
197 (if (eq (car-safe position) 'quote) 197 (if (eq (car-safe position) 'quote)
198 (let ((position (eval position))) 198 (let ((position (nth 1 position)))
199 (cond 199 (cond
200 200
201 ((eq position 'bol) 201 ((eq position 'bol)
@@ -885,7 +885,7 @@ MODE is either a mode symbol or a list of mode symbols."
885 `(c-lang-major-mode-is ,mode) 885 `(c-lang-major-mode-is ,mode)
886 886
887 (if (eq (car-safe mode) 'quote) 887 (if (eq (car-safe mode) 'quote)
888 (let ((mode (eval mode))) 888 (let ((mode (nth 1 mode)))
889 (if (listp mode) 889 (if (listp mode)
890 `(memq c-buffer-is-cc-mode ',mode) 890 `(memq c-buffer-is-cc-mode ',mode)
891 `(eq c-buffer-is-cc-mode ',mode))) 891 `(eq c-buffer-is-cc-mode ',mode)))
@@ -900,26 +900,10 @@ MODE is either a mode symbol or a list of mode symbols."
900;; properties set on a single character and that never spread to any 900;; properties set on a single character and that never spread to any
901;; other characters. 901;; other characters.
902 902
903(eval-and-compile
904 ;; Constant used at compile time to decide whether or not to use
905 ;; XEmacs extents. Check all the extent functions we'll use since
906 ;; some packages might add compatibility aliases for some of them in
907 ;; Emacs.
908 (defconst c-use-extents (and (cc-bytecomp-fboundp 'extent-at)
909 (cc-bytecomp-fboundp 'set-extent-property)
910 (cc-bytecomp-fboundp 'set-extent-properties)
911 (cc-bytecomp-fboundp 'make-extent)
912 (cc-bytecomp-fboundp 'extent-property)
913 (cc-bytecomp-fboundp 'delete-extent)
914 (cc-bytecomp-fboundp 'map-extents))))
915
916;; `c-put-char-property' is complex enough in XEmacs and Emacs < 21 to 903;; `c-put-char-property' is complex enough in XEmacs and Emacs < 21 to
917;; make it a function. 904;; make it a function.
918(defalias 'c-put-char-property-fun 905(defalias 'c-put-char-property-fun
919 (cc-eval-when-compile 906 (cond ((featurep 'xemacs)
920 (cond (c-use-extents
921 ;; XEmacs.
922 (byte-compile
923 (lambda (pos property value) 907 (lambda (pos property value)
924 (let ((ext (extent-at pos nil property))) 908 (let ((ext (extent-at pos nil property)))
925 (if ext 909 (if ext
@@ -928,20 +912,19 @@ MODE is either a mode symbol or a list of mode symbols."
928 (cons property 912 (cons property
929 (cons value 913 (cons value
930 '(start-open t 914 '(start-open t
931 end-open t))))))))) 915 end-open t))))))))
932 916
933 ((not (cc-bytecomp-boundp 'text-property-default-nonsticky)) 917 ((not (cc-bytecomp-boundp 'text-property-default-nonsticky))
934 ;; In Emacs < 21 we have to mess with the `rear-nonsticky' property. 918 ;; In Emacs < 21 we have to mess with the `rear-nonsticky' property.
935 (byte-compile
936 (lambda (pos property value) 919 (lambda (pos property value)
937 (put-text-property pos (1+ pos) property value) 920 (put-text-property pos (1+ pos) property value)
938 (let ((prop (get-text-property pos 'rear-nonsticky))) 921 (let ((prop (get-text-property pos 'rear-nonsticky)))
939 (or (memq property prop) 922 (or (memq property prop)
940 (put-text-property pos (1+ pos) 923 (put-text-property pos (1+ pos)
941 'rear-nonsticky 924 'rear-nonsticky
942 (cons property prop))))))) 925 (cons property prop))))))
943 ;; This won't be used for anything. 926 ;; This won't be used for anything.
944 (t 'ignore)))) 927 (t #'ignore)))
945(cc-bytecomp-defun c-put-char-property-fun) ; Make it known below. 928(cc-bytecomp-defun c-put-char-property-fun) ; Make it known below.
946 929
947(defmacro c-put-char-property (pos property value) 930(defmacro c-put-char-property (pos property value)
@@ -956,42 +939,38 @@ MODE is either a mode symbol or a list of mode symbols."
956 ;; 21) then it's assumed that the property is present on it. 939 ;; 21) then it's assumed that the property is present on it.
957 ;; 940 ;;
958 ;; This macro does a hidden buffer change. 941 ;; This macro does a hidden buffer change.
959 (setq property (eval property)) 942 (if (or (featurep 'xemacs)
960 (if (or c-use-extents
961 (not (cc-bytecomp-boundp 'text-property-default-nonsticky))) 943 (not (cc-bytecomp-boundp 'text-property-default-nonsticky)))
962 ;; XEmacs and Emacs < 21. 944 ;; XEmacs and Emacs < 21.
963 `(c-put-char-property-fun ,pos ',property ,value) 945 `(c-put-char-property-fun ,pos ,property ,value)
964 ;; In Emacs 21 we got the `rear-nonsticky' property covered 946 ;; In Emacs 21 we got the `rear-nonsticky' property covered
965 ;; by `text-property-default-nonsticky'. 947 ;; by `text-property-default-nonsticky'.
966 `(let ((-pos- ,pos)) 948 `(let ((-pos- ,pos))
967 (put-text-property -pos- (1+ -pos-) ',property ,value)))) 949 (put-text-property -pos- (1+ -pos-) ,property ,value))))
968 950
969(defmacro c-get-char-property (pos property) 951(defmacro c-get-char-property (pos property)
970 ;; Get the value of the given property on the character at POS if 952 ;; Get the value of the given property on the character at POS if
971 ;; it's been put there by `c-put-char-property'. PROPERTY is 953 ;; it's been put there by `c-put-char-property'. PROPERTY is
972 ;; assumed to be constant. 954 ;; assumed to be constant.
973 (setq property (eval property)) 955 (if (featurep 'xemacs)
974 (if c-use-extents
975 ;; XEmacs. 956 ;; XEmacs.
976 `(let ((ext (extent-at ,pos nil ',property))) 957 `(let ((ext (extent-at ,pos nil ,property)))
977 (if ext (extent-property ext ',property))) 958 (if ext (extent-property ext ,property)))
978 ;; Emacs. 959 ;; Emacs.
979 `(get-text-property ,pos ',property))) 960 `(get-text-property ,pos ,property)))
980 961
981;; `c-clear-char-property' is complex enough in Emacs < 21 to make it 962;; `c-clear-char-property' is complex enough in Emacs < 21 to make it
982;; a function, since we have to mess with the `rear-nonsticky' property. 963;; a function, since we have to mess with the `rear-nonsticky' property.
983(defalias 'c-clear-char-property-fun 964(defalias 'c-clear-char-property-fun
984 (cc-eval-when-compile 965 (unless (or (featurep 'xemacs)
985 (unless (or c-use-extents
986 (cc-bytecomp-boundp 'text-property-default-nonsticky)) 966 (cc-bytecomp-boundp 'text-property-default-nonsticky))
987 (byte-compile
988 (lambda (pos property) 967 (lambda (pos property)
989 (when (get-text-property pos property) 968 (when (get-text-property pos property)
990 (remove-text-properties pos (1+ pos) (list property nil)) 969 (remove-text-properties pos (1+ pos) (list property nil))
991 (put-text-property pos (1+ pos) 970 (put-text-property pos (1+ pos)
992 'rear-nonsticky 971 'rear-nonsticky
993 (delq property (get-text-property 972 (delq property (get-text-property
994 pos 'rear-nonsticky))))))))) 973 pos 'rear-nonsticky)))))))
995(cc-bytecomp-defun c-clear-char-property-fun) ; Make it known below. 974(cc-bytecomp-defun c-clear-char-property-fun) ; Make it known below.
996 975
997(defmacro c-clear-char-property (pos property) 976(defmacro c-clear-char-property (pos property)
@@ -1000,8 +979,10 @@ MODE is either a mode symbol or a list of mode symbols."
1000 ;; constant. 979 ;; constant.
1001 ;; 980 ;;
1002 ;; This macro does a hidden buffer change. 981 ;; This macro does a hidden buffer change.
1003 (setq property (eval property)) 982 (if (eq 'quote (car-safe property))
1004 (cond (c-use-extents 983 (setq property (nth 1 property))
984 (error "`property' should be a quoted constant"))
985 (cond ((featurep 'xemacs)
1005 ;; XEmacs. 986 ;; XEmacs.
1006 `(let ((ext (extent-at ,pos nil ',property))) 987 `(let ((ext (extent-at ,pos nil ',property)))
1007 (if ext (delete-extent ext)))) 988 (if ext (delete-extent ext))))
@@ -1026,8 +1007,10 @@ MODE is either a mode symbol or a list of mode symbols."
1026 ;; `syntax-table'. 1007 ;; `syntax-table'.
1027 ;; 1008 ;;
1028 ;; This macro does hidden buffer changes. 1009 ;; This macro does hidden buffer changes.
1029 (setq property (eval property)) 1010 (if (eq 'quote (car-safe property))
1030 (if c-use-extents 1011 (setq property (nth 1 property))
1012 (error "`property' should be a quoted constant"))
1013 (if (featurep 'xemacs)
1031 ;; XEmacs. 1014 ;; XEmacs.
1032 `(map-extents (lambda (ext ignored) 1015 `(map-extents (lambda (ext ignored)
1033 (delete-extent ext)) 1016 (delete-extent ext))
@@ -1097,7 +1080,7 @@ been put there by c-put-char-property. POINT remains unchanged."
1097which have the value VALUE, as tested by `equal'. These 1080which have the value VALUE, as tested by `equal'. These
1098properties are assumed to be over individual characters, having 1081properties are assumed to be over individual characters, having
1099been put there by c-put-char-property. POINT remains unchanged." 1082been put there by c-put-char-property. POINT remains unchanged."
1100 (if c-use-extents 1083 (if (featurep 'xemacs)
1101 ;; XEmacs 1084 ;; XEmacs
1102 `(let ((-property- ,property)) 1085 `(let ((-property- ,property))
1103 (map-extents (lambda (ext val) 1086 (map-extents (lambda (ext val)
@@ -1561,32 +1544,6 @@ non-nil, a caret is prepended to invert the set."
1561(defconst c-emacs-features 1544(defconst c-emacs-features
1562 (let (list) 1545 (let (list)
1563 1546
1564 (if (boundp 'infodock-version)
1565 ;; I've no idea what this actually is, but it's legacy. /mast
1566 (setq list (cons 'infodock list)))
1567
1568 ;; XEmacs uses 8-bit modify-syntax-entry flags.
1569 ;; Emacs uses a 1-bit flag. We will have to set up our
1570 ;; syntax tables differently to handle this.
1571 (let ((table (copy-syntax-table))
1572 entry)
1573 (modify-syntax-entry ?a ". 12345678" table)
1574 (cond
1575 ;; Emacs
1576 ((arrayp table)
1577 (setq entry (aref table ?a))
1578 ;; In Emacs, table entries are cons cells
1579 (if (consp entry) (setq entry (car entry))))
1580 ;; XEmacs
1581 ((fboundp 'get-char-table)
1582 (setq entry (get-char-table ?a table)))
1583 ;; incompatible
1584 (t (error "CC Mode is incompatible with this version of Emacs")))
1585 (setq list (cons (if (= (logand (lsh entry -16) 255) 255)
1586 '8-bit
1587 '1-bit)
1588 list)))
1589
1590 ;; Check whether beginning/end-of-defun call 1547 ;; Check whether beginning/end-of-defun call
1591 ;; beginning/end-of-defun-function nicely, passing through the 1548 ;; beginning/end-of-defun-function nicely, passing through the
1592 ;; argument and respecting the return code. 1549 ;; argument and respecting the return code.
@@ -1609,35 +1566,12 @@ non-nil, a caret is prepended to invert the set."
1609 (not (end-of-defun)))) 1566 (not (end-of-defun))))
1610 (setq list (cons 'argumentative-bod-function list)))) 1567 (setq list (cons 'argumentative-bod-function list))))
1611 1568
1612 (let ((buf (generate-new-buffer " test")) 1569 (with-temp-buffer
1613 parse-sexp-lookup-properties 1570 (let ((parse-sexp-lookup-properties t)
1614 parse-sexp-ignore-comments 1571 (parse-sexp-ignore-comments t)
1615 lookup-syntax-properties) ; XEmacs 1572 (lookup-syntax-properties t)) ; XEmacs
1616 (with-current-buffer buf
1617 (set-syntax-table (make-syntax-table)) 1573 (set-syntax-table (make-syntax-table))
1618 1574
1619 ;; For some reason we have to set some of these after the
1620 ;; buffer has been made current. (Specifically,
1621 ;; `parse-sexp-ignore-comments' in Emacs 21.)
1622 (setq parse-sexp-lookup-properties t
1623 parse-sexp-ignore-comments t
1624 lookup-syntax-properties t)
1625
1626 ;; Find out if the `syntax-table' text property works.
1627 (modify-syntax-entry ?< ".")
1628 (modify-syntax-entry ?> ".")
1629 (insert "<()>")
1630 (c-mark-<-as-paren (point-min))
1631 (c-mark->-as-paren (+ 3 (point-min)))
1632 (goto-char (point-min))
1633 (c-forward-sexp)
1634 (if (= (point) (+ 4 (point-min)))
1635 (setq list (cons 'syntax-properties list))
1636 (error (concat
1637 "CC Mode is incompatible with this version of Emacs - "
1638 "support for the `syntax-table' text property "
1639 "is required.")))
1640
1641 ;; Find out if generic comment delimiters work. 1575 ;; Find out if generic comment delimiters work.
1642 (c-safe 1576 (c-safe
1643 (modify-syntax-entry ?x "!") 1577 (modify-syntax-entry ?x "!")
@@ -1674,11 +1608,11 @@ non-nil, a caret is prepended to invert the set."
1674 (cond 1608 (cond
1675 ;; XEmacs. Afaik this is currently an Emacs-only 1609 ;; XEmacs. Afaik this is currently an Emacs-only
1676 ;; feature, but it's good to be prepared. 1610 ;; feature, but it's good to be prepared.
1677 ((memq '8-bit list) 1611 ((featurep 'xemacs)
1678 (modify-syntax-entry ?/ ". 1456") 1612 (modify-syntax-entry ?/ ". 1456")
1679 (modify-syntax-entry ?* ". 23")) 1613 (modify-syntax-entry ?* ". 23"))
1680 ;; Emacs 1614 ;; Emacs
1681 ((memq '1-bit list) 1615 (t
1682 (modify-syntax-entry ?/ ". 124b") 1616 (modify-syntax-entry ?/ ". 124b")
1683 (modify-syntax-entry ?* ". 23"))) 1617 (modify-syntax-entry ?* ". 23")))
1684 (modify-syntax-entry ?\n "> b") 1618 (modify-syntax-entry ?\n "> b")
@@ -1687,16 +1621,7 @@ non-nil, a caret is prepended to invert the set."
1687 (if (bobp) 1621 (if (bobp)
1688 (setq list (cons 'col-0-paren list))))) 1622 (setq list (cons 'col-0-paren list)))))
1689 1623
1690 (set-buffer-modified-p nil)) 1624 (set-buffer-modified-p nil)))
1691 (kill-buffer buf))
1692
1693 ;; See if `parse-partial-sexp' returns the eighth element.
1694 (if (c-safe (>= (length (save-excursion (parse-partial-sexp (point) (point))))
1695 10))
1696 (setq list (cons 'pps-extended-state list))
1697 (error (concat
1698 "CC Mode is incompatible with this version of Emacs - "
1699 "`parse-partial-sexp' has to return at least 10 elements.")))
1700 1625
1701 ;;(message "c-emacs-features: %S" list) 1626 ;;(message "c-emacs-features: %S" list)
1702 list) 1627 list)
@@ -1705,29 +1630,16 @@ There are many flavors of Emacs out there, each with different
1705features supporting those needed by CC Mode. The following values 1630features supporting those needed by CC Mode. The following values
1706might be present: 1631might be present:
1707 1632
1708'8-bit 8 bit syntax entry flags (XEmacs style). 1633`argumentative-bod-function' `beginning-of-defun' passes ARG through
1709'1-bit 1 bit syntax entry flags (Emacs style). 1634 to a non-null `beginning-of-defun-function.' It is assumed
1710'argumentative-bod-function beginning-of-defun passes ARG through 1635 that `end-of-defun' does the same thing.
1711 to a non-null beginning-of-defun-function. It is assumed 1636`gen-comment-delim' Generic comment delimiters work
1712 the end-of-defun does the same thing.
1713'syntax-properties It works to override the syntax for specific characters
1714 in the buffer with the 'syntax-table property. It's
1715 always set - CC Mode no longer works in emacsen without
1716 this feature.
1717'gen-comment-delim Generic comment delimiters work
1718 (i.e. the syntax class `!'). 1637 (i.e. the syntax class `!').
1719'gen-string-delim Generic string delimiters work 1638`gen-string-delim' Generic string delimiters work
1720 (i.e. the syntax class `|'). 1639 (i.e. the syntax class `|').
1721'pps-extended-state `parse-partial-sexp' returns a list with at least 10 1640`posix-char-classes' The regexp engine understands POSIX character classes.
1722 elements, i.e. it contains the position of the start of 1641`col-0-paren' It's possible to turn off the ad-hoc rule that a paren
1723 the last comment or string. It's always set - CC Mode 1642 in column zero is the start of a defun.")
1724 no longer works in emacsen without this feature.
1725'posix-char-classes The regexp engine understands POSIX character classes.
1726'col-0-paren It's possible to turn off the ad-hoc rule that a paren
1727 in column zero is the start of a defun.
1728'infodock This is Infodock (based on XEmacs).
1729
1730'8-bit and '1-bit are mutually exclusive.")
1731 1643
1732 1644
1733;;; Some helper constants. 1645;;; Some helper constants.
@@ -2023,11 +1935,6 @@ LANG is the name of the language, i.e. the mode name without the
2023language. NAME and LANG are not evaluated so they should not be 1935language. NAME and LANG are not evaluated so they should not be
2024quoted." 1936quoted."
2025 1937
2026 (or (symbolp name)
2027 (error "Not a symbol: %S" name))
2028 (or (symbolp lang)
2029 (error "Not a symbol: %S" lang))
2030
2031 (let ((sym (intern (symbol-name name) c-lang-constants)) 1938 (let ((sym (intern (symbol-name name) c-lang-constants))
2032 (mode (when lang (intern (concat (symbol-name lang) "-mode"))))) 1939 (mode (when lang (intern (concat (symbol-name lang) "-mode")))))
2033 1940
@@ -2188,57 +2095,56 @@ fallback definition for all modes, to break the cycle).")
2188 value)))) 2095 value))))
2189 2096
2190(defun c-find-assignment-for-mode (source-pos mode match-any-lang _name) 2097(defun c-find-assignment-for-mode (source-pos mode match-any-lang _name)
2191 ;; Find the first assignment entry that applies to MODE at or after 2098 "Find the first assignment entry that applies to MODE at or after
2192 ;; SOURCE-POS. If MATCH-ANY-LANG is non-nil, entries with `t' as 2099SOURCE-POS. If MATCH-ANY-LANG is non-nil, entries with `t' as
2193 ;; the language list are considered to match, otherwise they don't. 2100the language list are considered to match, otherwise they don't.
2194 ;; On return SOURCE-POS is updated to point to the next assignment 2101On return SOURCE-POS is updated to point to the next assignment
2195 ;; after the returned one. If no assignment is found, 2102after the returned one. If no assignment is found,
2196 ;; `c-lang--novalue' is returned as a magic value. 2103`c-lang--novalue' is returned as a magic value.
2197 ;; 2104
2198 ;; SOURCE-POS is a vector that points out a specific assignment in 2105SOURCE-POS is a vector that points out a specific assignment in
2199 ;; the double alist that's used in the `source' property. The first 2106the double alist that's used in the `source' property. The first
2200 ;; element is the position in the top alist which is indexed with 2107element is the position in the top alist which is indexed with
2201 ;; the source files, and the second element is the position in the 2108the source files, and the second element is the position in the
2202 ;; nested bindings alist. 2109nested bindings alist.
2203 ;; 2110
2204 ;; NAME is only used for error messages. 2111NAME is only used for error messages."
2205 2112
2206 (catch 'found 2113 (catch 'found
2207 (let ((file-entry (elt source-pos 0)) 2114 (let ((file-entry (elt source-pos 0))
2208 (assignment-entry (elt source-pos 1)) 2115 (assignment-entry (elt source-pos 1))
2209 assignment) 2116 assignment)
2210 2117
2211 (while (if assignment-entry 2118 (while (or assignment-entry
2212 t 2119 ;; Handled the last assignment from one file, begin on the
2213 ;; Handled the last assignment from one file, begin on the 2120 ;; next. Due to the check in `c-lang-defconst', we know
2214 ;; next. Due to the check in `c-lang-defconst', we know 2121 ;; there's at least one.
2215 ;; there's at least one. 2122 (when file-entry
2216 (when file-entry 2123
2217 2124 (unless (aset source-pos 1
2218 (unless (aset source-pos 1 2125 (setq assignment-entry (cdar file-entry)))
2219 (setq assignment-entry (cdar file-entry))) 2126 ;; The file containing the source definitions has not
2220 ;; The file containing the source definitions has not 2127 ;; been loaded.
2221 ;; been loaded. 2128 (let ((file (symbol-name (caar file-entry)))
2222 (let ((file (symbol-name (caar file-entry))) 2129 (c-lang-constants-under-evaluation nil))
2223 (c-lang-constants-under-evaluation nil)) 2130 ;;(message (concat "Loading %s to get the source "
2224 ;;(message (concat "Loading %s to get the source " 2131 ;; "value for language constant %s")
2225 ;; "value for language constant %s") 2132 ;; file name)
2226 ;; file name) 2133 (load file nil t))
2227 (load file nil t)) 2134
2228 2135 (unless (setq assignment-entry (cdar file-entry))
2229 (unless (setq assignment-entry (cdar file-entry)) 2136 ;; The load didn't fill in the source for the
2230 ;; The load didn't fill in the source for the 2137 ;; constant as expected. The situation is
2231 ;; constant as expected. The situation is 2138 ;; probably that a derived mode was written for
2232 ;; probably that a derived mode was written for 2139 ;; and compiled with another version of CC Mode,
2233 ;; and compiled with another version of CC Mode, 2140 ;; and the requested constant isn't in the
2234 ;; and the requested constant isn't in the 2141 ;; currently loaded one. Put in a dummy
2235 ;; currently loaded one. Put in a dummy 2142 ;; assignment that matches no language.
2236 ;; assignment that matches no language. 2143 (setcdr (car file-entry)
2237 (setcdr (car file-entry) 2144 (setq assignment-entry (list (list nil))))))
2238 (setq assignment-entry (list (list nil)))))) 2145
2239 2146 (aset source-pos 0 (setq file-entry (cdr file-entry)))
2240 (aset source-pos 0 (setq file-entry (cdr file-entry))) 2147 t))
2241 t))
2242 2148
2243 (setq assignment (car assignment-entry)) 2149 (setq assignment (car assignment-entry))
2244 (aset source-pos 1 2150 (aset source-pos 1
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index 9eb95f69c48..ce7797b411a 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -2222,6 +2222,8 @@ comment at the start of cc-engine.el for more info."
2222 ((and (not not-in-delimiter) ; inside a comment starter 2222 ((and (not not-in-delimiter) ; inside a comment starter
2223 (not (bobp)) 2223 (not (bobp))
2224 (progn (backward-char) 2224 (progn (backward-char)
2225 ;; FIXME: We never add category-properties to
2226 ;; c-emacs-features!
2225 (and (not (and (memq 'category-properties c-emacs-features) 2227 (and (not (and (memq 'category-properties c-emacs-features)
2226 (looking-at "\\s!"))) 2228 (looking-at "\\s!")))
2227 (looking-at c-comment-start-regexp)))) 2229 (looking-at c-comment-start-regexp))))
@@ -4119,10 +4121,10 @@ comment at the start of cc-engine.el for more info."
4119 (c-end-of-current-token last-token-end-pos)) 4121 (c-end-of-current-token last-token-end-pos))
4120 (setq last-token-end-pos (point)))))) 4122 (setq last-token-end-pos (point))))))
4121 ;; Inside a token. 4123 ;; Inside a token.
4122 (if lookbehind-submatch 4124 (goto-char (if lookbehind-submatch
4123 ;; See the NOTE above. 4125 ;; See the NOTE above.
4124 (goto-char state-pos) 4126 state-pos
4125 (goto-char (min last-token-end-pos bound)))) 4127 (min last-token-end-pos bound))))
4126 4128
4127 (t 4129 (t
4128 ;; A real match. 4130 ;; A real match.
diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el
index c056091ca46..329e274e912 100644
--- a/lisp/progmodes/cc-fonts.el
+++ b/lisp/progmodes/cc-fonts.el
@@ -201,17 +201,18 @@
201 :version "24.1" 201 :version "24.1"
202 :group 'c) 202 :group 'c)
203 203
204;; This indicates the "font locking context", and is set just before
205;; fontification is done. If non-nil, it says, e.g., point starts
206;; from within a #if preprocessor construct.
207(defvar c-font-lock-context nil)
208(make-variable-buffer-local 'c-font-lock-context)
209(cc-bytecomp-defvar c-font-lock-context)
210
204(eval-and-compile 211(eval-and-compile
205 ;; We need the following definitions during compilation since they're 212 ;; We need the following definitions during compilation since they're
206 ;; used when the `c-lang-defconst' initializers are evaluated. Define 213 ;; used when the `c-lang-defconst' initializers are evaluated. Define
207 ;; them at runtime too for the sake of derived modes. 214 ;; them at runtime too for the sake of derived modes.
208 215
209 ;; This indicates the "font locking context", and is set just before
210 ;; fontification is done. If non-nil, it says, e.g., point starts
211 ;; from within a #if preprocessor construct.
212 (defvar c-font-lock-context nil)
213 (make-variable-buffer-local 'c-font-lock-context)
214
215 (defmacro c-put-font-lock-face (from to face) 216 (defmacro c-put-font-lock-face (from to face)
216 ;; Put a face on a region (overriding any existing face) in the way 217 ;; Put a face on a region (overriding any existing face) in the way
217 ;; font-lock would do it. In XEmacs that means putting an 218 ;; font-lock would do it. In XEmacs that means putting an
@@ -272,18 +273,29 @@
272 (c-got-face-at (point) c-literal-faces)))) 273 (c-got-face-at (point) c-literal-faces))))
273 t)) 274 t))
274 275
276 (defvar c-font-byte-compile t
277 "If non-nil, byte-compile the dynamically-generated functions.")
278
279 (defun c--compile (exp)
280 (cond
281 ((byte-code-function-p exp) (error "Already byte-compiled: %S" exp))
282 ((not (eq (car-safe exp) 'lambda))
283 (error "Expected a (lambda ..): %S" exp))
284 (c-font-byte-compile (byte-compile exp))
285 (t (eval (macroexpand-all exp)))))
286
275 (defun c-make-syntactic-matcher (regexp) 287 (defun c-make-syntactic-matcher (regexp)
276 ;; Returns a byte compiled function suitable for use in place of a 288 "Return a function suitable for use in place of a
277 ;; regexp string in a `font-lock-keywords' matcher, except that 289regexp string in a `font-lock-keywords' matcher, except that
278 ;; only matches outside comments and string literals count. 290only matches outside comments and string literals count.
279 ;; 291
280 ;; This function does not do any hidden buffer changes, but the 292This function does not do any hidden buffer changes, but the
281 ;; generated functions will. (They are however used in places 293generated functions will. (They are however used in places
282 ;; covered by the font-lock context.) 294covered by the font-lock context.)"
283 (byte-compile 295 (c--compile
284 `(lambda (limit) 296 `(lambda (limit)
285 (let (res) 297 (let (res)
286 (while (and (setq res (re-search-forward ,regexp limit t)) 298 (while (and (setq res (re-search-forward ,regexp limit t))
287 (progn 299 (progn
288 (goto-char (match-beginning 0)) 300 (goto-char (match-beginning 0))
289 (or (c-skip-comments-and-strings limit) 301 (or (c-skip-comments-and-strings limit)
@@ -332,34 +344,34 @@
332 highlights)))) 344 highlights))))
333 345
334 (defun c-make-font-lock-search-function (regexp &rest highlights) 346 (defun c-make-font-lock-search-function (regexp &rest highlights)
335 ;; This function makes a byte compiled function that works much like 347 "This function makes a byte compiled function that works much like
336 ;; a matcher element in `font-lock-keywords'. It cuts out a little 348a matcher element in `font-lock-keywords'. It cuts out a little
337 ;; bit of the overhead compared to a real matcher. The main reason 349bit of the overhead compared to a real matcher. The main reason
338 ;; is however to pass the real search limit to the anchored 350is however to pass the real search limit to the anchored
339 ;; matcher(s), since most (if not all) font-lock implementations 351matcher(s), since most (if not all) font-lock implementations
340 ;; arbitrarily limit anchored matchers to the same line, and also 352arbitrarily limit anchored matchers to the same line, and also
341 ;; to insulate against various other irritating differences between 353to insulate against various other irritating differences between
342 ;; the different (X)Emacs font-lock packages. 354the different (X)Emacs font-lock packages.
343 ;; 355
344 ;; REGEXP is the matcher, which must be a regexp. Only matches 356REGEXP is the matcher, which must be a regexp. Only matches
345 ;; where the beginning is outside any comment or string literal are 357where the beginning is outside any comment or string literal are
346 ;; significant. 358significant.
347 ;; 359
348 ;; HIGHLIGHTS is a list of highlight specs, just like in 360HIGHLIGHTS is a list of highlight specs, just like in
349 ;; `font-lock-keywords', with these limitations: The face is always 361`font-lock-keywords', with these limitations: The face is always
350 ;; overridden (no big disadvantage, since hits in comments etc are 362overridden (no big disadvantage, since hits in comments etc are
351 ;; filtered anyway), there is no "laxmatch", and an anchored matcher 363filtered anyway), there is no \"laxmatch\", and an anchored matcher
352 ;; is always a form which must do all the fontification directly. 364is always a form which must do all the fontification directly.
353 ;; `limit' is a variable bound to the real limit in the context of 365`limit' is a variable bound to the real limit in the context of
354 ;; the anchored matcher forms. 366the anchored matcher forms.
355 ;; 367
356 ;; This function does not do any hidden buffer changes, but the 368This function does not do any hidden buffer changes, but the
357 ;; generated functions will. (They are however used in places 369generated functions will. (They are however used in places
358 ;; covered by the font-lock context.) 370covered by the font-lock context.)"
359 371
360 ;; Note: Replace `byte-compile' with `eval' to debug the generated 372 ;; Note: Set c-font-byte-compile to nil to debug the generated
361 ;; lambda more easily. 373 ;; lambda more easily.
362 (byte-compile 374 (c--compile
363 `(lambda (limit) 375 `(lambda (limit)
364 (let ( ;; The font-lock package in Emacs is known to clobber 376 (let ( ;; The font-lock package in Emacs is known to clobber
365 ;; `parse-sexp-lookup-properties' (when it exists). 377 ;; `parse-sexp-lookup-properties' (when it exists).
@@ -402,44 +414,44 @@
402 nil))) 414 nil)))
403 415
404 (defun c-make-font-lock-BO-decl-search-function (regexp &rest highlights) 416 (defun c-make-font-lock-BO-decl-search-function (regexp &rest highlights)
405 ;; This function makes a byte compiled function that first moves back 417 "This function makes a byte compiled function that first moves back
406 ;; to the beginning of the current declaration (if any), then searches 418to the beginning of the current declaration (if any), then searches
407 ;; forward for matcher elements (as in `font-lock-keywords') and 419forward for matcher elements (as in `font-lock-keywords') and
408 ;; fontifies them. 420fontifies them.
409 ;; 421
410 ;; The motivation for moving back to the declaration start is to 422The motivation for moving back to the declaration start is to
411 ;; establish a context for the current text when, e.g., a character 423establish a context for the current text when, e.g., a character
412 ;; is typed on a C++ inheritance continuation line, or a jit-lock 424is typed on a C++ inheritance continuation line, or a jit-lock
413 ;; chunk starts there. 425chunk starts there.
414 ;; 426
415 ;; The new function works much like a matcher element in 427The new function works much like a matcher element in
416 ;; `font-lock-keywords'. It cuts out a little bit of the overhead 428`font-lock-keywords'. It cuts out a little bit of the overhead
417 ;; compared to a real matcher. The main reason is however to pass the 429compared to a real matcher. The main reason is however to pass the
418 ;; real search limit to the anchored matcher(s), since most (if not 430real search limit to the anchored matcher(s), since most (if not
419 ;; all) font-lock implementations arbitrarily limit anchored matchers 431all) font-lock implementations arbitrarily limit anchored matchers
420 ;; to the same line, and also to insulate against various other 432to the same line, and also to insulate against various other
421 ;; irritating differences between the different (X)Emacs font-lock 433irritating differences between the different (X)Emacs font-lock
422 ;; packages. 434packages.
423 ;; 435
424 ;; REGEXP is the matcher, which must be a regexp. Only matches 436REGEXP is the matcher, which must be a regexp. Only matches
425 ;; where the beginning is outside any comment or string literal are 437where the beginning is outside any comment or string literal are
426 ;; significant. 438significant.
427 ;; 439
428 ;; HIGHLIGHTS is a list of highlight specs, just like in 440HIGHLIGHTS is a list of highlight specs, just like in
429 ;; `font-lock-keywords', with these limitations: The face is always 441`font-lock-keywords', with these limitations: The face is always
430 ;; overridden (no big disadvantage, since hits in comments etc are 442overridden (no big disadvantage, since hits in comments etc are
431 ;; filtered anyway), there is no "laxmatch", and an anchored matcher 443filtered anyway), there is no \"laxmatch\", and an anchored matcher
432 ;; is always a form which must do all the fontification directly. 444is always a form which must do all the fontification directly.
433 ;; `limit' is a variable bound to the real limit in the context of 445`limit' is a variable bound to the real limit in the context of
434 ;; the anchored matcher forms. 446the anchored matcher forms.
435 ;; 447
436 ;; This function does not do any hidden buffer changes, but the 448This function does not do any hidden buffer changes, but the
437 ;; generated functions will. (They are however used in places 449generated functions will. (They are however used in places
438 ;; covered by the font-lock context.) 450covered by the font-lock context.)"
439 451
440 ;; Note: Replace `byte-compile' with `eval' to debug the generated 452 ;; Note: Set c-font-byte-compile to nil to debug the generated
441 ;; lambda more easily. 453 ;; lambda more easily.
442 (byte-compile 454 (c--compile
443 `(lambda (limit) 455 `(lambda (limit)
444 (let ( ;; The font-lock package in Emacs is known to clobber 456 (let ( ;; The font-lock package in Emacs is known to clobber
445 ;; `parse-sexp-lookup-properties' (when it exists). 457 ;; `parse-sexp-lookup-properties' (when it exists).
@@ -457,40 +469,40 @@
457 nil))) 469 nil)))
458 470
459 (defun c-make-font-lock-context-search-function (normal &rest state-stanzas) 471 (defun c-make-font-lock-context-search-function (normal &rest state-stanzas)
460 ;; This function makes a byte compiled function that works much like 472 "This function makes a byte compiled function that works much like
461 ;; a matcher element in `font-lock-keywords', with the following 473a matcher element in `font-lock-keywords', with the following
462 ;; enhancement: the generated function will test for particular "font 474enhancement: the generated function will test for particular \"font
463 ;; lock contexts" at the start of the region, i.e. is this point in 475lock contexts\" at the start of the region, i.e. is this point in
464 ;; the middle of some particular construct? if so the generated 476the middle of some particular construct? if so the generated
465 ;; function will first fontify the tail of the construct, before 477function will first fontify the tail of the construct, before
466 ;; going into the main loop and fontify full constructs up to limit. 478going into the main loop and fontify full constructs up to limit.
467 ;; 479
468 ;; The generated function takes one parameter called `limit', and 480The generated function takes one parameter called `limit', and
469 ;; will fontify the region between POINT and LIMIT. 481will fontify the region between POINT and LIMIT.
470 ;; 482
471 ;; NORMAL is a list of the form (REGEXP HIGHLIGHTS .....), and is 483NORMAL is a list of the form (REGEXP HIGHLIGHTS .....), and is
472 ;; used to fontify the "regular" bit of the region. 484used to fontify the \"regular\" bit of the region.
473 ;; STATE-STANZAS is list of elements of the form (STATE LIM REGEXP 485STATE-STANZAS is list of elements of the form (STATE LIM REGEXP
474 ;; HIGHLIGHTS), each element coding one possible font lock context. 486HIGHLIGHTS), each element coding one possible font lock context.
475 487
476 ;; o - REGEXP is a font-lock regular expression (NOT a function), 488o - REGEXP is a font-lock regular expression (NOT a function),
477 ;; o - HIGHLIGHTS is a list of zero or more highlighters as defined 489o - HIGHLIGHTS is a list of zero or more highlighters as defined
478 ;; on page "Search-based Fontification" in the elisp manual. As 490 on page \"Search-based Fontification\" in the elisp manual. As
479 ;; yet (2009-06), they must have OVERRIDE set, and may not have 491 yet (2009-06), they must have OVERRIDE set, and may not have
480 ;; LAXMATCH set. 492 LAXMATCH set.
481 ;; 493
482 ;; o - STATE is the "font lock context" (e.g. in-cpp-expr) and is 494o - STATE is the \"font lock context\" (e.g. in-cpp-expr) and is
483 ;; not quoted. 495 not quoted.
484 ;; o - LIM is a lisp form whose evaluation will yield the limit 496o - LIM is a lisp form whose evaluation will yield the limit
485 ;; position in the buffer for fontification by this stanza. 497 position in the buffer for fontification by this stanza.
486 ;; 498
487 ;; This function does not do any hidden buffer changes, but the 499This function does not do any hidden buffer changes, but the
488 ;; generated functions will. (They are however used in places 500generated functions will. (They are however used in places
489 ;; covered by the font-lock context.) 501covered by the font-lock context.)"
490 ;; 502
491 ;; Note: Replace `byte-compile' with `eval' to debug the generated 503 ;; Note: Set c-font-byte-compile to nil to debug the generated
492 ;; lambda more easily. 504 ;; lambda more easily.
493 (byte-compile 505 (c--compile
494 `(lambda (limit) 506 `(lambda (limit)
495 (let ( ;; The font-lock package in Emacs is known to clobber 507 (let ( ;; The font-lock package in Emacs is known to clobber
496 ;; `parse-sexp-lookup-properties' (when it exists). 508 ;; `parse-sexp-lookup-properties' (when it exists).
@@ -522,10 +534,10 @@
522 (form &rest &or ("quote" (&rest form)) ("`" (&rest form)) form)));)) 534 (form &rest &or ("quote" (&rest form)) ("`" (&rest form)) form)));))
523 535
524(defun c-fontify-recorded-types-and-refs () 536(defun c-fontify-recorded-types-and-refs ()
525 ;; Convert the ranges recorded on `c-record-type-identifiers' and 537 "Convert the ranges recorded on `c-record-type-identifiers' and
526 ;; `c-record-ref-identifiers' to fontification. 538`c-record-ref-identifiers' to fontification.
527 ;; 539
528 ;; This function does hidden buffer changes. 540This function does hidden buffer changes."
529 (let (elem) 541 (let (elem)
530 (while (consp c-record-type-identifiers) 542 (while (consp c-record-type-identifiers)
531 (setq elem (car c-record-type-identifiers) 543 (setq elem (car c-record-type-identifiers)
@@ -581,7 +593,7 @@ stuff. Used on level 1 and higher."
581 593
582 ;; Use an anchored matcher to put paren syntax 594 ;; Use an anchored matcher to put paren syntax
583 ;; on the brackets. 595 ;; on the brackets.
584 (,(byte-compile 596 (,(c--compile
585 `(lambda (limit) 597 `(lambda (limit)
586 (let ((beg (match-beginning 598 (let ((beg (match-beginning
587 ,(+ ncle-depth re-depth sws-depth 1))) 599 ,(+ ncle-depth re-depth sws-depth 1)))
@@ -683,10 +695,10 @@ stuff. Used on level 1 and higher."
683 "\\)") 695 "\\)")
684 `(,(1+ ncle-depth) c-preprocessor-face-name t))) 696 `(,(1+ ncle-depth) c-preprocessor-face-name t)))
685 697
686 (eval . (list ,(c-make-syntactic-matcher 698 (eval . (list ',(c-make-syntactic-matcher
687 (concat noncontinued-line-end 699 (concat noncontinued-line-end
688 (c-lang-const c-opt-cpp-prefix) 700 (c-lang-const c-opt-cpp-prefix)
689 "if\\(n\\)def\\>")) 701 "if\\(n\\)def\\>"))
690 ,(+ ncle-depth 1) 702 ,(+ ncle-depth 1)
691 c-negation-char-face-name 703 c-negation-char-face-name
692 'append)) 704 'append))
@@ -745,11 +757,11 @@ casts and declarations are fontified. Used on level 2 and higher."
745 ;; this, but it doesn't give the control we want since any 757 ;; this, but it doesn't give the control we want since any
746 ;; fontification done inside the function will be 758 ;; fontification done inside the function will be
747 ;; unconditionally overridden. 759 ;; unconditionally overridden.
748 ,(c-make-font-lock-search-function 760 (,(c-make-font-lock-search-function
749 ;; Match a char before the string starter to make 761 ;; Match a char before the string starter to make
750 ;; `c-skip-comments-and-strings' work correctly. 762 ;; `c-skip-comments-and-strings' work correctly.
751 (concat ".\\(" c-string-limit-regexp "\\)") 763 (concat ".\\(" c-string-limit-regexp "\\)")
752 '((c-font-lock-invalid-string))) 764 '((c-font-lock-invalid-string))))
753 765
754 ;; Fontify keyword constants. 766 ;; Fontify keyword constants.
755 ,@(when (c-lang-const c-constant-kwds) 767 ,@(when (c-lang-const c-constant-kwds)
@@ -801,7 +813,8 @@ casts and declarations are fontified. Used on level 2 and higher."
801 (c-backward-syntactic-ws) 813 (c-backward-syntactic-ws)
802 (setq id-end (point)) 814 (setq id-end (point))
803 (< (skip-chars-backward 815 (< (skip-chars-backward
804 ,(c-lang-const c-symbol-chars)) 0)) 816 ,(c-lang-const c-symbol-chars))
817 0))
805 (not (get-text-property (point) 'face))) 818 (not (get-text-property (point) 'face)))
806 (c-put-font-lock-face (point) id-end 819 (c-put-font-lock-face (point) id-end
807 c-reference-face-name) 820 c-reference-face-name)
@@ -809,7 +822,7 @@ casts and declarations are fontified. Used on level 2 and higher."
809 nil 822 nil
810 (goto-char (match-end 0))))) 823 (goto-char (match-end 0)))))
811 824
812 `((,(byte-compile 825 `((,(c--compile
813 ;; Must use a function here since we match longer than 826 ;; Must use a function here since we match longer than
814 ;; we want to move before doing a new search. This is 827 ;; we want to move before doing a new search. This is
815 ;; not necessary for XEmacs since it restarts the 828 ;; not necessary for XEmacs since it restarts the
@@ -1564,9 +1577,7 @@ casts and declarations are fontified. Used on level 2 and higher."
1564 ;; Note that this function won't attempt to fontify beyond the end of the 1577 ;; Note that this function won't attempt to fontify beyond the end of the
1565 ;; current enum block, if any. 1578 ;; current enum block, if any.
1566 (let* ((paren-state (c-parse-state)) 1579 (let* ((paren-state (c-parse-state))
1567 (encl-pos (c-most-enclosing-brace paren-state)) 1580 (encl-pos (c-most-enclosing-brace paren-state)))
1568 (start (point))
1569 )
1570 (when (and 1581 (when (and
1571 encl-pos 1582 encl-pos
1572 (eq (char-after encl-pos) ?\{) 1583 (eq (char-after encl-pos) ?\{)
@@ -1617,17 +1628,16 @@ on level 2 only and so aren't combined with `c-complex-decl-matchers'."
1617 t `(;; Objective-C methods. 1628 t `(;; Objective-C methods.
1618 ,@(when (c-major-mode-is 'objc-mode) 1629 ,@(when (c-major-mode-is 'objc-mode)
1619 `((,(c-lang-const c-opt-method-key) 1630 `((,(c-lang-const c-opt-method-key)
1620 (,(byte-compile 1631 (,(lambda (limit)
1621 (lambda (limit) 1632 (let (;; The font-lock package in Emacs is known to clobber
1622 (let (;; The font-lock package in Emacs is known to clobber 1633 ;; `parse-sexp-lookup-properties' (when it exists).
1623 ;; `parse-sexp-lookup-properties' (when it exists). 1634 (parse-sexp-lookup-properties
1624 (parse-sexp-lookup-properties 1635 (cc-eval-when-compile
1625 (cc-eval-when-compile 1636 (boundp 'parse-sexp-lookup-properties))))
1626 (boundp 'parse-sexp-lookup-properties)))) 1637 (save-restriction
1627 (save-restriction 1638 (narrow-to-region (point-min) limit)
1628 (narrow-to-region (point-min) limit) 1639 (c-font-lock-objc-method)))
1629 (c-font-lock-objc-method))) 1640 nil)
1630 nil))
1631 (goto-char (match-end 1)))))) 1641 (goto-char (match-end 1))))))
1632 1642
1633 ;; Fontify all type names and the identifiers in the 1643 ;; Fontify all type names and the identifiers in the
@@ -1742,7 +1752,7 @@ on level 2 only and so aren't combined with `c-complex-decl-matchers'."
1742 1752
1743 ;; Fontify types preceded by `c-type-prefix-kwds' (e.g. "struct"). 1753 ;; Fontify types preceded by `c-type-prefix-kwds' (e.g. "struct").
1744 ,@(when (c-lang-const c-type-prefix-kwds) 1754 ,@(when (c-lang-const c-type-prefix-kwds)
1745 `((,(byte-compile 1755 `((,(c--compile
1746 `(lambda (limit) 1756 `(lambda (limit)
1747 (c-fontify-types-and-refs 1757 (c-fontify-types-and-refs
1748 ((c-promote-possible-types t) 1758 ((c-promote-possible-types t)
@@ -2295,7 +2305,7 @@ need for `c++-font-lock-extra-types'.")
2295 limit 2305 limit
2296 "[-+]" 2306 "[-+]"
2297 nil 2307 nil
2298 (lambda (match-pos inside-macro) 2308 (lambda (_match-pos _inside-macro)
2299 (forward-char) 2309 (forward-char)
2300 (c-font-lock-objc-method)))) 2310 (c-font-lock-objc-method))))
2301 nil) 2311 nil)
diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el
index 73b75dc671a..daecc45c008 100644
--- a/lisp/progmodes/cc-langs.el
+++ b/lisp/progmodes/cc-langs.el
@@ -153,8 +153,8 @@
153 c-emacs-variable-inits-tail c-emacs-variable-inits)) 153 c-emacs-variable-inits-tail c-emacs-variable-inits))
154 154
155(defmacro c-lang-defvar (var val &optional doc) 155(defmacro c-lang-defvar (var val &optional doc)
156 "Declares the buffer local variable VAR to get the value VAL. VAL is 156 "Declare the buffer local variable VAR to get the value VAL.
157evaluated and assigned at mode initialization. More precisely, VAL is 157VAL is evaluated and assigned at mode initialization. More precisely, VAL is
158evaluated and bound to VAR when the result from the macro 158evaluated and bound to VAR when the result from the macro
159`c-init-language-vars' is evaluated. 159`c-init-language-vars' is evaluated.
160 160
@@ -218,55 +218,54 @@ the evaluated constant value at compile time."
218 ;; Some helper functions used when building the language constants. 218 ;; Some helper functions used when building the language constants.
219 219
220 (defun c-filter-ops (ops opgroup-filter op-filter &optional xlate) 220 (defun c-filter-ops (ops opgroup-filter op-filter &optional xlate)
221 ;; Extract a subset of the operators in the list OPS in a DWIM:ey 221 "Extract a subset of the operators in the list OPS in a DWIM:ey way.
222 ;; way. The return value is a plain list of operators: 222The return value is a plain list of operators:
223 ;; 223
224 ;; OPS either has the structure of `c-operators', is a single 224OPS either has the structure of `c-operators', is a single
225 ;; group in `c-operators', or is a plain list of operators. 225group in `c-operators', or is a plain list of operators.
226 ;; 226
227 ;; OPGROUP-FILTER specifies how to select the operator groups. It 227OPGROUP-FILTER specifies how to select the operator groups. It
228 ;; can be t to choose all groups, a list of group type symbols 228can be t to choose all groups, a list of group type symbols
229 ;; (such as 'prefix) to accept, or a function which will be called 229\(such as 'prefix) to accept, or a function which will be called
230 ;; with the group symbol for each group and should return non-nil 230with the group symbol for each group and should return non-nil
231 ;; if that group is to be included. 231if that group is to be included.
232 ;; 232
233 ;; If XLATE is given, it's a function which is called for each 233If XLATE is given, it's a function which is called for each
234 ;; matching operator and its return value is collected instead. 234matching operator and its return value is collected instead.
235 ;; If it returns a list, the elements are spliced directly into 235If it returns a list, the elements are spliced directly into
236 ;; the final result, which is returned as a list with duplicates 236the final result, which is returned as a list with duplicates
237 ;; removed using `equal'. 237removed using `equal'.
238 ;; 238
239 ;; `c-mode-syntax-table' for the current mode is in effect during 239`c-mode-syntax-table' for the current mode is in effect during
240 ;; the whole procedure. 240the whole procedure."
241 (unless (listp (car-safe ops)) 241 (unless (listp (car-safe ops))
242 (setq ops (list ops))) 242 (setq ops (list ops)))
243 (cond ((eq opgroup-filter t) 243 (let ((opgroup-filter
244 (setq opgroup-filter (lambda (opgroup) t))) 244 (cond ((eq opgroup-filter t) (lambda (opgroup) t))
245 ((not (functionp opgroup-filter)) 245 ((not (functionp opgroup-filter))
246 (setq opgroup-filter `(lambda (opgroup) 246 `(lambda (opgroup) (memq opgroup ',opgroup-filter)))
247 (memq opgroup ',opgroup-filter))))) 247 (t opgroup-filter)))
248 (cond ((eq op-filter t) 248 (op-filter
249 (setq op-filter (lambda (op) t))) 249 (cond ((eq op-filter t) (lambda (op) t))
250 ((stringp op-filter) 250 ((stringp op-filter) `(lambda (op) (string-match ,op-filter op)))
251 (setq op-filter `(lambda (op) 251 (t op-filter))))
252 (string-match ,op-filter op))))) 252 (unless xlate
253 (unless xlate 253 (setq xlate #'identity))
254 (setq xlate 'identity)) 254 (c-with-syntax-table (c-lang-const c-mode-syntax-table)
255 (c-with-syntax-table (c-lang-const c-mode-syntax-table) 255 (cl-delete-duplicates
256 (cl-delete-duplicates 256 (cl-mapcan (lambda (opgroup)
257 (cl-mapcan (lambda (opgroup) 257 (when (if (symbolp (car opgroup))
258 (when (if (symbolp (car opgroup)) 258 (when (funcall opgroup-filter (car opgroup))
259 (when (funcall opgroup-filter (car opgroup)) 259 (setq opgroup (cdr opgroup))
260 (setq opgroup (cdr opgroup)) 260 t)
261 t) 261 t)
262 t) 262 (cl-mapcan (lambda (op)
263 (cl-mapcan (lambda (op) 263 (when (funcall op-filter op)
264 (when (funcall op-filter op) 264 (let ((res (funcall xlate op)))
265 (let ((res (funcall xlate op))) 265 (if (listp res) res (list res)))))
266 (if (listp res) res (list res))))) 266 opgroup)))
267 opgroup))) 267 ops)
268 ops) 268 :test #'equal)))))
269 :test 'equal))))
270 269
271 270
272;;; Various mode specific values that aren't language related. 271;;; Various mode specific values that aren't language related.
@@ -350,16 +349,12 @@ the comment syntax to handle both line style \"//\" and block style
350 ;; all languages now require dual comments, we make this the 349 ;; all languages now require dual comments, we make this the
351 ;; default. 350 ;; default.
352 (cond 351 (cond
353 ;; XEmacs 352 ((featurep 'xemacs)
354 ((memq '8-bit c-emacs-features)
355 (modify-syntax-entry ?/ ". 1456" table) 353 (modify-syntax-entry ?/ ". 1456" table)
356 (modify-syntax-entry ?* ". 23" table)) 354 (modify-syntax-entry ?* ". 23" table))
357 ;; Emacs 355 (t
358 ((memq '1-bit c-emacs-features)
359 (modify-syntax-entry ?/ ". 124b" table) 356 (modify-syntax-entry ?/ ". 124b" table)
360 (modify-syntax-entry ?* ". 23" table)) 357 (modify-syntax-entry ?* ". 23" table)))
361 ;; incompatible
362 (t (error "CC Mode is incompatible with this version of Emacs")))
363 358
364 (modify-syntax-entry ?\n "> b" table) 359 (modify-syntax-entry ?\n "> b" table)
365 ;; Give CR the same syntax as newline, for selective-display 360 ;; Give CR the same syntax as newline, for selective-display
@@ -368,19 +363,19 @@ the comment syntax to handle both line style \"//\" and block style
368(c-lang-defconst c-make-mode-syntax-table 363(c-lang-defconst c-make-mode-syntax-table
369 "Functions that generates the mode specific syntax tables. 364 "Functions that generates the mode specific syntax tables.
370The syntax tables aren't stored directly since they're quite large." 365The syntax tables aren't stored directly since they're quite large."
371 t `(lambda () 366 t (lambda ()
372 (let ((table (make-syntax-table))) 367 (let ((table (make-syntax-table)))
373 (c-populate-syntax-table table) 368 (c-populate-syntax-table table)
374 ;; Mode specific syntaxes. 369 ;; Mode specific syntaxes.
375 ,(cond ((or (c-major-mode-is 'objc-mode) (c-major-mode-is 'java-mode)) 370 (cond ((or (c-major-mode-is 'objc-mode) (c-major-mode-is 'java-mode))
376 ;; Let '@' be part of symbols in ObjC to cope with 371 ;; Let '@' be part of symbols in ObjC to cope with
377 ;; its compiler directives as single keyword tokens. 372 ;; its compiler directives as single keyword tokens.
378 ;; This is then necessary since it's assumed that 373 ;; This is then necessary since it's assumed that
379 ;; every keyword is a single symbol. 374 ;; every keyword is a single symbol.
380 `(modify-syntax-entry ?@ "_" table)) 375 (modify-syntax-entry ?@ "_" table))
381 ((c-major-mode-is 'pike-mode) 376 ((c-major-mode-is 'pike-mode)
382 `(modify-syntax-entry ?@ "." table))) 377 (modify-syntax-entry ?@ "." table)))
383 table))) 378 table)))
384 379
385(c-lang-defconst c-mode-syntax-table 380(c-lang-defconst c-mode-syntax-table
386 ;; The syntax tables in evaluated form. Only used temporarily when 381 ;; The syntax tables in evaluated form. Only used temporarily when
@@ -398,8 +393,8 @@ The syntax tables aren't stored directly since they're quite large."
398 ;; CALLED!!! 393 ;; CALLED!!!
399 t nil 394 t nil
400 (java c++) `(lambda () 395 (java c++) `(lambda ()
401 (let ((table (funcall ,(c-lang-const c-make-mode-syntax-table)))) 396 (let ((table (funcall ,(c-lang-const c-make-mode-syntax-table))))
402 (modify-syntax-entry ?< "(>" table) 397 (modify-syntax-entry ?< "(>" table)
403 (modify-syntax-entry ?> ")<" table) 398 (modify-syntax-entry ?> ")<" table)
404 table))) 399 table)))
405(c-lang-defvar c++-template-syntax-table 400(c-lang-defvar c++-template-syntax-table
@@ -419,9 +414,9 @@ The syntax tables aren't stored directly since they're quite large."
419 (let ((table (funcall ,(c-lang-const c-make-mode-syntax-table)))) 414 (let ((table (funcall ,(c-lang-const c-make-mode-syntax-table))))
420 (modify-syntax-entry ?\( "." table) 415 (modify-syntax-entry ?\( "." table)
421 (modify-syntax-entry ?\) "." table) 416 (modify-syntax-entry ?\) "." table)
422 (modify-syntax-entry ?\[ "." table) 417 (modify-syntax-entry ?\[ "." table)
423 (modify-syntax-entry ?\] "." table) 418 (modify-syntax-entry ?\] "." table)
424 (modify-syntax-entry ?\{ "." table) 419 (modify-syntax-entry ?\{ "." table)
425 (modify-syntax-entry ?\} "." table) 420 (modify-syntax-entry ?\} "." table)
426 table)))) 421 table))))
427(c-lang-defvar c-no-parens-syntax-table 422(c-lang-defvar c-no-parens-syntax-table
@@ -1142,7 +1137,8 @@ operators."
1142 c++ (append '("&" "<%" "%>" "<:" ":>" "%:" "%:%:") 1137 c++ (append '("&" "<%" "%>" "<:" ":>" "%:" "%:%:")
1143 (c-lang-const c-other-op-syntax-tokens)) 1138 (c-lang-const c-other-op-syntax-tokens))
1144 objc (append '("#" "##" ; Used by cpp. 1139 objc (append '("#" "##" ; Used by cpp.
1145 "+" "-") (c-lang-const c-other-op-syntax-tokens)) 1140 "+" "-")
1141 (c-lang-const c-other-op-syntax-tokens))
1146 idl (append '("#" "##") ; Used by cpp. 1142 idl (append '("#" "##") ; Used by cpp.
1147 (c-lang-const c-other-op-syntax-tokens)) 1143 (c-lang-const c-other-op-syntax-tokens))
1148 pike (append '("..") 1144 pike (append '("..")
@@ -2469,27 +2465,24 @@ Note that Java specific rules are currently applied to tell this from
2469 2465
2470;; Note: No `*-kwds' language constants may be defined below this point. 2466;; Note: No `*-kwds' language constants may be defined below this point.
2471 2467
2472(eval-and-compile 2468(defconst c-kwds-lang-consts
2473 (defconst c-kwds-lang-consts 2469 ;; List of all the language constants that contain keyword lists.
2474 ;; List of all the language constants that contain keyword lists. 2470 (let (list)
2475 (let (list) 2471 (mapatoms (lambda (sym)
2476 (mapatoms (lambda (sym) 2472 (when (and ;; (boundp sym)
2477 (when (and (boundp sym) 2473 (string-match "-kwds\\'" (symbol-name sym)))
2478 (string-match "-kwds\\'" (symbol-name sym))) 2474 ;; Make the list of globally interned symbols
2479 ;; Make the list of globally interned symbols 2475 ;; instead of ones interned in `c-lang-constants'.
2480 ;; instead of ones interned in `c-lang-constants'. 2476 (setq list (cons (intern (symbol-name sym)) list))))
2481 (setq list (cons (intern (symbol-name sym)) list)))) 2477 c-lang-constants)
2482 c-lang-constants) 2478 list))
2483 list)))
2484 2479
2485(c-lang-defconst c-keywords 2480(c-lang-defconst c-keywords
2486 ;; All keywords as a list. 2481 ;; All keywords as a list.
2487 t (cl-delete-duplicates 2482 t (cl-delete-duplicates
2488 (c-lang-defconst-eval-immediately 2483 (apply #'append (mapcar (lambda (kwds-lang-const)
2489 `(append ,@(mapcar (lambda (kwds-lang-const) 2484 (c-get-lang-constant kwds-lang-const))
2490 `(c-lang-const ,kwds-lang-const)) 2485 c-kwds-lang-consts))
2491 c-kwds-lang-consts)
2492 nil))
2493 :test 'string-equal)) 2486 :test 'string-equal))
2494 2487
2495(c-lang-defconst c-keywords-regexp 2488(c-lang-defconst c-keywords-regexp
@@ -2501,18 +2494,10 @@ Note that Java specific rules are currently applied to tell this from
2501 ;; An alist with all the keywords in the cars. The cdr for each 2494 ;; An alist with all the keywords in the cars. The cdr for each
2502 ;; keyword is a list of the symbols for the `*-kwds' lists that 2495 ;; keyword is a list of the symbols for the `*-kwds' lists that
2503 ;; contains it. 2496 ;; contains it.
2504 t (let ((kwd-list-alist 2497 t (let (kwd-list kwd
2505 (c-lang-defconst-eval-immediately
2506 `(list ,@(mapcar (lambda (kwds-lang-const)
2507 `(cons ',kwds-lang-const
2508 (c-lang-const ,kwds-lang-const)))
2509 c-kwds-lang-consts))))
2510 lang-const kwd-list kwd
2511 result-alist elem) 2498 result-alist elem)
2512 (while kwd-list-alist 2499 (dolist (lang-const c-kwds-lang-consts)
2513 (setq lang-const (caar kwd-list-alist) 2500 (setq kwd-list (c-get-lang-constant lang-const))
2514 kwd-list (cdar kwd-list-alist)
2515 kwd-list-alist (cdr kwd-list-alist))
2516 (while kwd-list 2501 (while kwd-list
2517 (setq kwd (car kwd-list) 2502 (setq kwd (car kwd-list)
2518 kwd-list (cdr kwd-list)) 2503 kwd-list (cdr kwd-list))
@@ -2598,12 +2583,13 @@ Note that Java specific rules are currently applied to tell this from
2598 right-assoc-sequence) 2583 right-assoc-sequence)
2599 t)) 2584 t))
2600 2585
2601 (unambiguous-prefix-ops (set-difference nonkeyword-prefix-ops 2586 ;; (unambiguous-prefix-ops (cl-set-difference nonkeyword-prefix-ops
2602 in-or-postfix-ops 2587 ;; in-or-postfix-ops
2603 :test 'string-equal)) 2588 ;; :test 'string-equal))
2604 (ambiguous-prefix-ops (intersection nonkeyword-prefix-ops 2589 ;; (ambiguous-prefix-ops (cl-intersection nonkeyword-prefix-ops
2605 in-or-postfix-ops 2590 ;; in-or-postfix-ops
2606 :test 'string-equal))) 2591 ;; :test 'string-equal))
2592 )
2607 2593
2608 (concat 2594 (concat
2609 "\\(" 2595 "\\("
diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el
index 1ce076734ff..7eca7e562ea 100644
--- a/lisp/progmodes/cc-mode.el
+++ b/lisp/progmodes/cc-mode.el
@@ -95,14 +95,9 @@
95(cc-require 'cc-menus) 95(cc-require 'cc-menus)
96(cc-require 'cc-guess) 96(cc-require 'cc-guess)
97 97
98;; Silence the compiler.
99(cc-bytecomp-defvar adaptive-fill-first-line-regexp) ; Emacs
100(cc-bytecomp-defun run-mode-hooks) ; Emacs 21.1
101
102;; We set these variables during mode init, yet we don't require 98;; We set these variables during mode init, yet we don't require
103;; font-lock. 99;; font-lock.
104(cc-bytecomp-defvar font-lock-defaults) 100(defvar font-lock-defaults)
105(cc-bytecomp-defvar font-lock-syntactic-keywords)
106 101
107;; Menu support for both XEmacs and Emacs. If you don't have easymenu 102;; Menu support for both XEmacs and Emacs. If you don't have easymenu
108;; with your version of Emacs, you are incompatible! 103;; with your version of Emacs, you are incompatible!
@@ -552,11 +547,8 @@ that requires a literal mode spec at compile time."
552 ;; heuristic that open parens in column 0 are defun starters. Since 547 ;; heuristic that open parens in column 0 are defun starters. Since
553 ;; we have c-state-cache, that heuristic isn't useful and only causes 548 ;; we have c-state-cache, that heuristic isn't useful and only causes
554 ;; trouble, so turn it off. 549 ;; trouble, so turn it off.
555;; 2006/12/17: This facility is somewhat confused, and doesn't really seem 550 (when (memq 'col-0-paren c-emacs-features)
556;; helpful. Comment it out for now. 551 (set (make-local-variable 'open-paren-in-column-0-is-defun-start) nil))
557;; (when (memq 'col-0-paren c-emacs-features)
558;; (make-local-variable 'open-paren-in-column-0-is-defun-start)
559;; (setq open-paren-in-column-0-is-defun-start nil))
560 552
561 (c-clear-found-types) 553 (c-clear-found-types)
562 554
@@ -816,7 +808,7 @@ Note that the style variables are always made local to the buffer."
816(defmacro c-run-mode-hooks (&rest hooks) 808(defmacro c-run-mode-hooks (&rest hooks)
817 ;; Emacs 21.1 has introduced a system with delayed mode hooks that 809 ;; Emacs 21.1 has introduced a system with delayed mode hooks that
818 ;; requires the use of the new function `run-mode-hooks'. 810 ;; requires the use of the new function `run-mode-hooks'.
819 (if (cc-bytecomp-fboundp 'run-mode-hooks) 811 (if (fboundp 'run-mode-hooks)
820 `(run-mode-hooks ,@hooks) 812 `(run-mode-hooks ,@hooks)
821 `(progn ,@(mapcar (lambda (hook) `(run-hooks ,hook)) hooks)))) 813 `(progn ,@(mapcar (lambda (hook) `(run-hooks ,hook)) hooks))))
822 814
@@ -1232,8 +1224,8 @@ This function is called from `c-common-init', once per mode initialization."
1232 (font-lock-mark-block-function 1224 (font-lock-mark-block-function
1233 . c-mark-function))) 1225 . c-mark-function)))
1234 1226
1235 (make-local-variable 'font-lock-fontify-region-function) 1227 (set (make-local-variable 'font-lock-fontify-region-function)
1236 (setq font-lock-fontify-region-function 'c-font-lock-fontify-region) 1228 #'c-font-lock-fontify-region)
1237 1229
1238 (if (featurep 'xemacs) 1230 (if (featurep 'xemacs)
1239 (make-local-hook 'font-lock-mode-hook)) 1231 (make-local-hook 'font-lock-mode-hook))