diff options
| -rw-r--r-- | lisp/ChangeLog | 31 | ||||
| -rw-r--r-- | lisp/progmodes/cc-mode.el | 53 |
2 files changed, 69 insertions, 15 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e72ca752ebe..4d2f0ecee05 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,34 @@ | |||
| 1 | 2003-08-03 Martin Stjernholm <bug-cc-mode@gnu.org> | ||
| 2 | |||
| 3 | * progmodes/cc-mode.el (c-init-language-vars-for): Add argument | ||
| 4 | MODE. Renamed from c-init-c-language-vars'. | ||
| 5 | (c-initialize-cc-mode): Change accordingly. | ||
| 6 | (c-common-init): Ditto. | ||
| 7 | (c-mode): Ditto. | ||
| 8 | (c++-mode): Use function. | ||
| 9 | (objc-mode): Ditto. | ||
| 10 | (java-mode): Ditto. | ||
| 11 | (idl-mode): Ditto. | ||
| 12 | (pike-mode): Ditto. | ||
| 13 | (awk-mode): Ditto. | ||
| 14 | |||
| 15 | 2003-08-03 Martin Stjernholm <bug-cc-mode@gnu.org> | ||
| 16 | |||
| 17 | * progmodes/cc-engine.el (c-end-of-current-token): Return whether | ||
| 18 | or not the point moved. | ||
| 19 | |||
| 20 | (c-search-decl-header-end): Don't trip up on operator identifiers | ||
| 21 | in C++ and operators like == in all languages. | ||
| 22 | |||
| 23 | * progmodes/cc-engine.el (c-backward-to-decl-anchor): Detect | ||
| 24 | leading labels correctly. | ||
| 25 | |||
| 26 | 2003-08-03 Martin Stjernholm <bug-cc-mode@gnu.org> | ||
| 27 | |||
| 28 | * progmodes/cc-defs.el (c-langelem-sym, c-langelem-pos, | ||
| 29 | c-langelem-2nd-pos): Added accessor functions for syntactic | ||
| 30 | elements. | ||
| 31 | |||
| 1 | 2003-08-02 Andreas Schwab <schwab@suse.de> | 32 | 2003-08-02 Andreas Schwab <schwab@suse.de> |
| 2 | 33 | ||
| 3 | * textmodes/ispell.el: Don't redo key bindings on loading, put | 34 | * textmodes/ispell.el: Don't redo key bindings on loading, put |
diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el index 69bf72b258e..67ec33defbf 100644 --- a/lisp/progmodes/cc-mode.el +++ b/lisp/progmodes/cc-mode.el | |||
| @@ -128,6 +128,16 @@ | |||
| 128 | ;; (c-init-language-vars some-mode) | 128 | ;; (c-init-language-vars some-mode) |
| 129 | ;; (c-common-init 'some-mode) ; Or perhaps (c-basic-common-init 'some-mode) | 129 | ;; (c-common-init 'some-mode) ; Or perhaps (c-basic-common-init 'some-mode) |
| 130 | ;; | 130 | ;; |
| 131 | ;; If you're not writing a derived mode using the language variable | ||
| 132 | ;; system, then some-mode is one of the language modes directly | ||
| 133 | ;; supported by CC Mode. You can then use (c-init-language-vars-for | ||
| 134 | ;; 'some-mode) instead of `c-init-language-vars'. | ||
| 135 | ;; `c-init-language-vars-for' is a function that avoids the rather | ||
| 136 | ;; large expansion of `c-init-language-vars'. | ||
| 137 | ;; | ||
| 138 | ;; If you use `c-basic-common-init' then you might want to call | ||
| 139 | ;; `c-font-lock-init' too to set up CC Mode's font lock support. | ||
| 140 | ;; | ||
| 131 | ;; See cc-langs.el for further info. A small example of a derived mode | 141 | ;; See cc-langs.el for further info. A small example of a derived mode |
| 132 | ;; is also available at <http://cc-mode.sourceforge.net/ | 142 | ;; is also available at <http://cc-mode.sourceforge.net/ |
| 133 | ;; derived-mode-ex.el>. | 143 | ;; derived-mode-ex.el>. |
| @@ -135,14 +145,30 @@ | |||
| 135 | (defun c-leave-cc-mode-mode () | 145 | (defun c-leave-cc-mode-mode () |
| 136 | (setq c-buffer-is-cc-mode nil)) | 146 | (setq c-buffer-is-cc-mode nil)) |
| 137 | 147 | ||
| 148 | (defun c-init-language-vars-for (mode) | ||
| 149 | "Initialize the language variables for one of the language modes | ||
| 150 | directly supported by CC Mode. This can be used instead of the | ||
| 151 | `c-init-language-vars' macro if the language you want to use is one of | ||
| 152 | those, rather than a derived language defined through the language | ||
| 153 | variable system (see \"cc-langs.el\")." | ||
| 154 | ;; This function does not do any hidden buffer changes. | ||
| 155 | (cond ((eq mode 'c-mode) (c-init-language-vars c-mode)) | ||
| 156 | ((eq mode 'c++-mode) (c-init-language-vars c++-mode)) | ||
| 157 | ((eq mode 'objc-mode) (c-init-language-vars objc-mode)) | ||
| 158 | ((eq mode 'java-mode) (c-init-language-vars java-mode)) | ||
| 159 | ((eq mode 'idl-mode) (c-init-language-vars idl-mode)) | ||
| 160 | ((eq mode 'pike-mode) (c-init-language-vars pike-mode)) | ||
| 161 | ((eq mode 'awk-mode) (c-init-language-vars awk-mode)) | ||
| 162 | (t (error "Unsupported mode %s" mode)))) | ||
| 163 | |||
| 138 | ;;;###autoload | 164 | ;;;###autoload |
| 139 | (defun c-initialize-cc-mode (&optional new-style-init) | 165 | (defun c-initialize-cc-mode (&optional new-style-init) |
| 140 | "Initialize CC Mode for use in the current buffer. | 166 | "Initialize CC Mode for use in the current buffer. |
| 141 | If the optional NEW-STYLE-INIT is nil or left out then all necessary | 167 | If the optional NEW-STYLE-INIT is nil or left out then all necessary |
| 142 | initialization to run CC Mode for the C language is done. Otherwise | 168 | initialization to run CC Mode for the C language is done. Otherwise |
| 143 | only some basic setup is done, and a call to `c-init-language-vars', | 169 | only some basic setup is done, and a call to `c-init-language-vars' or |
| 144 | is necessary too (which gives more control). See \"cc-mode.el\" for | 170 | `c-init-language-vars-for' is necessary too (which gives more |
| 145 | more info." | 171 | control). See \"cc-mode.el\" for more info." |
| 146 | ;; | 172 | ;; |
| 147 | ;; This function does not do any hidden buffer changes. | 173 | ;; This function does not do any hidden buffer changes. |
| 148 | 174 | ||
| @@ -165,7 +191,7 @@ more info." | |||
| 165 | (put 'c-initialize-cc-mode initprop c-initialization-ok)))) | 191 | (put 'c-initialize-cc-mode initprop c-initialization-ok)))) |
| 166 | 192 | ||
| 167 | (unless new-style-init | 193 | (unless new-style-init |
| 168 | (c-init-c-language-vars))) | 194 | (c-init-language-vars-for 'c-mode))) |
| 169 | 195 | ||
| 170 | 196 | ||
| 171 | ;;; Common routines. | 197 | ;;; Common routines. |
| @@ -519,7 +545,7 @@ This function does not do any hidden buffer changes." | |||
| 519 | (unless mode | 545 | (unless mode |
| 520 | ;; Called from an old third party package. The fallback is to | 546 | ;; Called from an old third party package. The fallback is to |
| 521 | ;; initialize for C. | 547 | ;; initialize for C. |
| 522 | (c-init-c-language-vars)) | 548 | (c-init-language-vars-for 'c-mode)) |
| 523 | 549 | ||
| 524 | (c-basic-common-init mode c-default-style) | 550 | (c-basic-common-init mode c-default-style) |
| 525 | (when mode | 551 | (when mode |
| @@ -615,9 +641,6 @@ Note that the style variables are always made local to the buffer." | |||
| 615 | ;;;###autoload (add-to-list 'auto-mode-alist '("\\.y\\(acc\\)?\\'" . c-mode)) | 641 | ;;;###autoload (add-to-list 'auto-mode-alist '("\\.y\\(acc\\)?\\'" . c-mode)) |
| 616 | ;;;###autoload (add-to-list 'auto-mode-alist '("\\.lex\\'" . c-mode)) | 642 | ;;;###autoload (add-to-list 'auto-mode-alist '("\\.lex\\'" . c-mode)) |
| 617 | 643 | ||
| 618 | (defun c-init-c-language-vars () | ||
| 619 | (c-init-language-vars c-mode)) | ||
| 620 | |||
| 621 | ;;;###autoload | 644 | ;;;###autoload |
| 622 | (defun c-mode () | 645 | (defun c-mode () |
| 623 | "Major mode for editing K&R and ANSI C code. | 646 | "Major mode for editing K&R and ANSI C code. |
| @@ -642,7 +665,7 @@ Key bindings: | |||
| 642 | local-abbrev-table c-mode-abbrev-table | 665 | local-abbrev-table c-mode-abbrev-table |
| 643 | abbrev-mode t) | 666 | abbrev-mode t) |
| 644 | (use-local-map c-mode-map) | 667 | (use-local-map c-mode-map) |
| 645 | (c-init-c-language-vars) | 668 | (c-init-language-vars-for 'c-mode) |
| 646 | (c-common-init 'c-mode) | 669 | (c-common-init 'c-mode) |
| 647 | (easy-menu-add c-c-menu) | 670 | (easy-menu-add c-c-menu) |
| 648 | (cc-imenu-init cc-imenu-c-generic-expression) | 671 | (cc-imenu-init cc-imenu-c-generic-expression) |
| @@ -706,7 +729,7 @@ Key bindings: | |||
| 706 | local-abbrev-table c++-mode-abbrev-table | 729 | local-abbrev-table c++-mode-abbrev-table |
| 707 | abbrev-mode t) | 730 | abbrev-mode t) |
| 708 | (use-local-map c++-mode-map) | 731 | (use-local-map c++-mode-map) |
| 709 | (c-init-language-vars c++-mode) | 732 | (c-init-language-vars-for 'c++-mode) |
| 710 | (c-common-init 'c++-mode) | 733 | (c-common-init 'c++-mode) |
| 711 | (easy-menu-add c-c++-menu) | 734 | (easy-menu-add c-c++-menu) |
| 712 | (cc-imenu-init cc-imenu-c++-generic-expression) | 735 | (cc-imenu-init cc-imenu-c++-generic-expression) |
| @@ -771,7 +794,7 @@ Key bindings: | |||
| 771 | ;; end of the @-style directives. | 794 | ;; end of the @-style directives. |
| 772 | (setq c-type-decl-end-used t) | 795 | (setq c-type-decl-end-used t) |
| 773 | (use-local-map objc-mode-map) | 796 | (use-local-map objc-mode-map) |
| 774 | (c-init-language-vars objc-mode) | 797 | (c-init-language-vars-for 'objc-mode) |
| 775 | (c-common-init 'objc-mode) | 798 | (c-common-init 'objc-mode) |
| 776 | (easy-menu-add c-objc-menu) | 799 | (easy-menu-add c-objc-menu) |
| 777 | (cc-imenu-init nil 'cc-imenu-objc-function) | 800 | (cc-imenu-init nil 'cc-imenu-objc-function) |
| @@ -842,7 +865,7 @@ Key bindings: | |||
| 842 | local-abbrev-table java-mode-abbrev-table | 865 | local-abbrev-table java-mode-abbrev-table |
| 843 | abbrev-mode t) | 866 | abbrev-mode t) |
| 844 | (use-local-map java-mode-map) | 867 | (use-local-map java-mode-map) |
| 845 | (c-init-language-vars java-mode) | 868 | (c-init-language-vars-for 'java-mode) |
| 846 | (c-common-init 'java-mode) | 869 | (c-common-init 'java-mode) |
| 847 | (easy-menu-add c-java-menu) | 870 | (easy-menu-add c-java-menu) |
| 848 | (cc-imenu-init cc-imenu-java-generic-expression) | 871 | (cc-imenu-init cc-imenu-java-generic-expression) |
| @@ -901,7 +924,7 @@ Key bindings: | |||
| 901 | mode-name "IDL" | 924 | mode-name "IDL" |
| 902 | local-abbrev-table idl-mode-abbrev-table) | 925 | local-abbrev-table idl-mode-abbrev-table) |
| 903 | (use-local-map idl-mode-map) | 926 | (use-local-map idl-mode-map) |
| 904 | (c-init-language-vars idl-mode) | 927 | (c-init-language-vars-for 'idl-mode) |
| 905 | (c-common-init 'idl-mode) | 928 | (c-common-init 'idl-mode) |
| 906 | (easy-menu-add c-idl-menu) | 929 | (easy-menu-add c-idl-menu) |
| 907 | ;;(cc-imenu-init cc-imenu-idl-generic-expression) ;TODO | 930 | ;;(cc-imenu-init cc-imenu-idl-generic-expression) ;TODO |
| @@ -964,7 +987,7 @@ Key bindings: | |||
| 964 | local-abbrev-table pike-mode-abbrev-table | 987 | local-abbrev-table pike-mode-abbrev-table |
| 965 | abbrev-mode t) | 988 | abbrev-mode t) |
| 966 | (use-local-map pike-mode-map) | 989 | (use-local-map pike-mode-map) |
| 967 | (c-init-language-vars pike-mode) | 990 | (c-init-language-vars-for 'pike-mode) |
| 968 | (c-common-init 'pike-mode) | 991 | (c-common-init 'pike-mode) |
| 969 | (easy-menu-add c-pike-menu) | 992 | (easy-menu-add c-pike-menu) |
| 970 | ;;(cc-imenu-init cc-imenu-pike-generic-expression) ;TODO | 993 | ;;(cc-imenu-init cc-imenu-pike-generic-expression) ;TODO |
| @@ -1039,7 +1062,7 @@ Key bindings: | |||
| 1039 | local-abbrev-table awk-mode-abbrev-table | 1062 | local-abbrev-table awk-mode-abbrev-table |
| 1040 | abbrev-mode t) | 1063 | abbrev-mode t) |
| 1041 | (use-local-map awk-mode-map) | 1064 | (use-local-map awk-mode-map) |
| 1042 | (c-init-language-vars awk-mode) | 1065 | (c-init-language-vars-for 'awk-mode) |
| 1043 | (c-common-init 'awk-mode) | 1066 | (c-common-init 'awk-mode) |
| 1044 | ;; The rest of CC Mode does not (yet) use `font-lock-syntactic-keywords', | 1067 | ;; The rest of CC Mode does not (yet) use `font-lock-syntactic-keywords', |
| 1045 | ;; so it's not set by `c-font-lock-init'. | 1068 | ;; so it's not set by `c-font-lock-init'. |