[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lisp/progmodes/cc-defs.el [lexbind]
From: |
Miles Bader |
Subject: |
[Emacs-diffs] Changes to emacs/lisp/progmodes/cc-defs.el [lexbind] |
Date: |
Thu, 20 Nov 2003 19:36:40 -0500 |
Index: emacs/lisp/progmodes/cc-defs.el
diff -c emacs/lisp/progmodes/cc-defs.el:1.17.2.2
emacs/lisp/progmodes/cc-defs.el:1.17.2.3
*** emacs/lisp/progmodes/cc-defs.el:1.17.2.2 Tue Oct 14 19:30:15 2003
--- emacs/lisp/progmodes/cc-defs.el Thu Nov 20 19:35:50 2003
***************
*** 105,111 ****
;;; Variables also used at compile time.
! (defconst c-version "5.30.7"
"CC Mode version number.")
(defconst c-version-sym (intern c-version))
--- 105,111 ----
;;; Variables also used at compile time.
! (defconst c-version "5.30.8"
"CC Mode version number.")
(defconst c-version-sym (intern c-version))
***************
*** 1001,1008 ****
(defun c-make-keywords-re (adorn list &optional mode)
"Make a regexp that matches all the strings the list.
! Duplicates in the list are removed. The regexp may contain zero or
! more submatch expressions.
If ADORN is non-nil there will be at least one submatch and the first
matches the whole keyword, and the regexp will also not match a prefix
--- 1001,1008 ----
(defun c-make-keywords-re (adorn list &optional mode)
"Make a regexp that matches all the strings the list.
! Duplicates in the list are removed. The resulting regexp may contain
! zero or more submatch expressions.
If ADORN is non-nil there will be at least one submatch and the first
matches the whole keyword, and the regexp will also not match a prefix
***************
*** 1010,1015 ****
--- 1010,1016 ----
variable `c-nonsymbol-key' is used to make the adornment. The
optional MODE specifies the language to get it in. The default is the
current language (taken from `c-buffer-is-cc-mode')."
+
(let (unique)
(dolist (elt list)
(unless (member elt unique)
***************
*** 1017,1022 ****
--- 1018,1044 ----
(setq list unique))
(if list
(let ((re (c-regexp-opt list)))
+
+ ;; Emacs < 21 and XEmacs (all versions so far) has a buggy
+ ;; regexp-opt that doesn't always cope with strings containing
+ ;; newlines. This kludge doesn't handle shy parens correctly
+ ;; so we can't advice regexp-opt directly with it.
+ (let (fail-list)
+ (while list
+ (and (string-match "\n" (car list)) ; To speed it up a little.
+ (not (string-match (concat "\\`\\(" re "\\)\\'")
+ (car list)))
+ (setq fail-list (cons (car list) fail-list)))
+ (setq list (cdr list)))
+ (when fail-list
+ (setq re (concat re
+ "\\|"
+ (mapconcat 'regexp-quote
+ (sort fail-list
+ (lambda (a b)
+ (> (length a) (length b))))
+ "\\|")))))
+
;; Add our own grouping parenthesis around re instead of
;; passing adorn to `regexp-opt', since in XEmacs it makes the
;; top level grouping "shy".
***************
*** 1026,1035 ****
--- 1048,1059 ----
(c-get-lang-constant 'c-nonsymbol-key nil mode)
"\\|$\\)")
re))
+
;; Produce a regexp that matches nothing.
(if adorn
"\\(\\<\\>\\)"
"\\<\\>")))
+
(put 'c-make-keywords-re 'lisp-indent-function 1)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] Changes to emacs/lisp/progmodes/cc-defs.el [lexbind],
Miles Bader <=