diff options
| author | Richard M. Stallman | 2002-12-04 11:47:46 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2002-12-04 11:47:46 +0000 |
| commit | 547cebf8d5d7481808cb091d1ea381ab61072679 (patch) | |
| tree | 3907daac2ae8ae2bfd681867643fd02f9f2900ac | |
| parent | c0316672c0d4555f47fe6c748e382e3617af4e5f (diff) | |
| download | emacs-547cebf8d5d7481808cb091d1ea381ab61072679.tar.gz emacs-547cebf8d5d7481808cb091d1ea381ab61072679.zip | |
Don't require cl.
(c-delete-duplicates): New function. Use instead of delete-duplicates.
| -rw-r--r-- | lisp/progmodes/cc-langs.el | 73 |
1 files changed, 39 insertions, 34 deletions
diff --git a/lisp/progmodes/cc-langs.el b/lisp/progmodes/cc-langs.el index c61dcdabf9a..3dc9e8b7dbd 100644 --- a/lisp/progmodes/cc-langs.el +++ b/lisp/progmodes/cc-langs.el | |||
| @@ -44,8 +44,6 @@ | |||
| 44 | (cc-require 'cc-defs) | 44 | (cc-require 'cc-defs) |
| 45 | (cc-require 'cc-vars) | 45 | (cc-require 'cc-vars) |
| 46 | 46 | ||
| 47 | (require 'cl) | ||
| 48 | |||
| 49 | 47 | ||
| 50 | ;; Some support functions that are used when the language specific | 48 | ;; Some support functions that are used when the language specific |
| 51 | ;; constants are built. Since the constants are built during compile | 49 | ;; constants are built. Since the constants are built during compile |
| @@ -78,6 +76,13 @@ | |||
| 78 | (setq count (1+ count) start (match-end 0))) | 76 | (setq count (1+ count) start (match-end 0))) |
| 79 | count)))) | 77 | count)))) |
| 80 | 78 | ||
| 79 | (defun c-delete-duplicates (list) | ||
| 80 | (let ((tail list)) | ||
| 81 | (while tail | ||
| 82 | (setcdr tail (delete (car tail) (cdr tail))) | ||
| 83 | (setq tail (cdr tail))) | ||
| 84 | list)) | ||
| 85 | |||
| 81 | (defun c-make-keywords-re (adorn &rest lists) | 86 | (defun c-make-keywords-re (adorn &rest lists) |
| 82 | "Make a regexp that matches all the strings in all the lists. | 87 | "Make a regexp that matches all the strings in all the lists. |
| 83 | Duplicates in the lists are removed. The regexp may contain zero or | 88 | Duplicates in the lists are removed. The regexp may contain zero or |
| @@ -85,18 +90,18 @@ more submatch expressions. If ADORN is non-nil there will be at least | |||
| 85 | one submatch which matches the whole keyword, and the regexp will also | 90 | one submatch which matches the whole keyword, and the regexp will also |
| 86 | not match a prefix of any identifier. Adorned regexps cannot be | 91 | not match a prefix of any identifier. Adorned regexps cannot be |
| 87 | appended." | 92 | appended." |
| 88 | (setq lists (delete-duplicates (apply 'append (nconc lists '(nil))) | 93 | (let ((list (copy-sequence (apply 'append lists)))) |
| 89 | :test 'string-equal)) | 94 | (setq list (c-delete-duplicates list)) |
| 90 | (if lists | 95 | (if list |
| 91 | (let ((re (c-regexp-opt lists))) | 96 | (let ((re (c-regexp-opt list))) |
| 92 | ;; Add our own grouping parenthesis around re instead of | 97 | ;; Add our own grouping parenthesis around re instead of |
| 93 | ;; passing adorn to regexp-opt, since it in XEmacs makes the | 98 | ;; passing adorn to regexp-opt, since it in XEmacs makes the |
| 94 | ;; top level grouping "shy". | 99 | ;; top level grouping "shy". |
| 95 | (if adorn | 100 | (if adorn |
| 96 | (concat "\\(" re "\\)\\>\\([^_]\\|$\\)") | 101 | (concat "\\(" re "\\)\\>\\([^_]\\|$\\)") |
| 97 | re)) | 102 | re)) |
| 98 | "\\<\\>" ; Matches nothing. | 103 | "\\<\\>" ; Matches nothing. |
| 99 | )) | 104 | ))) |
| 100 | (put 'c-make-keywords-re 'lisp-indent-function 1) | 105 | (put 'c-make-keywords-re 'lisp-indent-function 1) |
| 101 | ) | 106 | ) |
| 102 | 107 | ||
| @@ -432,26 +437,26 @@ appended." | |||
| 432 | 437 | ||
| 433 | ;; All keywords as a list. | 438 | ;; All keywords as a list. |
| 434 | (c-lang-defconst c-keywords | 439 | (c-lang-defconst c-keywords |
| 435 | all (delete-duplicates (append (c-lang-var c-primitive-type-kwds) | 440 | all (c-delete-duplicates |
| 436 | (c-lang-var c-specifier-kwds) | 441 | (append (c-lang-var c-primitive-type-kwds) |
| 437 | (c-lang-var c-class-kwds) | 442 | (c-lang-var c-specifier-kwds) |
| 438 | (c-lang-var c-other-decl-block-kwds) | 443 | (c-lang-var c-class-kwds) |
| 439 | (c-lang-var c-block-decls-with-vars) | 444 | (c-lang-var c-other-decl-block-kwds) |
| 440 | (c-lang-var c-other-decl-kwds) | 445 | (c-lang-var c-block-decls-with-vars) |
| 441 | (c-lang-var c-decl-spec-kwds) | 446 | (c-lang-var c-other-decl-kwds) |
| 442 | (c-lang-var c-protection-kwds) | 447 | (c-lang-var c-decl-spec-kwds) |
| 443 | (c-lang-var c-block-stmt-1-kwds) | 448 | (c-lang-var c-protection-kwds) |
| 444 | (c-lang-var c-block-stmt-2-kwds) | 449 | (c-lang-var c-block-stmt-1-kwds) |
| 445 | (c-lang-var c-simple-stmt-kwds) | 450 | (c-lang-var c-block-stmt-2-kwds) |
| 446 | (c-lang-var c-asm-stmt-kwds) | 451 | (c-lang-var c-simple-stmt-kwds) |
| 447 | (c-lang-var c-label-kwds) | 452 | (c-lang-var c-asm-stmt-kwds) |
| 448 | (c-lang-var c-expr-kwds) | 453 | (c-lang-var c-label-kwds) |
| 449 | (c-lang-var c-lambda-kwds) | 454 | (c-lang-var c-expr-kwds) |
| 450 | (c-lang-var c-inexpr-block-kwds) | 455 | (c-lang-var c-lambda-kwds) |
| 451 | (c-lang-var c-inexpr-class-kwds) | 456 | (c-lang-var c-inexpr-block-kwds) |
| 452 | (c-lang-var c-bitfield-kwds) | 457 | (c-lang-var c-inexpr-class-kwds) |
| 453 | nil) | 458 | (c-lang-var c-bitfield-kwds) |
| 454 | :test 'string-equal)) | 459 | nil))) |
| 455 | (c-lang-defvar c-keywords (c-lang-var c-keywords)) | 460 | (c-lang-defvar c-keywords (c-lang-var c-keywords)) |
| 456 | 461 | ||
| 457 | ;; All keywords as an adorned regexp. | 462 | ;; All keywords as an adorned regexp. |