From: Martin Stjernholm Date: Mon, 7 Apr 2003 22:45:18 +0000 (+0000) Subject: (c-symbol-key): Use POSIX char classes to match symbols in Emacs 21. X-Git-Tag: ttn-vms-21-2-B4~10604 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=1f645835e9a3321eb4f0c68d9b93b5a9ff8d04b0;p=emacs.git (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. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 268119e36ac..23e4268888b 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2003-04-08 Martin Stjernholm + + * progmodes/cc-langs.el (c-symbol-key): Use POSIX char classes + to match symbols. This makes CC Mode cope with the full range + of identifier characters in e.g. Java. + 2003-04-07 Francesco Potort,Al(B * 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." ) ;; Regexp describing a `symbol' in all languages, not excluding -;; keywords. We cannot use just `word' syntax class since `_' cannot -;; be in word class. Putting underscore in word class breaks forward -;; word movement behavior that users are familiar with. Besides, it -;; runs counter to Emacs convention. -;; -;; This definition isn't correct for the first character in the -;; languages that accept the full range of Unicode word constituents -;; in identifiers (e.g. Java and Pike). For that we'd need to make a -;; regexp that matches all characters in the word constituent class -;; except 0-9, and the regexp engine currently can't do that. +;; keywords. (c-lang-defconst c-symbol-key - (c c++ objc java idl) "[_a-zA-Z]\\(\\w\\|\\s_\\)*" + (c c++ objc java idl) + (if (string-match "[[:alpha:]]" "a") + "[[:alpha:]_][[:alnum:]_]*" ; Emacs 21. + ;; We cannot use just `word' syntax class since `_' cannot be + ;; in word class. Putting underscore in word class breaks + ;; forward word movement behavior that users are familiar + ;; with. Besides, it runs counter to Emacs convention. + "[a-zA-Z_]\\(\\w\\|_\\)*") pike (concat "\\(" (c-lang-var c-symbol-key c) "\\|" (c-make-keywords-re nil '("`+" "`-" "`&" "`|" "`^" "`<<" "`>>" "`*" "`/" "`%" "`~"