]> git.eshelyaron.com Git - emacs.git/commitdiff
2003-08-03 Martin Stjernholm <bug-cc-mode@gnu.org>
authorMartin Stjernholm <mast@lysator.liu.se>
Sun, 3 Aug 2003 12:31:46 +0000 (12:31 +0000)
committerMartin Stjernholm <mast@lysator.liu.se>
Sun, 3 Aug 2003 12:31:46 +0000 (12:31 +0000)
* cc-mode.el (c-init-language-vars-for): Add argument MODE.
Renamed from c-init-c-language-vars'.
(c-initialize-cc-mode): Change accordingly.
(c-common-init): Ditto.
(c-mode): Ditto.
(c++-mode): Use function.
(objc-mode): Ditto.
(java-mode): Ditto.
(idl-mode): Ditto.
(pike-mode): Ditto.
(awk-mode): Ditto.

lisp/ChangeLog
lisp/progmodes/cc-mode.el

index e72ca752ebed85493ee35ae1c912575e3c3447ef..4d2f0ecee05b9b04154819258484bbda2db30dc3 100644 (file)
@@ -1,3 +1,34 @@
+2003-08-03  Martin Stjernholm  <bug-cc-mode@gnu.org>
+
+       * progmodes/cc-mode.el (c-init-language-vars-for): Add argument
+       MODE.  Renamed from c-init-c-language-vars'.
+       (c-initialize-cc-mode): Change accordingly.
+       (c-common-init): Ditto.
+       (c-mode): Ditto.
+       (c++-mode): Use function.
+       (objc-mode): Ditto.
+       (java-mode): Ditto.
+       (idl-mode): Ditto.
+       (pike-mode): Ditto.
+       (awk-mode): Ditto.
+
+2003-08-03  Martin Stjernholm  <bug-cc-mode@gnu.org>
+
+       * progmodes/cc-engine.el (c-end-of-current-token): Return whether
+       or not the point moved.
+
+       (c-search-decl-header-end): Don't trip up on operator identifiers
+       in C++ and operators like == in all languages.
+
+       * progmodes/cc-engine.el (c-backward-to-decl-anchor): Detect
+       leading labels correctly.
+
+2003-08-03  Martin Stjernholm  <bug-cc-mode@gnu.org>
+
+       * progmodes/cc-defs.el (c-langelem-sym, c-langelem-pos,
+       c-langelem-2nd-pos): Added accessor functions for syntactic
+       elements.
+
 2003-08-02  Andreas Schwab  <schwab@suse.de>
 
        * textmodes/ispell.el: Don't redo key bindings on loading, put
index 69bf72b258e9a5db66b87b6c75081d3b07c0f96d..67ec33defbfe3a945c0ed77dee408e6d78181ad2 100644 (file)
 ;; (c-init-language-vars some-mode)
 ;; (c-common-init 'some-mode) ; Or perhaps (c-basic-common-init 'some-mode)
 ;;
