comparison lisp/progmodes/cc-defs.el @ 51887:a39d64d1eb50

(c-make-keywords-re): Don't use delete-duplicates. (c-lang-const): Don't use mapcan.
author Richard M. Stallman <rms@gnu.org>
date Sun, 13 Jul 2003 00:19:56 +0000
parents d508ffa43505
children b881031be46c
comparison
equal deleted inserted replaced
51886:8065f7ca3329 51887:a39d64d1eb50
970 matches the whole keyword, and the regexp will also not match a prefix 970 matches the whole keyword, and the regexp will also not match a prefix
971 of any identifier. Adorned regexps cannot be appended. The language 971 of any identifier. Adorned regexps cannot be appended. The language
972 variable `c-nonsymbol-key' is used to make the adornment. The 972 variable `c-nonsymbol-key' is used to make the adornment. The
973 optional MODE specifies the language to get it in. The default is the 973 optional MODE specifies the language to get it in. The default is the
974 current language (taken from `c-buffer-is-cc-mode')." 974 current language (taken from `c-buffer-is-cc-mode')."
975 (setq list (delete-duplicates list :test 'string-equal)) 975 (let (unique)
976 (dolist (elt list)
977 (unless (member elt unique)
978 (push elt unique)))
979 (setq list unique))
976 (if list 980 (if list
977 (let ((re (c-regexp-opt list))) 981 (let ((re (c-regexp-opt list)))
978 ;; Add our own grouping parenthesis around re instead of 982 ;; Add our own grouping parenthesis around re instead of
979 ;; passing adorn to `regexp-opt', since in XEmacs it makes the 983 ;; passing adorn to `regexp-opt', since in XEmacs it makes the
980 ;; top level grouping "shy". 984 ;; top level grouping "shy".
1324 ;; of the constant. If the symbol isn't defined yet we assume 1328 ;; of the constant. If the symbol isn't defined yet we assume
1325 ;; that its definition will come later in this file, and thus 1329 ;; that its definition will come later in this file, and thus
1326 ;; are no file dependencies needed. 1330 ;; are no file dependencies needed.
1327 (setq source-files (nreverse 1331 (setq source-files (nreverse
1328 ;; Reverse to get the right load order. 1332 ;; Reverse to get the right load order.
1329 (mapcan (lambda (elem) 1333 (apply 'nconc
1330 (if (eq file (car elem)) 1334 (mapcar (lambda (elem)
1331 nil ; Exclude our own file. 1335 (if (eq file (car elem))
1332 (list (car elem)))) 1336 nil ; Exclude our own file.
1333 (get sym 'source))))) 1337 (list (car elem))))
1338 (get sym 'source))))))
1334 1339
1335 ;; Spend some effort to make a compact call to 1340 ;; Spend some effort to make a compact call to
1336 ;; `c-get-lang-constant' since it will be compiled in. 1341 ;; `c-get-lang-constant' since it will be compiled in.
1337 (setq args (and mode `(',mode))) 1342 (setq args (and mode `(',mode)))
1338 (if (or source-files args) 1343 (if (or source-files args)