Mercurial > emacs
comparison lisp/progmodes/cc-langs.el @ 20915:c746c93c9c95
(c-postprocess-file-styles): If a file style or file offsets are set,
make the variables local to the buffer (via make-local-variable).
(c-java-method-key): Variable deleted.
(c-C-extra-toplevel-key)
(c-C++-extra-toplevel-key, c-extra-toplevel-key): New variables
which parameterize the search for additional top-level enclosing
constructs.
(c-mode-base-map): c-mark-function moved back to M-C-h.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Tue, 17 Feb 1998 07:10:11 +0000 |
parents | 1a85b213eb6d |
children | e3c68a6888f9 |
comparison
equal
deleted
inserted
replaced
20914:8f189ffad604 | 20915:c746c93c9c95 |
---|---|
1 ;;; cc-langs.el --- specific language support for CC Mode | 1 ;;; cc-langs.el --- specific language support for CC Mode |
2 | 2 |
3 ;; Copyright (C) 1985,87,92,93,94,95,96,97 Free Software Foundation, Inc. | 3 ;; Copyright (C) 1985,87,92,93,94,95,96,97,98 Free Software Foundation, Inc. |
4 | 4 |
5 ;; Authors: 1992-1997 Barry A. Warsaw | 5 ;; Authors: 1992-1997 Barry A. Warsaw |
6 ;; 1987 Dave Detlefs and Stewart Clamen | 6 ;; 1987 Dave Detlefs and Stewart Clamen |
7 ;; 1985 Richard M. Stallman | 7 ;; 1985 Richard M. Stallman |
8 ;; Maintainer: cc-mode-help@python.org | 8 ;; Maintainer: cc-mode-help@python.org |
53 | 53 |
54 | 54 |
55 ;; keywords introducing class definitions. language specific | 55 ;; keywords introducing class definitions. language specific |
56 (defconst c-C-class-key "\\(struct\\|union\\)") | 56 (defconst c-C-class-key "\\(struct\\|union\\)") |
57 (defconst c-C++-class-key "\\(class\\|struct\\|union\\)") | 57 (defconst c-C++-class-key "\\(class\\|struct\\|union\\)") |
58 (defconst c-C-extra-toplevel-key "\\(extern\\)[^_]") | |
59 (defconst c-C++-extra-toplevel-key "\\(extern\\|namespace\\)[^_]") | |
58 | 60 |
59 (defconst c-ObjC-class-key | 61 (defconst c-ObjC-class-key |
60 (concat | 62 (concat |
61 "@\\(interface\\|implementation\\)\\s +" | 63 "@\\(interface\\|implementation\\)\\s +" |
62 c-symbol-key ;name of the class | 64 c-symbol-key ;name of the class |
74 )) | 76 )) |
75 | 77 |
76 (defvar c-class-key c-C-class-key) | 78 (defvar c-class-key c-C-class-key) |
77 (make-variable-buffer-local 'c-class-key) | 79 (make-variable-buffer-local 'c-class-key) |
78 | 80 |
81 (defvar c-extra-toplevel-key c-C-extra-toplevel-key) | |
82 (make-variable-buffer-local 'c-extra-toplevel-key) | |
83 | |
79 | 84 |
80 ;; regexp describing access protection clauses. language specific | 85 ;; regexp describing access protection clauses. language specific |
81 (defvar c-access-key nil) | 86 (defvar c-access-key nil) |
82 (make-variable-buffer-local 'c-access-key) | 87 (make-variable-buffer-local 'c-access-key) |
83 (defconst c-C++-access-key (concat c-protection-key "[ \t]*:")) | 88 (defconst c-C++-access-key (concat c-protection-key "[ \t]*:")) |
113 "\\(([^)]*)\\)?" ; return type | 118 "\\(([^)]*)\\)?" ; return type |
114 ;; \\s- in objc syntax table does not include \n | 119 ;; \\s- in objc syntax table does not include \n |
115 ;; since it is considered the end of //-comments. | 120 ;; since it is considered the end of //-comments. |
116 "[ \t\n]*" c-symbol-key)) | 121 "[ \t\n]*" c-symbol-key)) |
117 | 122 |
118 (defconst c-Java-method-key | |
119 (concat | |
120 "^\\s *[+-]\\s *" | |
121 "\\(([^)]*)\\)?" ; return type | |
122 ;; \\s- in java syntax table does not include \n | |
123 ;; since it is considered the end of //-comments. | |
124 "[ \t\n]*" c-symbol-key)) | |
125 | 123 |
126 | 124 |
127 ;; comment starter definitions for various languages. language specific | 125 ;; comment starter definitions for various languages. language specific |
128 (defconst c-C++-comment-start-regexp "/[/*]") | 126 (defconst c-C++-comment-start-regexp "/[/*]") |
129 ;; We need to match all 3 Java style comments | 127 ;; We need to match all 3 Java style comments |
253 (defun c-postprocess-file-styles () | 251 (defun c-postprocess-file-styles () |
254 "Function that post processes relevant file local variables. | 252 "Function that post processes relevant file local variables. |
255 Currently, this function simply applies any style and offset settings | 253 Currently, this function simply applies any style and offset settings |
256 found in the file's Local Variable list. It first applies any style | 254 found in the file's Local Variable list. It first applies any style |
257 setting found in `c-file-style', then it applies any offset settings | 255 setting found in `c-file-style', then it applies any offset settings |
258 it finds in `c-file-offsets'." | 256 it finds in `c-file-offsets'. |
257 | |
258 Note that the style variables are always made local to the buffer." | |
259 ;; apply file styles and offsets | 259 ;; apply file styles and offsets |
260 (if (or c-file-style c-file-offsets) | |
261 (c-make-styles-buffer-local t)) | |
260 (and c-file-style | 262 (and c-file-style |
261 (c-set-style c-file-style)) | 263 (c-set-style c-file-style)) |
262 (and c-file-offsets | 264 (and c-file-offsets |
263 (mapcar | 265 (mapcar |
264 (function | 266 (function |
333 (define-key c-mode-base-map "{" 'c-electric-brace) | 335 (define-key c-mode-base-map "{" 'c-electric-brace) |
334 (define-key c-mode-base-map "}" 'c-electric-brace) | 336 (define-key c-mode-base-map "}" 'c-electric-brace) |
335 (define-key c-mode-base-map ";" 'c-electric-semi&comma) | 337 (define-key c-mode-base-map ";" 'c-electric-semi&comma) |
336 (define-key c-mode-base-map "#" 'c-electric-pound) | 338 (define-key c-mode-base-map "#" 'c-electric-pound) |
337 (define-key c-mode-base-map ":" 'c-electric-colon) | 339 (define-key c-mode-base-map ":" 'c-electric-colon) |
338 ;; Lucid Emacs 19.9 defined these two, the second of which was | 340 ;; Separate M-BS from C-M-h. The former should remain |
339 ;; commented out... | 341 ;; backward-kill-word. |
340 ;; (define-key c-mode-base-map "\e{" 'c-insert-braces) | 342 (define-key c-mode-base-map [(control meta h)] 'c-mark-function) |
341 ;; Commented out electric square brackets because nobody likes them. | |
342 ;; (define-key c-mode-base-map "[" 'c-insert-brackets) | |
343 (define-key c-mode-base-map "\C-c\C-m" 'c-mark-function) | |
344 (define-key c-mode-base-map "\e\C-q" 'c-indent-exp) | 343 (define-key c-mode-base-map "\e\C-q" 'c-indent-exp) |
345 (define-key c-mode-base-map "\ea" 'c-beginning-of-statement) | 344 (define-key c-mode-base-map "\ea" 'c-beginning-of-statement) |
346 (define-key c-mode-base-map "\ee" 'c-end-of-statement) | 345 (define-key c-mode-base-map "\ee" 'c-end-of-statement) |
346 ;; RMS says don't make these the default. | |
347 ;; (define-key c-mode-base-map "\e\C-a" 'c-beginning-of-defun) | |
348 ;; (define-key c-mode-base-map "\e\C-e" 'c-end-of-defun) | |
347 (define-key c-mode-base-map "\C-c\C-n" 'c-forward-conditional) | 349 (define-key c-mode-base-map "\C-c\C-n" 'c-forward-conditional) |
348 (define-key c-mode-base-map "\C-c\C-p" 'c-backward-conditional) | 350 (define-key c-mode-base-map "\C-c\C-p" 'c-backward-conditional) |
349 (define-key c-mode-base-map "\C-c\C-u" 'c-up-conditional) | 351 (define-key c-mode-base-map "\C-c\C-u" 'c-up-conditional) |
350 (define-key c-mode-base-map "\t" 'c-indent-command) | 352 (define-key c-mode-base-map "\t" 'c-indent-command) |
351 ;; Caution! Enter here at your own risk. We are trying to support | 353 ;; Caution! Enter here at your own risk. We are trying to support |