+;; If you're not writing a derived mode using the language variable
+;; system, then some-mode is one of the language modes directly
+;; supported by CC Mode.  You can then use (c-init-language-vars-for
+;; 'some-mode) instead of `c-init-language-vars'.
+;; `c-init-language-vars-for' is a function that avoids the rather
+;; large expansion of `c-init-language-vars'.
+;;
+;; If you use `c-basic-common-init' then you might want to call
+;; `c-font-lock-init' too to set up CC Mode's font lock support.
+;;
 ;; See cc-langs.el for further info.  A small example of a derived mode
 ;; is also available at <http://cc-mode.sourceforge.net/
 ;; derived-mode-ex.el>.
 (defun c-leave-cc-mode-mode ()
   (setq c-buffer-is-cc-mode nil))
 
+(defun c-init-language-vars-for (mode)
+  "Initialize the language variables for one of the language modes
+directly supported by CC Mode.  This can be used instead of the
+`c-init-language-vars' macro if the language you want to use is one of
+those, rather than a derived language defined through the language
+variable system (see \"cc-langs.el\")."
+  ;; This function does not do any hidden buffer changes.
+  (cond ((eq mode 'c-mode)    (c-init-language-vars c-mode))
+       ((eq mode 'c++-mode)  (c-init-language-vars c++-mode))
+       ((eq mode 'objc-mode) (c-init-language-vars objc-mode))
+       ((eq mode 'java-mode) (c-init-language-vars java-mode))
+       ((eq mode 'idl-mode)  (c-init-language-vars idl-mode))
+       ((eq mode 'pike-mode) (c-init-language-vars pike-mode))
+       ((eq mode 'awk-mode)  (c-init-language-vars awk-mode))
+       (t (error "Unsupported mode %s" mode))))
+
 ;;;###autoload
 (defun c-initialize-cc-mode (&optional new-style-init)
   "Initialize CC Mode for use in the current buffer.
 If the optional NEW-STYLE-INIT is nil or left out then all necessary
 initialization to run CC Mode for the C language is done.  Otherwise
-only some basic setup is done, and a call to `c-init-language-vars',
-is necessary too (which gives more control).  See \"cc-mode.el\" for
-more info."
+only some basic setup is done, and a call to `c-init-language-vars' or
+`c-init-language-vars-for' is necessary too (which gives more
+control).  See \"cc-mode.el\" for more info."
   ;;
   ;; This function does not do any hidden buffer changes.
 
@@ -165,7 +191,7 @@ more info."
        (put 'c-initialize-cc-mode initprop c-initialization-ok))))
 
   (unless new-style-init
-    (c-init-c-language-vars)))
+    (c-init-language-vars-for 'c-mode)))
 
 \f
 ;;; Common routines.
@@ -519,7 +545,7 @@ This function does not do any hidden buffer changes."
   (unless mode
     ;; Called from an old third party package.  The fallback is to
     ;; initialize for C.
-    (c-init-c-language-vars))
+    (c-init-language-vars-for 'c-mode))
 
   (c-basic-common-init mode c-default-style)
   (when mode
@@ -615,9 +641,6 @@ Note that the style variables are always made local to the buffer."
 ;;;###autoload (add-to-list 'auto-mode-alist '("\\.y\\(acc\\)?\\'" . c-mode))
 ;;;###autoload (add-to-list 'auto-mode-alist '("\\.lex\\'" . c-mode))
 
-(defun c-init-c-language-vars ()
-  (c-init-language-vars c-mode))
-
 ;;;###autoload
 (defun c-mode ()
   "Major mode for editing K&R and ANSI C code.
@@ -642,7 +665,7 @@ Key bindings:
        local-abbrev-table c-mode-abbrev-table
        abbrev-mode t)
   (use-local-map c-mode-map)
-  (c-init-c-language-vars)
+  (c-init-language-vars-for 'c-mode)
   (c-common-init 'c-mode)
   (easy-menu-add c-c-menu)
   (cc-imenu-init cc-imenu-c-generic-expression)
@@ -706,7 +729,7 @@ Key bindings:
        local-abbrev-table c++-mode-abbrev-table
        abbrev-mode t)
   (use-local-map c++-mode-map)
-  (c-init-language-vars c++-mode)
+  (c-init-language-vars-for 'c++-mode)
   (c-common-init 'c++-mode)
   (easy-menu-add c-c++-menu)
   (cc-imenu-init cc-imenu-c++-generic-expression)
@@ -771,7 +794,7 @@ Key bindings:
   ;; end of the @-style directives.
   (setq c-type-decl-end-used t)
   (use-local-map objc-mode-map)
-  (c-init-language-vars objc-mode)
+  (c-init-language-vars-for 'objc-mode)
   (c-common-init 'objc-mode)
   (easy-menu-add c-objc-menu)
   (cc-imenu-init nil 'cc-imenu-objc-function)
@@ -842,7 +865,7 @@ Key bindings:
        local-abbrev-table java-mode-abbrev-table
        abbrev-mode t)
   (use-local-map java-mode-map)
-  (c-init-language-vars java-mode)
+  (c-init-language-vars-for 'java-mode)
   (c-common-init 'java-mode)
   (easy-menu-add c-java-menu)
   (cc-imenu-init cc-imenu-java-generic-expression)
@@ -901,7 +924,7 @@ Key bindings:
        mode-name "IDL"
        local-abbrev-table idl-mode-abbrev-table)
   (use-local-map idl-mode-map)
-  (c-init-language-vars idl-mode)
+  (c-init-language-vars-for 'idl-mode)
   (c-common-init 'idl-mode)
   (easy-menu-add c-idl-menu)
   ;;(cc-imenu-init cc-imenu-idl-generic-expression) ;TODO
@@ -964,7 +987,7 @@ Key bindings:
        local-abbrev-table pike-mode-abbrev-table
        abbrev-mode t)
   (use-local-map pike-mode-map)
-  (c-init-language-vars pike-mode)
+  (c-init-language-vars-for 'pike-mode)
   (c-common-init 'pike-mode)
   (easy-menu-add c-pike-menu)
   ;;(cc-imenu-init cc-imenu-pike-generic-expression) ;TODO
@@ -1039,7 +1062,7 @@ Key bindings:
           local-abbrev-table awk-mode-abbrev-table
           abbrev-mode t)
     (use-local-map awk-mode-map)
-    (c-init-language-vars awk-mode)
+    (c-init-language-vars-for 'awk-mode)
     (c-common-init 'awk-mode)
     ;; The rest of CC Mode does not (yet) use `font-lock-syntactic-keywords',
     ;; so it's not set by `c-font-lock-init'.