diff options
| author | Alan Mackenzie | 2006-02-24 15:33:02 +0000 |
|---|---|---|
| committer | Alan Mackenzie | 2006-02-24 15:33:02 +0000 |
| commit | cb694ab73063cc92342daf96d009cdc6d086bc0b (patch) | |
| tree | f60c5467a7d18135fc252a6702fcbaf38c2f980d | |
| parent | 0d566910540fa519c48f90455bdecd4565cea948 (diff) | |
| download | emacs-cb694ab73063cc92342daf96d009cdc6d086bc0b.tar.gz emacs-cb694ab73063cc92342daf96d009cdc6d086bc0b.zip | |
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.
| -rw-r--r-- | lisp/ChangeLog | 90 | ||||
| -rw-r--r-- | lisp/progmodes/cc-align.el | 4 | ||||
| -rw-r--r-- | lisp/progmodes/cc-awk.el | 15 | ||||
| -rw-r--r-- | lisp/progmodes/cc-bytecomp.el | 4 | ||||
| -rw-r--r-- | lisp/progmodes/cc-cmds.el | 35 | ||||
| -rw-r--r-- | lisp/progmodes/cc-compat.el | 4 | ||||
| -rw-r--r-- | lisp/progmodes/cc-defs.el | 19 | ||||
| -rw-r--r-- | lisp/progmodes/cc-engine.el | 112 | ||||
| -rw-r--r-- | lisp/progmodes/cc-langs.el | 34 | ||||
| -rw-r--r-- | lisp/progmodes/cc-menus.el | 4 | ||||
| -rw-r--r-- | lisp/progmodes/cc-mode.el | 130 | ||||
| -rw-r--r-- | lisp/progmodes/cc-styles.el | 4 | ||||
| -rw-r--r-- | lisp/progmodes/cc-vars.el | 4 |
13 files changed, 321 insertions, 138 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 52c222bc36d..e9aacb6c3e9 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,93 @@ | |||
| 1 | 2006-02-24 Alan Mackenzie <bug-cc-mode@gnu.org> | ||
| 2 | |||
| 3 | * CC Mode Update to 5.31.3. | ||
| 4 | |||
| 5 | 2006-02-24 Alan Mackenzie <bug-cc-mode@gnu.org> | ||
| 6 | |||
| 7 | * progmodes/cc-mode.el (c-postprocess-file-styles): bind | ||
| 8 | inhibit-read-only to t, around the call to | ||
| 9 | c-remove-any-local-eval-or-mode-variables, so that it works on a | ||
| 10 | RO file. | ||
| 11 | |||
| 12 | 2006-02-24 Alan Mackenzie <bug-cc-mode@gnu.org> | ||
| 13 | |||
| 14 | * progmodes/cc-awk.el: Correct a typo. | ||
| 15 | |||
| 16 | 2006-02-24 Alan Mackenzie <bug-cc-mode@gnu.org> | ||
| 17 | |||
| 18 | * progmodes/cc-cmds.el, cc-mode.el: Rename c-hungry-backspace to | ||
| 19 | c-hungry-delete-backwards, at the request of RMS. Leave the old | ||
| 20 | name as an alias. | ||
| 21 | |||
| 22 | 2006-02-24 Alan Mackenzie <bug-cc-mode@gnu.org> | ||
| 23 | |||
| 24 | * progmodes/cc-mode.el: Correct a typo. | ||
| 25 | |||
| 26 | 2006-02-24 Alan Mackenzie <bug-cc-mode@gnu.org> | ||
| 27 | |||
| 28 | * progmodes/cc-defs.el: Update the version number to 5.31.3. | ||
| 29 | |||
| 30 | 2006-02-24 Alan Mackenzie <bug-cc-mode@gnu.org> | ||
| 31 | |||
| 32 | * progmodes/cc-cmds.el (c-electric-brace): Fix clean-up | ||
| 33 | brace-else-brace (error due to mbeg, mend being undefined). | ||
| 34 | |||
| 35 | 2006-02-24 Alan Mackenzie <bug-cc-mode@gnu.org> | ||
| 36 | |||
| 37 | * progmodes/cc-mode.el: File Local variables: Solve the problem | ||
| 38 | where both `mode' and c-file-offsets are specified: `mode' will | ||
| 39 | overwrite c-f-o's settings: | ||
| 40 | (c-remove-any-local-eval-or-mode-variables): new function. | ||
| 41 | (c-postprocess-file-styles): call the above new function, within | ||
| 42 | c-tentative-buffer-change, to splat `mode' and `eval' before the | ||
| 43 | second hack-local-variables. | ||
| 44 | |||
| 45 | 2006-02-24 Alan Mackenzie <bug-cc-mode@gnu.org> | ||
| 46 | |||
| 47 | * progmodes/cc-mode.el: | ||
| 48 | [Supersedes patch to cc-engine.el 2005-12-16T20:07:49Z!monnier@iro.umontreal.ca] | ||
| 49 | (c-after-change): Protect the match data with save-match-data. It | ||
| 50 | was getting corrupted by c-after-change-check-<>-operators. | ||
| 51 | |||
| 52 | * cc-defs.el: [Supersedes patch V1.38]: | ||
| 53 | (top level): Check for a buggy font-lock-compile-keywords ONLY in | ||
| 54 | XEmacs. GNU Emacs 22 now has a check which would throw an error | ||
| 55 | here. | ||
| 56 | |||
| 57 | * progmodes/cc-awk.el (c-awk-after-change): Protect the match data | ||
| 58 | with save-match-data. It was being corrupted when Font Lock was | ||
| 59 | not enabled. | ||
| 60 | |||
| 61 | 2006-02-24 Alan Mackenzie <bug-cc-mode@gnu.org> | ||
| 62 | |||
| 63 | * progmodes/cc-langs.el (c-mode-menu): Add menu items for Electric | ||
| 64 | Mode and Subword Mode. | ||
| 65 | |||
| 66 | * progmodes/cc-engine.el (c-beginning-of-statment-1): Distinguish | ||
| 67 | real labels ("case 1:" or "foo:") from non-labels ("public:"). | ||
| 68 | (c-forward-objc-directive): Replace c-forward-token-2 with crude | ||
| 69 | coding; c-f-t-2 doesn't move over a token at EOB. | ||
| 70 | |||
| 71 | * progmodes/cc-defs.el (c-version): Update version number to | ||
| 72 | 5.31.2 | ||
| 73 | |||
| 74 | * progmodes/cc-cmds.el, cc-mode.el, cc-engine.el | ||
| 75 | (c-update-modeline): Concatenate the minor mode indicators | ||
| 76 | directly onto mode-name, removing c-submode-indicators. | ||
| 77 | Sometimes, c-s-i got separated from the mode name on the mode | ||
| 78 | line. | ||
| 79 | |||
| 80 | * progmodes/cc-cmds.el (c-electric-brace, c-electric-semi&comma, | ||
| 81 | c-electric-colon): Correct doc-strings: "/ln" -> "/la". | ||
| 82 | |||
| 83 | 2006-02-24 Martin Stjernholm <bug-cc-mode@gnu.org> | ||
| 84 | |||
| 85 | * progmodes/cc-langs.el (c-make-init-lang-vars-fun): Improved the | ||
| 86 | error message when there's an evaluation error to show whether | ||
| 87 | it's loaded from source or not. | ||
| 88 | (c-filter-ops): Made it available at runtime too to work when | ||
| 89 | `c-make-init-lang-vars-fun' needs to evaluate from source. | ||
| 90 | |||
| 1 | 2006-02-24 Juanma Barranquero <lekktu@gmail.com> | 91 | 2006-02-24 Juanma Barranquero <lekktu@gmail.com> |
| 2 | 92 | ||
| 3 | * help.el (help): Revert last part of 2006-02-23 change (deletion | 93 | * help.el (help): Revert last part of 2006-02-23 change (deletion |
diff --git a/lisp/progmodes/cc-align.el b/lisp/progmodes/cc-align.el index 8420ec99636..f1d5121bec5 100644 --- a/lisp/progmodes/cc-align.el +++ b/lisp/progmodes/cc-align.el | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | ;;; cc-align.el --- custom indentation functions for CC Mode | 1 | ;;; cc-align.el --- custom indentation functions 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 |
diff --git a/lisp/progmodes/cc-awk.el b/lisp/progmodes/cc-awk.el index 9f86638696c..284a2edbe94 100644 --- a/lisp/progmodes/cc-awk.el +++ b/lisp/progmodes/cc-awk.el | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | ;;; cc-awk.el --- AWK specific code within cc-mode. | 1 | ;;; cc-awk.el --- AWK specific code within cc-mode. |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 1988,94,96,2000, 2001, 2002, 2003, 2004, 2005, 2006 | 3 | ;; Copyright (C) 1988,94,96,2000, 2001, 2002, 2003, 2004, 2005, 2006 Free |
| 4 | ;; Free Software Foundation, Inc. | 4 | ;; Software Foundation, Inc. |
| 5 | 5 | ||
| 6 | ;; Author: Alan Mackenzie <acm@muc.de> (originally based on awk-mode.el) | 6 | ;; Author: Alan Mackenzie <acm@muc.de> (originally based on awk-mode.el) |
| 7 | ;; Maintainer: FSF | 7 | ;; Maintainer: FSF |
| @@ -804,7 +804,7 @@ | |||
| 804 | (defun c-awk-end-of-change-region (beg end old-len) | 804 | (defun c-awk-end-of-change-region (beg end old-len) |
| 805 | ;; Find the end of the region which needs to be font-locked after a change. | 805 | ;; Find the end of the region which needs to be font-locked after a change. |
| 806 | ;; This is the end of the logical line on which the change happened, either | 806 | ;; This is the end of the logical line on which the change happened, either |
| 807 | ;; as it was before the change, or as it is now, which ever is later. | 807 | ;; as it was before the change, or as it is now, whichever is later. |
| 808 | ;; N.B. point is left undefined. | 808 | ;; N.B. point is left undefined. |
| 809 | ;; | 809 | ;; |
| 810 | ;; This function might do hidden buffer changes. | 810 | ;; This function might do hidden buffer changes. |
| @@ -822,11 +822,12 @@ | |||
| 822 | (unless (and (boundp 'font-lock-mode) font-lock-mode) | 822 | (unless (and (boundp 'font-lock-mode) font-lock-mode) |
| 823 | (save-restriction | 823 | (save-restriction |
| 824 | (save-excursion | 824 | (save-excursion |
| 825 | (setq end (c-awk-end-of-change-region beg end old-len)) | 825 | (save-match-data |
| 826 | (c-awk-beginning-of-logical-line beg) | 826 | (setq end (c-awk-end-of-change-region beg end old-len)) |
| 827 | (c-save-buffer-state nil ; So that read-only status isn't affected. | 827 | (c-awk-beginning-of-logical-line beg) |
| 828 | (c-save-buffer-state nil ; So that read-only status isn't affected. | ||
| 828 | ; (e.g. when first loading the buffer) | 829 | ; (e.g. when first loading the buffer) |
| 829 | (c-awk-set-syntax-table-properties end)))))) | 830 | (c-awk-set-syntax-table-properties end))))))) |
| 830 | 831 | ||
| 831 | ;; ACM 2002/5/25. When font-locking is invoked by a buffer change, the region | 832 | ;; ACM 2002/5/25. When font-locking is invoked by a buffer change, the region |
| 832 | ;; specified by the font-lock after-change function must be expanded to | 833 | ;; specified by the font-lock after-change function must be expanded to |
diff --git a/lisp/progmodes/cc-bytecomp.el b/lisp/progmodes/cc-bytecomp.el index f001fa60b25..4a1e22d0c42 100644 --- a/lisp/progmodes/cc-bytecomp.el +++ b/lisp/progmodes/cc-bytecomp.el | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | ;;; cc-bytecomp.el --- compile time setup for proper compilation | 1 | ;;; cc-bytecomp.el --- compile time setup for proper compilation |
| 2 | 2 | ||
| 3 | ;; Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006 | 3 | ;; Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software |
| 4 | ;; Free Software Foundation, Inc. | 4 | ;; Foundation, Inc. |
| 5 | 5 | ||
| 6 | ;; Author: Martin Stjernholm | 6 | ;; Author: Martin Stjernholm |
| 7 | ;; Maintainer: bug-cc-mode@gnu.org | 7 | ;; Maintainer: bug-cc-mode@gnu.org |
diff --git a/lisp/progmodes/cc-cmds.el b/lisp/progmodes/cc-cmds.el index 4c8aa1518b7..8b2f5e57f83 100644 --- a/lisp/progmodes/cc-cmds.el +++ b/lisp/progmodes/cc-cmds.el | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | ;;; cc-cmds.el --- user level commands for CC Mode | 1 | ;;; cc-cmds.el --- user level commands 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 |
| @@ -262,10 +262,17 @@ With universal argument, inserts the analysis as a comment on that line." | |||
| 262 | (boundp 'c-subword-mode) | 262 | (boundp 'c-subword-mode) |
| 263 | (symbol-value 'c-subword-mode)) | 263 | (symbol-value 'c-subword-mode)) |
| 264 | "w" | 264 | "w" |
| 265 | "")))) | 265 | ""))) |
| 266 | (setq c-submode-indicators | 266 | (bare-mode-name (if (string-match "\\(^[^/]*\\)/" mode-name) |
| 267 | (substring mode-name (match-beginning 1) (match-end 1)) | ||
| 268 | mode-name))) | ||
| 269 | ;; (setq c-submode-indicators | ||
| 270 | ;; (if (> (length fmt) 1) | ||
| 271 | ;; fmt)) | ||
| 272 | (setq mode-name | ||
| 267 | (if (> (length fmt) 1) | 273 | (if (> (length fmt) 1) |
| 268 | fmt)) | 274 | (concat bare-mode-name fmt) |
| 275 | bare-mode-name)) | ||
| 269 | (force-mode-line-update))) | 276 | (force-mode-line-update))) |
| 270 | 277 | ||
| 271 | (defun c-toggle-syntactic-indentation (&optional arg) | 278 | (defun c-toggle-syntactic-indentation (&optional arg) |
| @@ -365,9 +372,9 @@ inside a literal then the function in the variable | |||
| 365 | arg | 372 | arg |
| 366 | (c-in-literal))) | 373 | (c-in-literal))) |
| 367 | (funcall c-backspace-function (prefix-numeric-value arg)) | 374 | (funcall c-backspace-function (prefix-numeric-value arg)) |
| 368 | (c-hungry-backspace))) | 375 | (c-hungry-delete-backwards))) |
| 369 | 376 | ||
| 370 | (defun c-hungry-backspace () | 377 | (defun c-hungry-delete-backwards () |
| 371 | "Delete the preceding character or all preceding whitespace | 378 | "Delete the preceding character or all preceding whitespace |
| 372 | back to the previous non-whitespace character. | 379 | back to the previous non-whitespace character. |
| 373 | See also \\[c-hungry-delete-forward]." | 380 | See also \\[c-hungry-delete-forward]." |
| @@ -378,6 +385,8 @@ See also \\[c-hungry-delete-forward]." | |||
| 378 | (delete-region (point) here) | 385 | (delete-region (point) here) |
| 379 | (funcall c-backspace-function 1)))) | 386 | (funcall c-backspace-function 1)))) |
| 380 | 387 | ||
| 388 | (defalias 'c-hungry-backspace 'c-hungry-delete-backwards) | ||
| 389 | |||
| 381 | (defun c-electric-delete-forward (arg) | 390 | (defun c-electric-delete-forward (arg) |
| 382 | "Delete the following character or whitespace. | 391 | "Delete the following character or whitespace. |
| 383 | If `c-hungry-delete-key' is non-nil (indicated by \"/h\" on the mode | 392 | If `c-hungry-delete-key' is non-nil (indicated by \"/h\" on the mode |
| @@ -396,7 +405,7 @@ is called." | |||
| 396 | (defun c-hungry-delete-forward () | 405 | (defun c-hungry-delete-forward () |
| 397 | "Delete the following character or all following whitespace | 406 | "Delete the following character or all following whitespace |
| 398 | up to the next non-whitespace character. | 407 | up to the next non-whitespace character. |
| 399 | See also \\[c-hungry-backspace]." | 408 | See also \\[c-hungry-delete-backwards]." |
| 400 | (interactive) | 409 | (interactive) |
| 401 | (let ((here (point))) | 410 | (let ((here (point))) |
| 402 | (c-skip-ws-forward) | 411 | (c-skip-ws-forward) |
| @@ -436,7 +445,7 @@ function to control that." | |||
| 436 | (if (and (fboundp 'delete-forward-p) | 445 | (if (and (fboundp 'delete-forward-p) |
| 437 | (delete-forward-p)) | 446 | (delete-forward-p)) |
| 438 | (c-hungry-delete-forward) | 447 | (c-hungry-delete-forward) |
| 439 | (c-hungry-backspace))) | 448 | (c-hungry-delete-backwards))) |
| 440 | 449 | ||
| 441 | (defun c-electric-pound (arg) | 450 | (defun c-electric-pound (arg) |
| 442 | "Insert a \"#\". | 451 | "Insert a \"#\". |
| @@ -648,7 +657,7 @@ If `c-electric-flag' is non-nil, the brace is not inside a literal and a | |||
| 648 | numeric ARG hasn't been supplied, the command performs several electric | 657 | numeric ARG hasn't been supplied, the command performs several electric |
| 649 | actions: | 658 | actions: |
| 650 | 659 | ||
| 651 | \(a) If the auto-newline feature is turned on (indicated by \"/ln\" on | 660 | \(a) If the auto-newline feature is turned on (indicated by \"/la\" on |
| 652 | the mode line) newlines are inserted before and after the brace as | 661 | the mode line) newlines are inserted before and after the brace as |
| 653 | directed by the settings in `c-hanging-braces-alist'. | 662 | directed by the settings in `c-hanging-braces-alist'. |
| 654 | 663 | ||
| @@ -752,7 +761,7 @@ settings of `c-cleanup-list' are done." | |||
| 752 | "{" | 761 | "{" |
| 753 | "\\=") | 762 | "\\=") |
| 754 | nil t)) | 763 | nil t)) |
| 755 | (delete-region mbeg mend) | 764 | (delete-region (match-beginning 0) (match-end 0)) |
| 756 | (insert-and-inherit "} else {")) | 765 | (insert-and-inherit "} else {")) |
| 757 | ((and (memq 'brace-elseif-brace c-cleanup-list) | 766 | ((and (memq 'brace-elseif-brace c-cleanup-list) |
| 758 | (progn | 767 | (progn |
| @@ -886,7 +895,7 @@ If `c-electric-flag' is non-nil, point isn't inside a literal and a | |||
| 886 | numeric ARG hasn't been supplied, the command performs several electric | 895 | numeric ARG hasn't been supplied, the command performs several electric |
| 887 | actions: | 896 | actions: |
| 888 | 897 | ||
| 889 | \(a) When the auto-newline feature is turned on (indicated by \"/ln\" on | 898 | \(a) When the auto-newline feature is turned on (indicated by \"/la\" on |
| 890 | the mode line) a newline might be inserted. See the variable | 899 | the mode line) a newline might be inserted. See the variable |
| 891 | `c-hanging-semi&comma-criteria' for how newline insertion is determined. | 900 | `c-hanging-semi&comma-criteria' for how newline insertion is determined. |
| 892 | 901 | ||
| @@ -958,7 +967,7 @@ If `c-electric-flag' is non-nil, the colon is not inside a literal and a | |||
| 958 | numeric ARG hasn't been supplied, the command performs several electric | 967 | numeric ARG hasn't been supplied, the command performs several electric |
| 959 | actions: | 968 | actions: |
| 960 | 969 | ||
| 961 | \(a) If the auto-newline feature is turned on (indicated by \"/ln\" on | 970 | \(a) If the auto-newline feature is turned on (indicated by \"/la\" on |
| 962 | the mode line) newlines are inserted before and after the colon based on | 971 | the mode line) newlines are inserted before and after the colon based on |
| 963 | the settings in `c-hanging-colons-alist'. | 972 | the settings in `c-hanging-colons-alist'. |
| 964 | 973 | ||
diff --git a/lisp/progmodes/cc-compat.el b/lisp/progmodes/cc-compat.el index 0cd7973857c..59cd5232402 100644 --- a/lisp/progmodes/cc-compat.el +++ b/lisp/progmodes/cc-compat.el | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | ;;; cc-compat.el --- cc-mode compatibility with c-mode.el confusion | 1 | ;;; cc-compat.el --- cc-mode compatibility with c-mode.el confusion |
| 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 | ;; 1994-1999 Barry A. Warsaw | 7 | ;; 1994-1999 Barry A. Warsaw |
diff --git a/lisp/progmodes/cc-defs.el b/lisp/progmodes/cc-defs.el index 0053cfcf443..d39c4880dcc 100644 --- a/lisp/progmodes/cc-defs.el +++ b/lisp/progmodes/cc-defs.el | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | ;;; cc-defs.el --- compile time definitions for CC Mode | 1 | ;;; cc-defs.el --- compile time definitions 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 |
| @@ -71,10 +71,10 @@ | |||
| 71 | 71 | ||
| 72 | (eval-after-load "font-lock" | 72 | (eval-after-load "font-lock" |
| 73 | '(if (and (not (featurep 'cc-fix)) ; only load the file once. | 73 | '(if (and (not (featurep 'cc-fix)) ; only load the file once. |
| 74 | (featurep 'xemacs) ; There is now (2005/12) code in GNU Emacs CVS | ||
| 75 | ; to make the call to f-l-c-k throw an error. | ||
| 74 | (let (font-lock-keywords) | 76 | (let (font-lock-keywords) |
| 75 | (condition-case nil | 77 | (font-lock-compile-keywords '("\\<\\>")) |
| 76 | (font-lock-compile-keywords '("\\<\\>")) | ||
| 77 | (error nil)) | ||
| 78 | font-lock-keywords)) ; did the previous call foul this up? | 78 | font-lock-keywords)) ; did the previous call foul this up? |
| 79 | (load "cc-fix"))) | 79 | (load "cc-fix"))) |
| 80 | 80 | ||
| @@ -82,19 +82,18 @@ | |||
| 82 | ;; to ensure correct byte compilation. | 82 | ;; to ensure correct byte compilation. |
| 83 | (eval-when-compile | 83 | (eval-when-compile |
| 84 | (if (and (not (featurep 'cc-fix)) | 84 | (if (and (not (featurep 'cc-fix)) |
| 85 | (featurep 'xemacs) | ||
| 85 | (progn | 86 | (progn |
| 86 | (require 'font-lock) | 87 | (require 'font-lock) |
| 87 | (let (font-lock-keywords) | 88 | (let (font-lock-keywords) |
| 88 | (condition-case nil | 89 | (font-lock-compile-keywords '("\\<\\>")) |
| 89 | (font-lock-compile-keywords '("\\<\\>")) | ||
| 90 | (error nil)) | ||
| 91 | font-lock-keywords))) | 90 | font-lock-keywords))) |
| 92 | (cc-load "cc-fix"))) | 91 | (cc-load "cc-fix"))) |
| 93 | 92 | ||
| 94 | 93 | ||
| 95 | ;;; Variables also used at compile time. | 94 | ;;; Variables also used at compile time. |
| 96 | 95 | ||
| 97 | (defconst c-version "5.31" | 96 | (defconst c-version "5.31.3" |
| 98 | "CC Mode version number.") | 97 | "CC Mode version number.") |
| 99 | 98 | ||
| 100 | (defconst c-version-sym (intern c-version)) | 99 | (defconst c-version-sym (intern c-version)) |
| @@ -2041,5 +2040,5 @@ quoted." | |||
| 2041 | 2040 | ||
| 2042 | (cc-provide 'cc-defs) | 2041 | (cc-provide 'cc-defs) |
| 2043 | 2042 | ||
| 2044 | ;; arch-tag: 3bb2629d-dd84-4ff0-ad39-584be0fe3cda | 2043 | ;;; arch-tag: 3bb2629d-dd84-4ff0-ad39-584be0fe3cda |
| 2045 | ;;; cc-defs.el ends here | 2044 | ;;; cc-defs.el ends here |
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index 548fc74d961..32c82eb1c1d 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | ;;; cc-engine.el --- core syntax guessing engine for CC mode | 1 | ;;; cc-engine.el --- core syntax guessing engine 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 Foundation, |
| 4 | ;; Free Software Foundation, Inc. | 4 | ;; 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 |
| @@ -179,8 +179,8 @@ | |||
| 179 | (make-variable-buffer-local 'c-auto-newline) | 179 | (make-variable-buffer-local 'c-auto-newline) |
| 180 | 180 | ||
| 181 | ;; Included in the mode line to indicate the active submodes. | 181 | ;; Included in the mode line to indicate the active submodes. |
| 182 | (defvar c-submode-indicators nil) | 182 | ;; (defvar c-submode-indicators nil) |
| 183 | (make-variable-buffer-local 'c-submode-indicators) | 183 | ;; (make-variable-buffer-local 'c-submode-indicators) |
| 184 | 184 | ||
| 185 | (defun c-calculate-state (arg prevstate) | 185 | (defun c-calculate-state (arg prevstate) |
| 186 | ;; Calculate the new state of PREVSTATE, t or nil, based on arg. If | 186 | ;; Calculate the new state of PREVSTATE, t or nil, based on arg. If |
| @@ -525,14 +525,15 @@ also stop at a continuation clause. | |||
| 525 | 525 | ||
| 526 | Labels are treated as part of the following statements if | 526 | Labels are treated as part of the following statements if |
| 527 | IGNORE-LABELS is non-nil. (FIXME: Doesn't work if we stop at a known | 527 | IGNORE-LABELS is non-nil. (FIXME: Doesn't work if we stop at a known |
| 528 | statement start keyword.) | 528 | statement start keyword.) Otherwise, each label is treated as a |
| 529 | separate statement. | ||
| 529 | 530 | ||
| 530 | Macros are ignored unless point is within one, in which case the | 531 | Macros are ignored \(i.e. skipped over) unless point is within one, in |
| 531 | content of the macro is treated as normal code. Aside from any normal | 532 | which case the content of the macro is treated as normal code. Aside |
| 532 | statement starts found in it, stop at the first token of the content | 533 | from any normal statement starts found in it, stop at the first token |
| 533 | in the macro, i.e. the expression of an \"#if\" or the start of the | 534 | of the content in the macro, i.e. the expression of an \"#if\" or the |
| 534 | definition in a \"#define\". Also stop at start of macros before | 535 | start of the definition in a \"#define\". Also stop at start of |
| 535 | leaving them. | 536 | macros before leaving them. |
| 536 | 537 | ||
| 537 | Return 'label if stopped at a label, 'same if stopped at the beginning | 538 | Return 'label if stopped at a label, 'same if stopped at the beginning |
| 538 | of the current statement, 'up if stepped to a containing statement, | 539 | of the current statement, 'up if stepped to a containing statement, |
| @@ -547,8 +548,9 @@ position if that is less ('same is returned in this case). | |||
| 547 | 548 | ||
| 548 | NOERROR turns off error logging to `c-parsing-error'. | 549 | NOERROR turns off error logging to `c-parsing-error'. |
| 549 | 550 | ||
| 550 | Normally only ';' is considered to delimit statements, but if | 551 | Normally only ';' and virtual semicolons are considered to delimit |
| 551 | COMMA-DELIM is non-nil then ',' is treated likewise. | 552 | statements, but if COMMA-DELIM is non-nil then ',' is treated |
| 553 | as a delimiter too. | ||
| 552 | 554 | ||
| 553 | Note that this function might do hidden buffer changes. See the | 555 | Note that this function might do hidden buffer changes. See the |
| 554 | comment at the start of cc-engine.el for more info." | 556 | comment at the start of cc-engine.el for more info." |
| @@ -883,6 +885,7 @@ comment at the start of cc-engine.el for more info." | |||
| 883 | ;; barriers in this round. | 885 | ;; barriers in this round. |
| 884 | (sexp-loop-end-pos pos)) | 886 | (sexp-loop-end-pos pos)) |
| 885 | 887 | ||
| 888 | ;; The following while goes back one sexp per iteration. | ||
| 886 | (while | 889 | (while |
| 887 | (progn | 890 | (progn |
| 888 | (unless (c-safe (c-backward-sexp) t) | 891 | (unless (c-safe (c-backward-sexp) t) |
| @@ -954,7 +957,7 @@ comment at the start of cc-engine.el for more info." | |||
| 954 | ;; Like a C "continue". Analyze the next sexp. | 957 | ;; Like a C "continue". Analyze the next sexp. |
| 955 | (throw 'loop t))) | 958 | (throw 'loop t))) |
| 956 | 959 | ||
| 957 | sexp-loop-continue-pos) | 960 | sexp-loop-continue-pos) ; End of "go back a sexp" loop. |
| 958 | (goto-char sexp-loop-continue-pos) | 961 | (goto-char sexp-loop-continue-pos) |
| 959 | (setq sexp-loop-end-pos sexp-loop-continue-pos | 962 | (setq sexp-loop-end-pos sexp-loop-continue-pos |
| 960 | sexp-loop-continue-pos nil)))) | 963 | sexp-loop-continue-pos nil)))) |
| @@ -969,17 +972,26 @@ comment at the start of cc-engine.el for more info." | |||
| 969 | ;; Handle labels. | 972 | ;; Handle labels. |
| 970 | (unless (eq ignore-labels t) | 973 | (unless (eq ignore-labels t) |
| 971 | (when (numberp c-maybe-labelp) | 974 | (when (numberp c-maybe-labelp) |
| 972 | ;; `c-crosses-statement-barrier-p' has found a | 975 | ;; `c-crosses-statement-barrier-p' has found a colon, so we |
| 973 | ;; colon, so we might be in a label now. | 976 | ;; might be in a label now. Have we got a real label |
| 974 | (if after-labels-pos | 977 | ;; (including a case label) or something like C++'s "public:"? |
| 975 | (if (not last-label-pos) | 978 | (if (or (not (looking-at c-nonlabel-token-key)) ; proper label |
| 976 | (setq last-label-pos (or tok start))) | 979 | (save-excursion ; e.g. "case 'a':" ? |
| 977 | (setq after-labels-pos (or tok start))) | 980 | (and (c-safe (c-backward-sexp) t) |
| 978 | (setq c-maybe-labelp t | 981 | (looking-at "\\<case\\>")))) ; FIXME!!! this is |
| 979 | label-good-pos nil)) | 982 | ; wrong for AWK. 2006/1/14. |
| 980 | 983 | (progn | |
| 981 | (when (and (not label-good-pos) | 984 | (if after-labels-pos ; Have we already encountered a label? |
| 982 | (looking-at c-nonlabel-token-key)) | 985 | (if (not last-label-pos) |
| 986 | (setq last-label-pos (or tok start))) | ||
| 987 | (setq after-labels-pos (or tok start))) | ||
| 988 | (setq c-maybe-labelp t | ||
| 989 | label-good-pos nil)) | ||
| 990 | (setq c-maybe-labelp nil))) ; bogus "label" | ||
| 991 | |||
| 992 | (when (and (not label-good-pos) ; i.e. no invalid "label"'s yet | ||
| 993 | ; been found. | ||
| 994 | (looking-at c-nonlabel-token-key)) ; e.g. "while :" | ||
| 983 | ;; We're in a potential label and it's the first | 995 | ;; We're in a potential label and it's the first |
| 984 | ;; time we've found something that isn't allowed in | 996 | ;; time we've found something that isn't allowed in |
| 985 | ;; one. | 997 | ;; one. |
| @@ -3993,36 +4005,35 @@ comment at the start of cc-engine.el for more info." | |||
| 3993 | ;; | 4005 | ;; |
| 3994 | ;; This function might do hidden buffer changes. | 4006 | ;; This function might do hidden buffer changes. |
| 3995 | 4007 | ||
| 3996 | (save-match-data | 4008 | (save-excursion |
| 3997 | (save-excursion | 4009 | (goto-char beg) |
| 4010 | (when (or (looking-at "[<>]") | ||
| 4011 | (< (skip-chars-backward "<>") 0)) | ||
| 4012 | |||
| 3998 | (goto-char beg) | 4013 | (goto-char beg) |
| 4014 | (c-beginning-of-current-token) | ||
| 4015 | (when (and (< (point) beg) | ||
| 4016 | (looking-at c-<>-multichar-token-regexp) | ||
| 4017 | (< beg (setq beg (match-end 0)))) | ||
| 4018 | (while (progn (skip-chars-forward "^<>" beg) | ||
| 4019 | (< (point) beg)) | ||
| 4020 | (c-clear-char-property (point) 'syntax-table) | ||
| 4021 | (forward-char)))) | ||
| 4022 | |||
| 4023 | (when (< beg end) | ||
| 4024 | (goto-char end) | ||
| 3999 | (when (or (looking-at "[<>]") | 4025 | (when (or (looking-at "[<>]") |
| 4000 | (< (skip-chars-backward "<>") 0)) | 4026 | (< (skip-chars-backward "<>") 0)) |
| 4001 | 4027 | ||
| 4002 | (goto-char beg) | 4028 | (goto-char end) |
| 4003 | (c-beginning-of-current-token) | 4029 | (c-beginning-of-current-token) |
| 4004 | (when (and (< (point) beg) | 4030 | (when (and (< (point) end) |
| 4005 | (looking-at c-<>-multichar-token-regexp) | 4031 | (looking-at c-<>-multichar-token-regexp) |
| 4006 | (< beg (setq beg (match-end 0)))) | 4032 | (< end (setq end (match-end 0)))) |
| 4007 | (while (progn (skip-chars-forward "^<>" beg) | 4033 | (while (progn (skip-chars-forward "^<>" end) |
| 4008 | (< (point) beg)) | 4034 | (< (point) end)) |
| 4009 | (c-clear-char-property (point) 'syntax-table) | 4035 | (c-clear-char-property (point) 'syntax-table) |
| 4010 | (forward-char)))) | 4036 | (forward-char))))))) |
| 4011 | |||
| 4012 | (when (< beg end) | ||
| 4013 | (goto-char end) | ||
| 4014 | (when (or (looking-at "[<>]") | ||
| 4015 | (< (skip-chars-backward "<>") 0)) | ||
| 4016 | |||
| 4017 | (goto-char end) | ||
| 4018 | (c-beginning-of-current-token) | ||
| 4019 | (when (and (< (point) end) | ||
| 4020 | (looking-at c-<>-multichar-token-regexp) | ||
| 4021 | (< end (setq end (match-end 0)))) | ||
| 4022 | (while (progn (skip-chars-forward "^<>" end) | ||
| 4023 | (< (point) end)) | ||
| 4024 | (c-clear-char-property (point) 'syntax-table) | ||
| 4025 | (forward-char)))))))) | ||
| 4026 | 4037 | ||
| 4027 | ;; Dynamically bound variable that instructs `c-forward-type' to also | 4038 | ;; Dynamically bound variable that instructs `c-forward-type' to also |
| 4028 | ;; treat possible types (i.e. those that it normally returns 'maybe or | 4039 | ;; treat possible types (i.e. those that it normally returns 'maybe or |
| @@ -5991,7 +6002,10 @@ y ;; True if there's a suffix match outside the outermost | |||
| 5991 | 6002 | ||
| 5992 | ;; Handle the name of the class itself. | 6003 | ;; Handle the name of the class itself. |
| 5993 | (progn | 6004 | (progn |
| 5994 | (c-forward-token-2) | 6005 | ; (c-forward-token-2) ; 2006/1/13 This doesn't move if the token's |
| 6006 | ; at EOB. | ||
| 6007 | (goto-char (match-end 0)) | ||
| 6008 | (c-skip-ws-forward) | ||
| 5995 | (c-forward-type)) | 6009 | (c-forward-type)) |
| 5996 | 6010 | ||
| 5997 | (catch 'break | 6011 | (catch 'break |
diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el index bea3b4f7e8c..b02df16b4f5 100644 --- a/lisp/progmodes/cc-langs.el +++ b/lisp/progmodes/cc-langs.el | |||
| @@ -1,7 +1,7 @@ | |||
| 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 |
| @@ -177,7 +177,7 @@ the evaluated constant value at compile time." | |||
| 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) |
| @@ -260,10 +260,14 @@ the evaluated constant value at compile time." | |||
| 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. |
| @@ -2826,7 +2830,7 @@ accomplish that conveniently." | |||
| 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) |
| @@ -2852,6 +2856,7 @@ accomplish that conveniently." | |||
| 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)) |
| @@ -2860,8 +2865,14 @@ accomplish that conveniently." | |||
| 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 |
| @@ -2881,8 +2892,9 @@ accomplish that conveniently." | |||
| 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 | ||
diff --git a/lisp/progmodes/cc-menus.el b/lisp/progmodes/cc-menus.el index 418823b71fa..b925d1e653c 100644 --- a/lisp/progmodes/cc-menus.el +++ b/lisp/progmodes/cc-menus.el | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | ;;; cc-menus.el --- imenu support for CC Mode | 1 | ;;; cc-menus.el --- imenu support 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 |
diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el index 3994fe5cf09..9eebdb2bb7f 100644 --- a/lisp/progmodes/cc-mode.el +++ b/lisp/progmodes/cc-mode.el | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | ;;; cc-mode.el --- major mode for editing C and similar languages | 1 | ;;; cc-mode.el --- major mode for editing C and similar languages |
| 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: 2003- Alan Mackenzie | 6 | ;; Authors: 2003- Alan Mackenzie |
| 7 | ;; 1998- Martin Stjernholm | 7 | ;; 1998- Martin Stjernholm |
| @@ -242,9 +242,9 @@ control). See \"cc-mode.el\" for more info." | |||
| 242 | (define-key c-mode-base-map (kbd "C-c C-<delete>") | 242 | (define-key c-mode-base-map (kbd "C-c C-<delete>") |
| 243 | 'c-hungry-delete-forward) | 243 | 'c-hungry-delete-forward) |
| 244 | (define-key c-mode-base-map (kbd "C-c C-<backspace>") | 244 | (define-key c-mode-base-map (kbd "C-c C-<backspace>") |
| 245 | 'c-hungry-backspace)) | 245 | 'c-hungry-delete-backwards)) |
| 246 | (define-key c-mode-base-map (kbd "C-c C-<delete>") | 246 | (define-key c-mode-base-map (kbd "C-c C-<delete>") |
| 247 | 'c-hungry-backspace) | 247 | 'c-hungry-delete-backwards) |
| 248 | (define-key c-mode-base-map (kbd "C-c C-<backspace>") | 248 | (define-key c-mode-base-map (kbd "C-c C-<backspace>") |
| 249 | 'c-hungry-delete-forward))) | 249 | 'c-hungry-delete-forward))) |
| 250 | 250 | ||
| @@ -304,10 +304,11 @@ control). See \"cc-mode.el\" for more info." | |||
| 304 | ;; `c-electric-backspace'. The hungry variants are bound to the | 304 | ;; `c-electric-backspace'. The hungry variants are bound to the |
| 305 | ;; same keys but prefixed with C-c. This implies that C-c C-d is | 305 | ;; same keys but prefixed with C-c. This implies that C-c C-d is |
| 306 | ;; `c-hungry-delete-forward'. For consistency, we bind not only C-c | 306 | ;; `c-hungry-delete-forward'. For consistency, we bind not only C-c |
| 307 | ;; <backspace> to `c-hungry-backspace' but also C-c C-<backspace>, | 307 | ;; <backspace> to `c-hungry-delete-backwards' but also |
| 308 | ;; so that the Ctrl key can be held down during the whole sequence | 308 | ;; C-c C-<backspace>, so that the Ctrl key can be held down during |
| 309 | ;; regardless of the direction. This in turn implies that we bind | 309 | ;; the whole sequence regardless of the direction. This in turn |
| 310 | ;; C-c C-<delete> to `c-hungry-delete-forward', for the same reason. | 310 | ;; implies that we bind C-c C-<delete> to `c-hungry-delete-forward', |
| 311 | ;; for the same reason. | ||
| 311 | 312 | ||
| 312 | ;; Bind the electric deletion functions to C-d and DEL. Emacs 21 | 313 | ;; Bind the electric deletion functions to C-d and DEL. Emacs 21 |
| 313 | ;; automatically maps the [delete] and [backspace] keys to these two | 314 | ;; automatically maps the [delete] and [backspace] keys to these two |
| @@ -316,8 +317,8 @@ control). See \"cc-mode.el\" for more info." | |||
| 316 | (define-key c-mode-base-map "\C-d" 'c-electric-delete-forward) | 317 | (define-key c-mode-base-map "\C-d" 'c-electric-delete-forward) |
| 317 | (define-key c-mode-base-map "\177" 'c-electric-backspace) | 318 | (define-key c-mode-base-map "\177" 'c-electric-backspace) |
| 318 | (define-key c-mode-base-map "\C-c\C-d" 'c-hungry-delete-forward) | 319 | (define-key c-mode-base-map "\C-c\C-d" 'c-hungry-delete-forward) |
| 319 | (define-key c-mode-base-map [?\C-c ?\d] 'c-hungry-backspace) | 320 | (define-key c-mode-base-map [?\C-c ?\d] 'c-hungry-delete-backwards) |
| 320 | (define-key c-mode-base-map [?\C-c ?\C-\d] 'c-hungry-backspace) | 321 | (define-key c-mode-base-map [?\C-c ?\C-\d] 'c-hungry-delete-backwards) |
| 321 | (define-key c-mode-base-map [?\C-c deletechar] 'c-hungry-delete-forward) ; C-c <delete> on a tty. | 322 | (define-key c-mode-base-map [?\C-c deletechar] 'c-hungry-delete-forward) ; C-c <delete> on a tty. |
| 322 | (define-key c-mode-base-map [?\C-c (control deletechar)] ; C-c C-<delete> on a tty. | 323 | (define-key c-mode-base-map [?\C-c (control deletechar)] ; C-c C-<delete> on a tty. |
| 323 | 'c-hungry-delete-forward) | 324 | 'c-hungry-delete-forward) |
| @@ -339,8 +340,10 @@ control). See \"cc-mode.el\" for more info." | |||
| 339 | (define-key c-mode-base-map [backspace] 'c-electric-backspace) | 340 | (define-key c-mode-base-map [backspace] 'c-electric-backspace) |
| 340 | (define-key c-mode-base-map (kbd "C-c <delete>") 'c-hungry-delete) | 341 | (define-key c-mode-base-map (kbd "C-c <delete>") 'c-hungry-delete) |
| 341 | (define-key c-mode-base-map (kbd "C-c C-<delete>") 'c-hungry-delete) | 342 | (define-key c-mode-base-map (kbd "C-c C-<delete>") 'c-hungry-delete) |
| 342 | (define-key c-mode-base-map (kbd "C-c <backspace>") 'c-hungry-backspace) | 343 | (define-key c-mode-base-map (kbd "C-c <backspace>") |
| 343 | (define-key c-mode-base-map (kbd "C-c C-<backspace>") 'c-hungry-backspace)) | 344 | 'c-hungry-delete-backwards) |
| 345 | (define-key c-mode-base-map (kbd "C-c C-<backspace>") | ||
| 346 | 'c-hungry-delete-backwards)) | ||
| 344 | 347 | ||
| 345 | (define-key c-mode-base-map "#" 'c-electric-pound) | 348 | (define-key c-mode-base-map "#" 'c-electric-pound) |
| 346 | (define-key c-mode-base-map "{" 'c-electric-brace) | 349 | (define-key c-mode-base-map "{" 'c-electric-brace) |
| @@ -414,23 +417,24 @@ preferably use the `c-mode-menu' language constant directly." | |||
| 414 | ;; with regions outside the current narrowing. This has been | 417 | ;; with regions outside the current narrowing. This has been |
| 415 | ;; observed in Emacs 20.7. | 418 | ;; observed in Emacs 20.7. |
| 416 | (save-restriction | 419 | (save-restriction |
| 417 | (widen) | 420 | (save-match-data ; c-recognize-<>-arglists changes match-data |
| 421 | (widen) | ||
| 418 | 422 | ||
| 419 | (when (> end (point-max)) | 423 | (when (> end (point-max)) |
| 420 | ;; Some emacsen might return positions past the end. This has been | 424 | ;; Some emacsen might return positions past the end. This has been |
| 421 | ;; observed in Emacs 20.7 when rereading a buffer changed on disk | 425 | ;; observed in Emacs 20.7 when rereading a buffer changed on disk |
| 422 | ;; (haven't been able to minimize it, but Emacs 21.3 appears to | 426 | ;; (haven't been able to minimize it, but Emacs 21.3 appears to |
| 423 | ;; work). | 427 | ;; work). |
| 424 | (setq end (point-max)) | 428 | (setq end (point-max)) |
| 425 | (when (> beg end) | 429 | (when (> beg end) |
| 426 | (setq beg end))) | 430 | (setq beg end))) |
| 427 | 431 | ||
| 428 | (c-invalidate-sws-region-after beg end) | 432 | (c-invalidate-sws-region-after beg end) |
| 429 | (c-invalidate-state-cache beg) | 433 | (c-invalidate-state-cache beg) |
| 430 | (c-invalidate-find-decl-cache beg) | 434 | (c-invalidate-find-decl-cache beg) |
| 431 | 435 | ||
| 432 | (when c-recognize-<>-arglists | 436 | (when c-recognize-<>-arglists |
| 433 | (c-after-change-check-<>-operators beg end))))) | 437 | (c-after-change-check-<>-operators beg end)))))) |
| 434 | 438 | ||
| 435 | (defun c-basic-common-init (mode default-style) | 439 | (defun c-basic-common-init (mode default-style) |
| 436 | "Do the necessary initialization for the syntax handling routines | 440 | "Do the necessary initialization for the syntax handling routines |
| @@ -550,11 +554,12 @@ that requires a literal mode spec at compile time." | |||
| 550 | (make-local-variable 'comment-indent-function) | 554 | (make-local-variable 'comment-indent-function) |
| 551 | (setq comment-indent-function 'c-comment-indent) | 555 | (setq comment-indent-function 'c-comment-indent) |
| 552 | 556 | ||
| 553 | ;; Put submode indicators onto minor-mode-alist, but only once. | 557 | ;; ;; Put submode indicators onto minor-mode-alist, but only once. |
| 554 | (or (assq 'c-submode-indicators minor-mode-alist) | 558 | ;; (or (assq 'c-submode-indicators minor-mode-alist) |
| 555 | (setq minor-mode-alist | 559 | ;; (setq minor-mode-alist |
| 556 | (cons '(c-submode-indicators c-submode-indicators) | 560 | ;; (cons '(c-submode-indicators c-submode-indicators) |
| 557 | minor-mode-alist))) | 561 | ;; minor-mode-alist))) |
| 562 | (c-update-modeline) | ||
| 558 | 563 | ||
| 559 | ;; Install the functions that ensure that various internal caches | 564 | ;; Install the functions that ensure that various internal caches |
| 560 | ;; don't become invalid due to buffer changes. | 565 | ;; don't become invalid due to buffer changes. |
| @@ -629,6 +634,51 @@ compatible with old code; callers should always specify it." | |||
| 629 | (and (cdr rfn) | 634 | (and (cdr rfn) |
| 630 | (setq require-final-newline mode-require-final-newline))))) | 635 | (setq require-final-newline mode-require-final-newline))))) |
| 631 | 636 | ||
| 637 | (defun c-remove-any-local-eval-or-mode-variables () | ||
| 638 | ;; If the buffer specifies `mode' or `eval' in its File Local Variable list | ||
| 639 | ;; or on the first line, remove all occurrences. See | ||
| 640 | ;; `c-postprocess-file-styles' for justification. There is no need to save | ||
| 641 | ;; point here, or even bother too much about the buffer contents. | ||
| 642 | ;; | ||
| 643 | ;; Most of the code here is derived from Emacs 21.3's `hack-local-variables' | ||
| 644 | ;; in files.el. | ||
| 645 | (goto-char (point-max)) | ||
| 646 | (search-backward "\n\^L" (max (- (point-max) 3000) (point-min)) 'move) | ||
| 647 | (let (lv-point (prefix "") (suffix "")) | ||
| 648 | (when (let ((case-fold-search t)) | ||
| 649 | (search-forward "Local Variables:" nil t)) | ||
| 650 | (setq lv-point (point)) | ||
| 651 | ;; The prefix is what comes before "local variables:" in its line. | ||
| 652 | ;; The suffix is what comes after "local variables:" in its line. | ||
| 653 | (skip-chars-forward " \t") | ||
| 654 | (or (eolp) | ||
| 655 | (setq suffix (buffer-substring (point) | ||
| 656 | (progn (end-of-line) (point))))) | ||
| 657 | (goto-char (match-beginning 0)) | ||
| 658 | (or (bolp) | ||
| 659 | (setq prefix | ||
| 660 | (buffer-substring (point) | ||
| 661 | (progn (beginning-of-line) (point))))) | ||
| 662 | |||
| 663 | (while (search-forward-regexp | ||
| 664 | (concat "^[ \t]*" | ||
| 665 | (regexp-quote prefix) | ||
| 666 | "\\(mode\\|eval\\):.*" | ||
| 667 | (regexp-quote suffix) | ||
| 668 | "$") | ||
| 669 | nil t) | ||
| 670 | (beginning-of-line) | ||
| 671 | (kill-line 1))) | ||
| 672 | |||
| 673 | ;; Delete the first line, if we've got one, in case it contains a mode spec. | ||
| 674 | (unless (and lv-point | ||
| 675 | (progn (goto-char lv-point) | ||
| 676 | (forward-line 0) | ||
| 677 | (bobp))) | ||
| 678 | (goto-char (point-min)) | ||
| 679 | (unless (eobp) | ||
| 680 | (kill-line 1))))) | ||
| 681 | |||
| 632 | (defun c-postprocess-file-styles () | 682 | (defun c-postprocess-file-styles () |
| 633 | "Function that post processes relevant file local variables in CC Mode. | 683 | "Function that post processes relevant file local variables in CC Mode. |
| 634 | Currently, this function simply applies any style and offset settings | 684 | Currently, this function simply applies any style and offset settings |
| @@ -656,12 +706,20 @@ Note that the style variables are always made local to the buffer." | |||
| 656 | ;; overwritten this. So we run `hack-local-variables' again to remedy | 706 | ;; overwritten this. So we run `hack-local-variables' again to remedy |
| 657 | ;; this. There are no guarantees this will work properly, particularly as | 707 | ;; this. There are no guarantees this will work properly, particularly as |
| 658 | ;; we have no control over what the other hook functions on | 708 | ;; we have no control over what the other hook functions on |
| 659 | ;; `hack-local-variables-hook' would have done, or what any "eval" | 709 | ;; `hack-local-variables-hook' would have done. We now (2006/2/1) remove |
| 660 | ;; expression will do when evaluated again. C'est la vie! ACM, | 710 | ;; any `eval' or `mode' expressions before we evaluate again (see below). |
| 661 | ;; 2005/11/2. | 711 | ;; ACM, 2005/11/2. |
| 712 | ;; | ||
| 713 | ;; Problem (bug reported by Gustav Broberg): if one of the variables is | ||
| 714 | ;; `mode', this will invoke c-mode (etc.) again, setting up the style etc. | ||
| 715 | ;; We prevent this by temporarily removing `mode' from the Local Variables | ||
| 716 | ;; section. | ||
| 662 | (if (or c-file-style c-file-offsets) | 717 | (if (or c-file-style c-file-offsets) |
| 663 | (let ((hack-local-variables-hook nil)) | 718 | (c-tentative-buffer-changes |
| 664 | (hack-local-variables))))) | 719 | (let ((hack-local-variables-hook nil)) |
| 720 | (c-remove-any-local-eval-or-mode-variables) | ||
| 721 | (hack-local-variables)) | ||
| 722 | nil)))) | ||
| 665 | 723 | ||
| 666 | (add-hook 'hack-local-variables-hook 'c-postprocess-file-styles) | 724 | (add-hook 'hack-local-variables-hook 'c-postprocess-file-styles) |
| 667 | 725 | ||
diff --git a/lisp/progmodes/cc-styles.el b/lisp/progmodes/cc-styles.el index 758720a3fd6..6f623623535 100644 --- a/lisp/progmodes/cc-styles.el +++ b/lisp/progmodes/cc-styles.el | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | ;;; cc-styles.el --- support for styles in CC Mode | 1 | ;;; cc-styles.el --- support for styles in 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 |
diff --git a/lisp/progmodes/cc-vars.el b/lisp/progmodes/cc-vars.el index 9bde0c5dbaf..ee187408701 100644 --- a/lisp/progmodes/cc-vars.el +++ b/lisp/progmodes/cc-vars.el | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | ;;; cc-vars.el --- user customization variables for CC Mode | 1 | ;;; cc-vars.el --- user customization variables 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 |