diff options
| author | Martin Stjernholm | 2005-05-23 00:03:59 +0000 |
|---|---|---|
| committer | Martin Stjernholm | 2005-05-23 00:03:59 +0000 |
| commit | 3efc2cd768a4f9838d2a08fde9408b08cec1b0c6 (patch) | |
| tree | 0b4a8de389768e0ecdafbe065aad796dcbeed1e8 | |
| parent | f1e9abb9bfab9c806cf3bb0dbea57812b160322e (diff) | |
| download | emacs-3efc2cd768a4f9838d2a08fde9408b08cec1b0c6.tar.gz emacs-3efc2cd768a4f9838d2a08fde9408b08cec1b0c6.zip | |
2005-05-23 Martin Stjernholm <bug-cc-mode@gnu.org>
CC Mode update to 5.30.10:
* cc-fonts.el (c-font-lock-declarators): Fixed bug where the point
could go past the limit in decoration level 2, thereby causing
errors during interactive fontification.
* cc-mode.el (c-make-inherited-keymap): Fixed cc-bytecomp bug when
the file is evaluated interactively.
* cc-engine.el (c-guess-basic-syntax): Handle operator
declarations somewhat better in C++.
* cc-styles.el, cc-mode.el (c-run-mode-hooks): New helper macro to
make use of run-mode-hooks' which has been added in Emacs 21.1.
(c-mode, c++-mode, objc-mode, java-mode, idl-mode, pike-mode,
awk-mode): Use it.
(make-local-hook): Suppress warning about obsoleteness.
* cc-engine.el, cc-align.el, cc-cmds.el
(c-append-backslashes-forward, c-delete-backslashes-forward,
c-find-decl-spots, c-semi&comma-no-newlines-before-nonblanks):
Compensate for return value from forward-line' when it has moved
but not to a different line due to eob.
* cc-engine.el (c-guess-basic-syntax): Fixed anchoring in
objc-method-intro' and objc-method-args-cont'.
2005-05-23 Alan Mackenzie <bug-cc-mode@gnu.org>
CC Mode update to 5.30.10:
* cc-mode.el, cc-engine.el, cc-align.el: Change the FSF's address
in the copyright statement. Incidentally, change "along with GNU
Emacs" to "along with this program" where it occurs.
* cc-mode.el: Add a fourth parameter t' to the awk-mode autoload,
so that it is interactive, hence can be found by M-x awk-mode
whilst cc-mode is yet to be loaded. Reported by Glenn Morris
<gmorris+emacs@ast.cam.ac.uk>.
* cc-awk.el: Add character classes (e.g. "[:alpha:]") into AWK
Mode's regexps.
2005-05-23 Kevin Ryde <user42@zip.com.au>:
* cc-align.el (c-lineup-argcont): Ignore conses for {} pairs from
c-parse-state, to avoid a lisp error (on bad code).
| -rw-r--r-- | lisp/progmodes/cc-align.el | 10 | ||||
| -rw-r--r-- | lisp/progmodes/cc-awk.el | 19 | ||||
| -rw-r--r-- | lisp/progmodes/cc-cmds.el | 9 | ||||
| -rw-r--r-- | lisp/progmodes/cc-defs.el | 2 | ||||
| -rw-r--r-- | lisp/progmodes/cc-engine.el | 34 | ||||
| -rw-r--r-- | lisp/progmodes/cc-fonts.el | 2 | ||||
| -rw-r--r-- | lisp/progmodes/cc-langs.el | 2 | ||||
| -rw-r--r-- | lisp/progmodes/cc-mode.el | 38 | ||||
| -rw-r--r-- | lisp/progmodes/cc-styles.el | 1 |
9 files changed, 80 insertions, 37 deletions
diff --git a/lisp/progmodes/cc-align.el b/lisp/progmodes/cc-align.el index c5dd091f291..139bfc8aa5a 100644 --- a/lisp/progmodes/cc-align.el +++ b/lisp/progmodes/cc-align.el | |||
| @@ -24,9 +24,9 @@ | |||
| 24 | ;; GNU General Public License for more details. | 24 | ;; GNU General Public License for more details. |
| 25 | 25 | ||
| 26 | ;; You should have received a copy of the GNU General Public License | 26 | ;; You should have received a copy of the GNU General Public License |
| 27 | ;; along with GNU Emacs; see the file COPYING. If not, write to | 27 | ;; along with this program; see the file COPYING. If not, write to |
| 28 | ;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 28 | ;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 29 | ;; Boston, MA 02111-1307, USA. | 29 | ;; Boston, MA 02110-1301, USA. |
| 30 | 30 | ||
| 31 | ;;; Commentary: | 31 | ;;; Commentary: |
| 32 | 32 | ||
| @@ -175,7 +175,8 @@ Works with: arglist-cont, arglist-cont-nonempty." | |||
| 175 | (let ((open-paren (elt c-syntactic-element 2)) | 175 | (let ((open-paren (elt c-syntactic-element 2)) |
| 176 | (paren-state (c-parse-state))) | 176 | (paren-state (c-parse-state))) |
| 177 | (while (not (eq (car paren-state) open-paren)) | 177 | (while (not (eq (car paren-state) open-paren)) |
| 178 | (goto-char (car paren-state)) | 178 | (unless (consp (car paren-state)) ;; ignore matched braces |
| 179 | (goto-char (car paren-state))) | ||
| 179 | (setq paren-state (cdr paren-state))))) | 180 | (setq paren-state (cdr paren-state))))) |
| 180 | 181 | ||
| 181 | (let ((start (point)) c) | 182 | (let ((start (point)) c) |
| @@ -1171,6 +1172,7 @@ Otherwise, no determination is made." | |||
| 1171 | ;;(/= (point-max) | 1172 | ;;(/= (point-max) |
| 1172 | ;; (save-excursion (skip-syntax-forward " ") (point)) | 1173 | ;; (save-excursion (skip-syntax-forward " ") (point)) |
| 1173 | (zerop (forward-line 1)) | 1174 | (zerop (forward-line 1)) |
| 1175 | (bolp) ; forward-line has funny behavior at eob. | ||
| 1174 | (not (looking-at "^[ \t]*$"))) | 1176 | (not (looking-at "^[ \t]*$"))) |
| 1175 | 'stop | 1177 | 'stop |
| 1176 | nil))) | 1178 | nil))) |
diff --git a/lisp/progmodes/cc-awk.el b/lisp/progmodes/cc-awk.el index dbcfa9d991e..419803a7ada 100644 --- a/lisp/progmodes/cc-awk.el +++ b/lisp/progmodes/cc-awk.el | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1988,94,96,2000,01,02,03 Free Software Foundation, Inc. | 3 | ;; Copyright (C) 1988,94,96,2000,01,02,03 Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | ;; Author: Alan Mackenzie (originally based on awk-mode.el) | 5 | ;; Author: Alan Mackenzie <acm@muc.de> (originally based on awk-mode.el) |
| 6 | ;; Maintainer: FSF | 6 | ;; Maintainer: FSF |
| 7 | ;; Keywords: AWK, cc-mode, unix, languages | 7 | ;; Keywords: AWK, cc-mode, unix, languages |
| 8 | 8 | ||
| @@ -526,13 +526,22 @@ | |||
| 526 | ;; Matches any AWK regexp character which doesn't require special analysis. | 526 | ;; Matches any AWK regexp character which doesn't require special analysis. |
| 527 | (defconst c-awk-escaped-newlines*-re "\\(\\\\[\n\r]\\)*") | 527 | (defconst c-awk-escaped-newlines*-re "\\(\\\\[\n\r]\\)*") |
| 528 | ;; Matches a (possibly empty) sequence of escaped newlines. | 528 | ;; Matches a (possibly empty) sequence of escaped newlines. |
| 529 | |||
| 530 | ;; NOTE: In what follows, "[asdf]" in a regexp will be called a "character | ||
| 531 | ;; list", and "[:alpha:]" inside a character list will be known as a | ||
| 532 | ;; "character class". These terms for these things vary between regexp | ||
| 533 | ;; descriptions . | ||
| 529 | (defconst c-awk-regexp-char-class-re | 534 | (defconst c-awk-regexp-char-class-re |
| 535 | "\\[:[a-z]+:\\]") | ||
| 536 | ;; Matches a character class spec (e.g. [:alpha:]). | ||
| 537 | (defconst c-awk-regexp-char-list-re | ||
| 530 | (concat "\\[" c-awk-escaped-newlines*-re "^?" c-awk-escaped-newlines*-re "]?" | 538 | (concat "\\[" c-awk-escaped-newlines*-re "^?" c-awk-escaped-newlines*-re "]?" |
| 531 | "\\(" c-awk-esc-pair-re "\\|" "[^]\n\r]" "\\)*" "\\(]\\|$\\)")) | 539 | "\\(" c-awk-esc-pair-re "\\|" c-awk-regexp-char-class-re |
| 532 | ;; Matches a regexp char class, up to (but not including) EOL if the ] is | 540 | "\\|" "[^]\n\r]" "\\)*" "\\(]\\|$\\)")) |
| 541 | ;; Matches a regexp char list, up to (but not including) EOL if the ] is | ||
| 533 | ;; missing. | 542 | ;; missing. |
| 534 | (defconst c-awk-regexp-innards-re | 543 | (defconst c-awk-regexp-innards-re |
| 535 | (concat "\\(" c-awk-esc-pair-re "\\|" c-awk-regexp-char-class-re | 544 | (concat "\\(" c-awk-esc-pair-re "\\|" c-awk-regexp-char-list-re |
| 536 | "\\|" c-awk-regexp-normal-re "\\)*")) | 545 | "\\|" c-awk-regexp-normal-re "\\)*")) |
| 537 | ;; Matches the inside of an AWK regexp (i.e. without the enclosing /s) | 546 | ;; Matches the inside of an AWK regexp (i.e. without the enclosing /s) |
| 538 | (defconst c-awk-regexp-without-end-re | 547 | (defconst c-awk-regexp-without-end-re |
| @@ -549,7 +558,7 @@ | |||
| 549 | ;; A "neutral" char(pair). Doesn't change the "state" of a subsequent /. | 558 | ;; A "neutral" char(pair). Doesn't change the "state" of a subsequent /. |
| 550 | ;; This is space/tab, braces, an auto-increment/decrement operator or an | 559 | ;; This is space/tab, braces, an auto-increment/decrement operator or an |
| 551 | ;; escaped character. Or one of the (illegal) characters @ or `. But NOT an | 560 | ;; escaped character. Or one of the (illegal) characters @ or `. But NOT an |
| 552 | ;; end of line (even if escpaed). | 561 | ;; end of line (even if escaped). |
| 553 | (defconst c-awk-neutrals*-re | 562 | (defconst c-awk-neutrals*-re |
| 554 | (concat "\\(" c-awk-neutral-re "\\)*")) | 563 | (concat "\\(" c-awk-neutral-re "\\)*")) |
| 555 | ;; A (possibly empty) string of neutral characters (or character pairs). | 564 | ;; A (possibly empty) string of neutral characters (or character pairs). |
diff --git a/lisp/progmodes/cc-cmds.el b/lisp/progmodes/cc-cmds.el index 806fbade693..7be8e370f07 100644 --- a/lisp/progmodes/cc-cmds.el +++ b/lisp/progmodes/cc-cmds.el | |||
| @@ -2441,7 +2441,8 @@ command to conveniently insert and align the necessary backslashes." | |||
| 2441 | (delete-region (point) end) | 2441 | (delete-region (point) end) |
| 2442 | (indent-to column 1))) | 2442 | (indent-to column 1))) |
| 2443 | 2443 | ||
| 2444 | (= (forward-line 1) 0)))) | 2444 | (zerop (forward-line 1))) |
| 2445 | (bolp))) ; forward-line has funny behavior at eob. | ||
| 2445 | 2446 | ||
| 2446 | ;; Make sure there are backslashes with at least one space in | 2447 | ;; Make sure there are backslashes with at least one space in |
| 2447 | ;; front of them. | 2448 | ;; front of them. |
| @@ -2466,7 +2467,8 @@ command to conveniently insert and align the necessary backslashes." | |||
| 2466 | (insert ?\\) | 2467 | (insert ?\\) |
| 2467 | (insert ?\ ?\\))) | 2468 | (insert ?\ ?\\))) |
| 2468 | 2469 | ||
| 2469 | (= (forward-line 1) 0))))))) | 2470 | (zerop (forward-line 1))) |
| 2471 | (bolp)))))) ; forward-line has funny behavior at eob. | ||
| 2470 | 2472 | ||
| 2471 | (defun c-delete-backslashes-forward (to-mark point-pos) | 2473 | (defun c-delete-backslashes-forward (to-mark point-pos) |
| 2472 | ;; This function does not do any hidden buffer changes. | 2474 | ;; This function does not do any hidden buffer changes. |
| @@ -2481,7 +2483,8 @@ command to conveniently insert and align the necessary backslashes." | |||
| 2481 | (skip-chars-backward " \t" (if (>= (point) point-pos) | 2483 | (skip-chars-backward " \t" (if (>= (point) point-pos) |
| 2482 | point-pos)) | 2484 | point-pos)) |
| 2483 | (point)))) | 2485 | (point)))) |
| 2484 | (= (forward-line 1) 0))))) | 2486 | (zerop (forward-line 1))) |
| 2487 | (bolp)))) ; forward-line has funny behavior at eob. | ||
| 2485 | 2488 | ||
| 2486 | 2489 | ||
| 2487 | 2490 | ||
diff --git a/lisp/progmodes/cc-defs.el b/lisp/progmodes/cc-defs.el index 64f3a72f56f..d9caca90666 100644 --- a/lisp/progmodes/cc-defs.el +++ b/lisp/progmodes/cc-defs.el | |||
| @@ -104,7 +104,7 @@ | |||
| 104 | 104 | ||
| 105 | ;;; Variables also used at compile time. | 105 | ;;; Variables also used at compile time. |
| 106 | 106 | ||
| 107 | (defconst c-version "5.30.9" | 107 | (defconst c-version "5.30.10" |
| 108 | "CC Mode version number.") | 108 | "CC Mode version number.") |
| 109 | 109 | ||
| 110 | (defconst c-version-sym (intern c-version)) | 110 | (defconst c-version-sym (intern c-version)) |
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index 0a4cb6c8cd6..84538080219 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el | |||
| @@ -24,9 +24,9 @@ | |||
| 24 | ;; GNU General Public License for more details. | 24 | ;; GNU General Public License for more details. |
| 25 | 25 | ||
| 26 | ;; You should have received a copy of the GNU General Public License | 26 | ;; You should have received a copy of the GNU General Public License |
| 27 | ;; along with GNU Emacs; see the file COPYING. If not, write to | 27 | ;; along with this program; see the file COPYING. If not, write to |
| 28 | ;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 28 | ;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 29 | ;; Boston, MA 02111-1307, USA. | 29 | ;; Boston, MA 02110-1301, USA. |
| 30 | 30 | ||
| 31 | ;;; Commentary: | 31 | ;;; Commentary: |
| 32 | 32 | ||
| @@ -3198,6 +3198,7 @@ This function does not do any hidden buffer changes." | |||
| 3198 | ;; when font-lock refontifies the current line only. | 3198 | ;; when font-lock refontifies the current line only. |
| 3199 | (when (save-excursion | 3199 | (when (save-excursion |
| 3200 | (and (= (forward-line 1) 0) | 3200 | (and (= (forward-line 1) 0) |
| 3201 | (bolp) ; forward-line has funny behavior at eob. | ||
| 3201 | (or (< (c-point 'eol) cfd-limit) | 3202 | (or (< (c-point 'eol) cfd-limit) |
| 3202 | (progn (backward-char) | 3203 | (progn (backward-char) |
| 3203 | (not (eq (char-before) ?\\)))))) | 3204 | (not (eq (char-before) ?\\)))))) |
| @@ -4551,7 +4552,7 @@ brace." | |||
| 4551 | ;; operator token preceded by "operator". | 4552 | ;; operator token preceded by "operator". |
| 4552 | (save-excursion | 4553 | (save-excursion |
| 4553 | (and (c-safe (c-backward-sexp) t) | 4554 | (and (c-safe (c-backward-sexp) t) |
| 4554 | (looking-at "operator\\([^_]\\|$\\)"))) | 4555 | (looking-at "operator\\>\\([^_]\\|$\\)"))) |
| 4555 | (and (eq (char-before) ?<) | 4556 | (and (eq (char-before) ?<) |
| 4556 | (c-with-syntax-table c++-template-syntax-table | 4557 | (c-with-syntax-table c++-template-syntax-table |
| 4557 | (if (c-safe (goto-char (c-up-list-forward (point)))) | 4558 | (if (c-safe (goto-char (c-up-list-forward (point)))) |
| @@ -6104,7 +6105,12 @@ This function does not do any hidden buffer changes." | |||
| 6104 | ;; Note: We use the fact that lim is always after any | 6105 | ;; Note: We use the fact that lim is always after any |
| 6105 | ;; preceding brace sexp. | 6106 | ;; preceding brace sexp. |
| 6106 | (while (and (zerop (c-backward-token-2 1 t lim)) | 6107 | (while (and (zerop (c-backward-token-2 1 t lim)) |
| 6107 | (not (looking-at "[;<,=]")))) | 6108 | (or (not (looking-at "[;<,=]")) |
| 6109 | (and c-overloadable-operators-regexp | ||
| 6110 | (looking-at c-overloadable-operators-regexp) | ||
| 6111 | (save-excursion | ||
| 6112 | (zerop (c-backward-token-2 1 nil lim)) | ||
| 6113 | (looking-at "operator\\>[^_]")))))) | ||
| 6108 | (or (memq (char-after) '(?, ?=)) | 6114 | (or (memq (char-after) '(?, ?=)) |
| 6109 | (and (c-major-mode-is 'c++-mode) | 6115 | (and (c-major-mode-is 'c++-mode) |
| 6110 | (zerop (c-backward-token-2 1 nil lim)) | 6116 | (zerop (c-backward-token-2 1 nil lim)) |
| @@ -6237,7 +6243,15 @@ This function does not do any hidden buffer changes." | |||
| 6237 | ;; CASE 5I: ObjC method definition. | 6243 | ;; CASE 5I: ObjC method definition. |
| 6238 | ((and c-opt-method-key | 6244 | ((and c-opt-method-key |
| 6239 | (looking-at c-opt-method-key)) | 6245 | (looking-at c-opt-method-key)) |
| 6240 | (c-beginning-of-statement-1 lim) | 6246 | (c-beginning-of-statement-1 nil t) |
| 6247 | (if (= (point) indent-point) | ||
| 6248 | ;; Handle the case when it's the first (non-comment) | ||
| 6249 | ;; thing in the buffer. Can't look for a 'same return | ||
| 6250 | ;; value from cbos1 since ObjC directives currently | ||
| 6251 | ;; aren't recognized fully, so that we get 'same | ||
| 6252 | ;; instead of 'previous if it moved over a preceding | ||
| 6253 | ;; directive. | ||
| 6254 | (goto-char (point-min))) | ||
| 6241 | (c-add-syntax 'objc-method-intro (c-point 'boi))) | 6255 | (c-add-syntax 'objc-method-intro (c-point 'boi))) |
| 6242 | ;; CASE 5P: AWK pattern or function or continuation | 6256 | ;; CASE 5P: AWK pattern or function or continuation |
| 6243 | ;; thereof. | 6257 | ;; thereof. |
| @@ -6316,11 +6330,13 @@ This function does not do any hidden buffer changes." | |||
| 6316 | ;; CASE 5K: we are at an ObjC method definition | 6330 | ;; CASE 5K: we are at an ObjC method definition |
| 6317 | ;; continuation line. | 6331 | ;; continuation line. |
| 6318 | ((and c-opt-method-key | 6332 | ((and c-opt-method-key |
| 6319 | (progn | 6333 | (save-excursion |
| 6334 | (goto-char indent-point) | ||
| 6320 | (c-beginning-of-statement-1 lim) | 6335 | (c-beginning-of-statement-1 lim) |
| 6321 | (beginning-of-line) | 6336 | (beginning-of-line) |
| 6322 | (looking-at c-opt-method-key))) | 6337 | (when (looking-at c-opt-method-key) |
| 6323 | (c-add-syntax 'objc-method-args-cont (point))) | 6338 | (setq placeholder (point))))) |
| 6339 | (c-add-syntax 'objc-method-args-cont placeholder)) | ||
| 6324 | ;; CASE 5L: we are at the first argument of a template | 6340 | ;; CASE 5L: we are at the first argument of a template |
| 6325 | ;; arglist that begins on the previous line. | 6341 | ;; arglist that begins on the previous line. |
| 6326 | ((eq (char-before) ?<) | 6342 | ((eq (char-before) ?<) |
diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el index 26c0bdaf60f..29946dc4682 100644 --- a/lisp/progmodes/cc-fonts.el +++ b/lisp/progmodes/cc-fonts.el | |||
| @@ -875,7 +875,7 @@ casts and declarations are fontified. Used on level 2 and higher." | |||
| 875 | ;; with array initializers. Otherwise stop at braces | 875 | ;; with array initializers. Otherwise stop at braces |
| 876 | ;; to avoid going past full function and class blocks. | 876 | ;; to avoid going past full function and class blocks. |
| 877 | (and (if (and (eq got-init ?=) | 877 | (and (if (and (eq got-init ?=) |
| 878 | (= (c-forward-token-2) 0) | 878 | (= (c-forward-token-2 1 nil limit) 0) |
| 879 | (looking-at "{")) | 879 | (looking-at "{")) |
| 880 | (c-safe (c-forward-sexp) t) | 880 | (c-safe (c-forward-sexp) t) |
| 881 | t) | 881 | t) |
diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el index 6a36f89c8d3..94d58c66061 100644 --- a/lisp/progmodes/cc-langs.el +++ b/lisp/progmodes/cc-langs.el | |||
| @@ -1186,7 +1186,7 @@ will be handled." | |||
| 1186 | (c-lang-defvar c-brace-list-key (c-lang-const c-brace-list-key)) | 1186 | (c-lang-defvar c-brace-list-key (c-lang-const c-brace-list-key)) |
| 1187 | 1187 | ||
| 1188 | (c-lang-defconst c-other-block-decl-kwds | 1188 | (c-lang-defconst c-other-block-decl-kwds |
| 1189 | "Keywords where the following block (if any) contain another | 1189 | "Keywords where the following block (if any) contains another |
| 1190 | declaration level that should not be considered a class. | 1190 | declaration level that should not be considered a class. |
| 1191 | 1191 | ||
| 1192 | If any of these also are on `c-type-list-kwds', `c-ref-list-kwds', | 1192 | If any of these also are on `c-type-list-kwds', `c-ref-list-kwds', |
diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el index eaa798217cf..0f17a003ef4 100644 --- a/lisp/progmodes/cc-mode.el +++ b/lisp/progmodes/cc-mode.el | |||
| @@ -24,9 +24,9 @@ | |||
| 24 | ;; GNU General Public License for more details. | 24 | ;; GNU General Public License for more details. |
| 25 | 25 | ||
| 26 | ;; You should have received a copy of the GNU General Public License | 26 | ;; You should have received a copy of the GNU General Public License |
| 27 | ;; along with GNU Emacs; see the file COPYING. If not, write to | 27 | ;; along with this program; see the file COPYING. If not, write to |
| 28 | ;; the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 28 | ;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 29 | ;; Boston, MA 02111-1307, USA. | 29 | ;; Boston, MA 02110-1301, USA. |
| 30 | 30 | ||
| 31 | ;;; Commentary: | 31 | ;;; Commentary: |
| 32 | 32 | ||
| @@ -91,10 +91,12 @@ | |||
| 91 | (cc-require 'cc-align) | 91 | (cc-require 'cc-align) |
| 92 | (cc-require 'cc-menus) | 92 | (cc-require 'cc-menus) |
| 93 | 93 | ||
| 94 | ;; SILENCE the compiler. | 94 | ;; Silence the compiler. |
| 95 | (cc-bytecomp-defvar comment-line-break-function) ; (X)Emacs 20+ | 95 | (cc-bytecomp-defvar comment-line-break-function) ; (X)Emacs 20+ |
| 96 | (cc-bytecomp-defvar adaptive-fill-first-line-regexp) ; Emacs 20+ | 96 | (cc-bytecomp-defvar adaptive-fill-first-line-regexp) ; Emacs 20+ |
| 97 | (cc-bytecomp-defun set-keymap-parents) ; XEmacs | 97 | (cc-bytecomp-defun set-keymap-parents) ; XEmacs |
| 98 | (cc-bytecomp-defun run-mode-hooks) ; Emacs 21.1+ | ||
| 99 | (cc-bytecomp-obsolete-fun make-local-hook) ; Marked obsolete in Emacs 21.1. | ||
| 98 | 100 | ||
| 99 | ;; We set these variables during mode init, yet we don't require | 101 | ;; We set these variables during mode init, yet we don't require |
| 100 | ;; font-lock. | 102 | ;; font-lock. |
| @@ -201,12 +203,15 @@ control). See \"cc-mode.el\" for more info." | |||
| 201 | 203 | ||
| 202 | (defun c-make-inherited-keymap () | 204 | (defun c-make-inherited-keymap () |
| 203 | (let ((map (make-sparse-keymap))) | 205 | (let ((map (make-sparse-keymap))) |
| 206 | ;; Necessary to use `cc-bytecomp-fboundp' below since this | ||
| 207 | ;; function is called from top-level forms that are evaluated | ||
| 208 | ;; while cc-bytecomp is active when one does M-x eval-buffer. | ||
| 204 | (cond | 209 | (cond |
| 205 | ;; XEmacs | 210 | ;; XEmacs |
| 206 | ((fboundp 'set-keymap-parents) | 211 | ((cc-bytecomp-fboundp 'set-keymap-parents) |
| 207 | (set-keymap-parents map c-mode-base-map)) | 212 | (set-keymap-parents map c-mode-base-map)) |
| 208 | ;; Emacs | 213 | ;; Emacs |
| 209 | ((fboundp 'set-keymap-parent) | 214 | ((cc-bytecomp-fboundp 'set-keymap-parent) |
| 210 | (set-keymap-parent map c-mode-base-map)) | 215 | (set-keymap-parent map c-mode-base-map)) |
| 211 | ;; incompatible | 216 | ;; incompatible |
| 212 | (t (error "CC Mode is incompatible with this version of Emacs"))) | 217 | (t (error "CC Mode is incompatible with this version of Emacs"))) |
| @@ -587,6 +592,13 @@ Note that the style variables are always made local to the buffer." | |||
| 587 | 592 | ||
| 588 | (add-hook 'hack-local-variables-hook 'c-postprocess-file-styles) | 593 | (add-hook 'hack-local-variables-hook 'c-postprocess-file-styles) |
| 589 | 594 | ||
| 595 | (defmacro c-run-mode-hooks (&rest hooks) | ||
| 596 | ;; Emacs 21.1 has introduced a system with delayed mode hooks that | ||
| 597 | ;; require the use of the new function `run-mode-hooks'. | ||
| 598 | (if (cc-bytecomp-fboundp 'run-mode-hooks) | ||
| 599 | `(run-mode-hooks ,@hooks) | ||
| 600 | `(progn ,@(mapcar (lambda (hook) `(run-hooks ,hook)) hooks)))) | ||
| 601 | |||
| 590 | 602 | ||
| 591 | ;; Support for C | 603 | ;; Support for C |
| 592 | 604 | ||
| @@ -667,7 +679,7 @@ Key bindings: | |||
| 667 | (c-common-init 'c-mode) | 679 | (c-common-init 'c-mode) |
| 668 | (easy-menu-add c-c-menu) | 680 | (easy-menu-add c-c-menu) |
| 669 | (cc-imenu-init cc-imenu-c-generic-expression) | 681 | (cc-imenu-init cc-imenu-c-generic-expression) |
| 670 | (run-mode-hooks 'c-mode-common-hook 'c-mode-hook) | 682 | (c-run-mode-hooks 'c-mode-common-hook 'c-mode-hook) |
| 671 | (c-update-modeline)) | 683 | (c-update-modeline)) |
| 672 | 684 | ||
| 673 | 685 | ||
| @@ -730,7 +742,7 @@ Key bindings: | |||
| 730 | (c-common-init 'c++-mode) | 742 | (c-common-init 'c++-mode) |
| 731 | (easy-menu-add c-c++-menu) | 743 | (easy-menu-add c-c++-menu) |
| 732 | (cc-imenu-init cc-imenu-c++-generic-expression) | 744 | (cc-imenu-init cc-imenu-c++-generic-expression) |
| 733 | (run-mode-hooks 'c-mode-common-hook 'c++-mode-hook) | 745 | (c-run-mode-hooks 'c-mode-common-hook 'c++-mode-hook) |
| 734 | (c-update-modeline)) | 746 | (c-update-modeline)) |
| 735 | 747 | ||
| 736 | 748 | ||
| @@ -794,7 +806,7 @@ Key bindings: | |||
| 794 | (c-common-init 'objc-mode) | 806 | (c-common-init 'objc-mode) |
| 795 | (easy-menu-add c-objc-menu) | 807 | (easy-menu-add c-objc-menu) |
| 796 | (cc-imenu-init nil 'cc-imenu-objc-function) | 808 | (cc-imenu-init nil 'cc-imenu-objc-function) |
| 797 | (run-mode-hooks 'c-mode-common-hook 'objc-mode-hook) | 809 | (c-run-mode-hooks 'c-mode-common-hook 'objc-mode-hook) |
| 798 | (c-update-modeline)) | 810 | (c-update-modeline)) |
| 799 | 811 | ||
| 800 | 812 | ||
| @@ -864,7 +876,7 @@ Key bindings: | |||
| 864 | (c-common-init 'java-mode) | 876 | (c-common-init 'java-mode) |
| 865 | (easy-menu-add c-java-menu) | 877 | (easy-menu-add c-java-menu) |
| 866 | (cc-imenu-init cc-imenu-java-generic-expression) | 878 | (cc-imenu-init cc-imenu-java-generic-expression) |
| 867 | (run-mode-hooks 'c-mode-common-hook 'java-mode-hook) | 879 | (c-run-mode-hooks 'c-mode-common-hook 'java-mode-hook) |
| 868 | (c-update-modeline)) | 880 | (c-update-modeline)) |
| 869 | 881 | ||
| 870 | 882 | ||
| @@ -922,7 +934,7 @@ Key bindings: | |||
| 922 | (c-common-init 'idl-mode) | 934 | (c-common-init 'idl-mode) |
| 923 | (easy-menu-add c-idl-menu) | 935 | (easy-menu-add c-idl-menu) |
| 924 | ;;(cc-imenu-init cc-imenu-idl-generic-expression) ;TODO | 936 | ;;(cc-imenu-init cc-imenu-idl-generic-expression) ;TODO |
| 925 | (run-mode-hooks 'c-mode-common-hook 'idl-mode-hook) | 937 | (c-run-mode-hooks 'c-mode-common-hook 'idl-mode-hook) |
| 926 | (c-update-modeline)) | 938 | (c-update-modeline)) |
| 927 | 939 | ||
| 928 | 940 | ||
| @@ -984,7 +996,7 @@ Key bindings: | |||
| 984 | (c-common-init 'pike-mode) | 996 | (c-common-init 'pike-mode) |
| 985 | (easy-menu-add c-pike-menu) | 997 | (easy-menu-add c-pike-menu) |
| 986 | ;;(cc-imenu-init cc-imenu-pike-generic-expression) ;TODO | 998 | ;;(cc-imenu-init cc-imenu-pike-generic-expression) ;TODO |
| 987 | (run-mode-hooks 'c-mode-common-hook 'pike-mode-hook) | 999 | (c-run-mode-hooks 'c-mode-common-hook 'pike-mode-hook) |
| 988 | (c-update-modeline)) | 1000 | (c-update-modeline)) |
| 989 | 1001 | ||
| 990 | 1002 | ||
| @@ -1076,7 +1088,7 @@ Key bindings: | |||
| 1076 | ;; in cc-engine.el, just before (defun c-fast-in-literal ... | 1088 | ;; in cc-engine.el, just before (defun c-fast-in-literal ... |
| 1077 | (defalias 'c-in-literal 'c-slow-in-literal) | 1089 | (defalias 'c-in-literal 'c-slow-in-literal) |
| 1078 | 1090 | ||
| 1079 | (run-mode-hooks 'c-mode-common-hook 'awk-mode-hook) | 1091 | (c-run-mode-hooks 'c-mode-common-hook 'awk-mode-hook) |
| 1080 | (c-update-modeline)) | 1092 | (c-update-modeline)) |
| 1081 | ) ;; closes the (if (not (memq 'syntax-properties c-emacs-features)) | 1093 | ) ;; closes the (if (not (memq 'syntax-properties c-emacs-features)) |
| 1082 | 1094 | ||
diff --git a/lisp/progmodes/cc-styles.el b/lisp/progmodes/cc-styles.el index 1a26e54bf06..14f988feb03 100644 --- a/lisp/progmodes/cc-styles.el +++ b/lisp/progmodes/cc-styles.el | |||
| @@ -48,6 +48,7 @@ | |||
| 48 | 48 | ||
| 49 | ;; Silence the compiler. | 49 | ;; Silence the compiler. |
| 50 | (cc-bytecomp-defvar adaptive-fill-first-line-regexp) ; Emacs | 50 | (cc-bytecomp-defvar adaptive-fill-first-line-regexp) ; Emacs |
| 51 | (cc-bytecomp-obsolete-fun make-local-hook) ; Marked obsolete in Emacs 21.1. | ||
| 51 | 52 | ||
| 52 | 53 | ||
| 53 | (defvar c-style-alist | 54 | (defvar c-style-alist |