diff options
| author | Martin Stjernholm | 2003-04-07 22:45:18 +0000 |
|---|---|---|
| committer | Martin Stjernholm | 2003-04-07 22:45:18 +0000 |
| commit | 1f645835e9a3321eb4f0c68d9b93b5a9ff8d04b0 (patch) | |
| tree | 617786f877f6de780504b643d28b60eeaab1f918 | |
| parent | 39c9a034e3ccfe0810714b08fce7dab716fdd4ad (diff) | |
| download | emacs-1f645835e9a3321eb4f0c68d9b93b5a9ff8d04b0.tar.gz emacs-1f645835e9a3321eb4f0c68d9b93b5a9ff8d04b0.zip | |
(c-symbol-key): Use POSIX char classes to match symbols in Emacs 21.
This makes CC Mode cope with the full range of identifier characters
in e.g. Java.
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/progmodes/cc-langs.el | 20 |
2 files changed, 15 insertions, 11 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 268119e36ac..23e4268888b 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2003-04-08 Martin Stjernholm <bug-cc-mode@gnu.org> | ||
| 2 | |||
| 3 | * progmodes/cc-langs.el (c-symbol-key): Use POSIX char classes | ||
| 4 | to match symbols. This makes CC Mode cope with the full range | ||
| 5 | of identifier characters in e.g. Java. | ||
| 6 | |||
| 1 | 2003-04-07 Francesco Potort,Al(B <pot@gnu.org> | 7 | 2003-04-07 Francesco Potort,Al(B <pot@gnu.org> |
| 2 | 8 | ||
| 3 | * xt-mouse.el (xterm-mouse-event-read): New function. | 9 | * xt-mouse.el (xterm-mouse-event-read): New function. |
diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el index 3dc9e8b7dbd..663f0d1df84 100644 --- a/lisp/progmodes/cc-langs.el +++ b/lisp/progmodes/cc-langs.el | |||
| @@ -181,18 +181,16 @@ appended." | |||
| 181 | ) | 181 | ) |
| 182 | 182 | ||
| 183 | ;; Regexp describing a `symbol' in all languages, not excluding | 183 | ;; Regexp describing a `symbol' in all languages, not excluding |
| 184 | ;; keywords. We cannot use just `word' syntax class since `_' cannot | 184 | ;; keywords. |
| 185 | ;; be in word class. Putting underscore in word class breaks forward | ||
| 186 | ;; word movement behavior that users are familiar with. Besides, it | ||
| 187 | ;; runs counter to Emacs convention. | ||
| 188 | ;; | ||
| 189 | ;; This definition isn't correct for the first character in the | ||
| 190 | ;; languages that accept the full range of Unicode word constituents | ||
| 191 | ;; in identifiers (e.g. Java and Pike). For that we'd need to make a | ||
| 192 | ;; regexp that matches all characters in the word constituent class | ||
| 193 | ;; except 0-9, and the regexp engine currently can't do that. | ||
| 194 | (c-lang-defconst c-symbol-key | 185 | (c-lang-defconst c-symbol-key |
| 195 | (c c++ objc java idl) "[_a-zA-Z]\\(\\w\\|\\s_\\)*" | 186 | (c c++ objc java idl) |
| 187 | (if (string-match "[[:alpha:]]" "a") | ||
| 188 | "[[:alpha:]_][[:alnum:]_]*" ; Emacs 21. | ||
| 189 | ;; We cannot use just `word' syntax class since `_' cannot be | ||
| 190 | ;; in word class. Putting underscore in word class breaks | ||
| 191 | ;; forward word movement behavior that users are familiar | ||
| 192 | ;; with. Besides, it runs counter to Emacs convention. | ||
| 193 | "[a-zA-Z_]\\(\\w\\|_\\)*") | ||
| 196 | pike (concat "\\(" (c-lang-var c-symbol-key c) "\\|" | 194 | pike (concat "\\(" (c-lang-var c-symbol-key c) "\\|" |
| 197 | (c-make-keywords-re nil | 195 | (c-make-keywords-re nil |
| 198 | '("`+" "`-" "`&" "`|" "`^" "`<<" "`>>" "`*" "`/" "`%" "`~" | 196 | '("`+" "`-" "`&" "`|" "`^" "`<<" "`>>" "`*" "`/" "`%" "`~" |