comparison lisp/progmodes/cc-langs.el @ 69140:3d8b060d10fb

cc-align.el, cc-awk.el, cc-bytecomp.el, cc-cmds.el, cc-compat.el, cc-defs.el, cc-engine.el, cc-fonts.el, cc-langs.el, cc-menus.el, cc-mode.el, cc-styles.el, cc-subword.el, cc-vars.el: Add 2006 to the copyright statement. cc-awk.el: (c-awk-after-change): Protect the match data with save-match-data. It was being corrupted when Font Lock was not enabled. (ii): Fix a typo. cc-cmds.el, cc-mode.el, cc-engine.el (c-update-modeline): Concatenate the minor mode indicators directly onto mode-name, removing c-submode-indicators. Sometimes, c-s-i got separated from the mode name on the mode line. cc-cmds.el, cc-mode.el: Rename c-hungry-backspace to c-hungry-delete-backwards, at the request of RMS. Leave the old name as an alias. cc-cmds.el (c-electric-brace, c-electric-semi&comma, c-electric-colon): Correct doc-strings: "/ln" -> "/la". cc-cmds.el (c-electric-brace): Fix clean-up brace-else-brace (error due to mbeg, mend being undefined). cc-defs.el (c-version): Update to 5.31.3. cc-defs.el: [Supersedes patch V1.38]: (top level): Check for a buggy font-lock-compile-keywords ONLY in XEmacs. GNU Emacs 22 now has a check which would throw an error here. cc-engine.el (c-beginning-of-statement-1): Clarify doc-string and comments. Distinguish real labels ("case 1:" or "foo:") from non-labels ("public:"). cc-engine.el (c-after-change-check-<>-operators): Remove save-match-data, reversing change for V1.45. save-match-data is now in c-after-change. cc-engine.el (c-forward-objc-directive): Replace c-forward-token-2 with crude coding; c-f-t-2 doesn't move over a token at EOB. Objc Mode was hanging after typing, e.g., "@implementation". cc-langs.el (c-filter-ops): Made it available at runtime too to work when `c-make-init-lang-vars-fun' needs to evaluate from source. cc-langs.el (c-make-init-lang-vars-fun): Improved the error message when there's an evaluation error to show whether it's loaded from source or not. (c-mode-menu): Add menu items for Electric Mode and Subword Mode. cc-mode.el (c-after-change): Protect the match data with save-match-data. It was getting corrupted by c-after-change-check-<>-operators. cc-mode.el: File Local variables: Solve the problem where both `mode' and c-file-offsets are specified: `mode' will overwrite c-f-o's settings: (c-remove-any-local-eval-or-mode-variables): new function. (c-postprocess-file-styles): call the above new function, within c-tentative-buffer-change, to splat `mode' and `eval' before the second hack-local-variables.
author Alan Mackenzie <acm@muc.de>
date Fri, 24 Feb 2006 15:33:02 +0000
parents dc49655f57ae
children c4d23fcbb9bd 8a1ee48a8386
comparison
equal deleted inserted replaced
69139:85cd04b9bd25 69140:3d8b060d10fb
1 ;;; cc-langs.el --- language specific settings for CC Mode 1 ;;; cc-langs.el --- language specific settings for CC Mode
2 2
3 ;; Copyright (C) 1985,1987,1992-2003, 2004, 2005, 2006 3 ;; Copyright (C) 1985,1987,1992-2003, 2004, 2005, 2006 Free Software
4 ;; Free Software Foundation, Inc. 4 ;; Foundation, Inc.
5 5
6 ;; Authors: 1998- Martin Stjernholm 6 ;; Authors: 1998- Martin Stjernholm
7 ;; 1992-1999 Barry A. Warsaw 7 ;; 1992-1999 Barry A. Warsaw
8 ;; 1987 Dave Detlefs and Stewart Clamen 8 ;; 1987 Dave Detlefs and Stewart Clamen
9 ;; 1985 Richard M. Stallman 9 ;; 1985 Richard M. Stallman
175 (put 'c-lang-defvar 'lisp-indent-function 'defun) 175 (put 'c-lang-defvar 'lisp-indent-function 'defun)
176 (eval-after-load "edebug" 176 (eval-after-load "edebug"
177 '(def-edebug-spec c-lang-defvar 177 '(def-edebug-spec c-lang-defvar
178 (&define name def-form &optional stringp))) 178 (&define name def-form &optional stringp)))
179 179
180 (eval-when-compile 180 (eval-and-compile
181 ;; Some helper functions used when building the language constants. 181 ;; Some helper functions used when building the language constants.
182 182
183 (defun c-filter-ops (ops opgroup-filter op-filter &optional xlate) 183 (defun c-filter-ops (ops opgroup-filter op-filter &optional xlate)
184 ;; Used to filter operators from the list OPS in a DWIM:ey way: 184 ;; Used to filter operators from the list OPS in a DWIM:ey way:
185 ;; OPS either has the structure of `c-operators', as a single 185 ;; OPS either has the structure of `c-operators', as a single
258 (c-fn-region-is-active-p)])) 258 (c-fn-region-is-active-p)]))
259 "----" 259 "----"
260 ("Toggle..." 260 ("Toggle..."
261 ["Syntactic indentation" c-toggle-syntactic-indentation 261 ["Syntactic indentation" c-toggle-syntactic-indentation
262 :style toggle :selected c-syntactic-indentation] 262 :style toggle :selected c-syntactic-indentation]
263 ["Auto newline" c-toggle-auto-newline 263 ["Electric mode" c-toggle-electric-state
264 :style toggle :selected c-electric-flag]
265 ["Auto newline" c-toggle-auto-newline
264 :style toggle :selected c-auto-newline] 266 :style toggle :selected c-auto-newline]
265 ["Hungry delete" c-toggle-hungry-state 267 ["Hungry delete" c-toggle-hungry-state
266 :style toggle :selected c-hungry-delete-key]))) 268 :style toggle :selected c-hungry-delete-key]
269 ["Subword mode" c-subword-mode
270 :style toggle :selected c-subword-mode])))
267 271
268 272
269 ;;; Syntax tables. 273 ;;; Syntax tables.
270 274
271 (defun c-populate-syntax-table (table) 275 (defun c-populate-syntax-table (table)
2824 `(lambda () 2828 `(lambda ()
2825 2829
2826 ;; This let sets up the context for `c-mode-var' and similar 2830 ;; This let sets up the context for `c-mode-var' and similar
2827 ;; that could be in the result from `cl-macroexpand-all'. 2831 ;; that could be in the result from `cl-macroexpand-all'.
2828 (let ((c-buffer-is-cc-mode ',mode) 2832 (let ((c-buffer-is-cc-mode ',mode)
2829 current-var) 2833 current-var source-eval)
2830 (condition-case err 2834 (condition-case err
2831 2835
2832 (if (eq c-version-sym ',c-version-sym) 2836 (if (eq c-version-sym ',c-version-sym)
2833 (setq ,@(let ((c-buffer-is-cc-mode mode) 2837 (setq ,@(let ((c-buffer-is-cc-mode mode)
2834 (c-lang-const-expansion 'immediate)) 2838 (c-lang-const-expansion 'immediate))
2850 ;; "language constants from source") 2854 ;; "language constants from source")
2851 ;; ',mode ,c-version c-version) 2855 ;; ',mode ,c-version c-version)
2852 ;; (put ',mode 'c-has-warned-lang-consts t)) 2856 ;; (put ',mode 'c-has-warned-lang-consts t))
2853 2857
2854 (require 'cc-langs) 2858 (require 'cc-langs)
2859 (setq source-eval t)
2855 (let ((init (cdr c-lang-variable-inits))) 2860 (let ((init (cdr c-lang-variable-inits)))
2856 (while init 2861 (while init
2857 (setq current-var (caar init)) 2862 (setq current-var (caar init))
2858 (set (caar init) (eval (cadar init))) 2863 (set (caar init) (eval (cadar init)))
2859 (setq init (cdr init))))) 2864 (setq init (cdr init)))))
2860 2865
2861 (error 2866 (error
2862 (if current-var 2867 (if current-var
2863 (message "Eval error in the `c-lang-defvar' for `%s': %S" 2868 (message "Eval error in the `c-lang-defvar' for `%s'%s: %S"
2864 current-var err) 2869 current-var
2870 (if source-eval
2871 (format "\
2872 (fallback source eval - %s compiled with CC Mode %s but loaded with %s)"
2873 ',mode ,c-version c-version)
2874 "")
2875 err)
2865 (signal (car err) (cdr err))))))) 2876 (signal (car err) (cdr err)))))))
2866 2877
2867 ;; Being evaluated from source. Always use the dynamic method to 2878 ;; Being evaluated from source. Always use the dynamic method to
2868 ;; work well when `c-lang-defvar's in this file are reevaluated 2879 ;; work well when `c-lang-defvar's in this file are reevaluated
2869 ;; interactively. 2880 ;; interactively.
2879 (set (caar init) (eval (cadar init))) 2890 (set (caar init) (eval (cadar init)))
2880 (setq init (cdr init))) 2891 (setq init (cdr init)))
2881 2892
2882 (error 2893 (error
2883 (if current-var 2894 (if current-var
2884 (message "Eval error in the `c-lang-defvar' for `%s': %S" 2895 (message
2885 current-var err) 2896 "Eval error in the `c-lang-defvar' for `%s' (source eval): %S"
2897 current-var err)
2886 (signal (car err) (cdr err))))))) 2898 (signal (car err) (cdr err)))))))
2887 )) 2899 ))
2888 2900
2889 (defmacro c-init-language-vars (mode) 2901 (defmacro c-init-language-vars (mode)
2890 "Initialize all the language dependent variables for the given mode. 2902 "Initialize all the language dependent variables for the given mode.