comparison lisp/cl-macs.el @ 4607:517f6887fbc0

Remove duplicate functions, chiefly #'delete-duplicates reimplementations. lisp/ChangeLog addition: 2009-02-08 Aidan Kehoe <kehoea@parhasard.net> * cl-macs.el (delete-duplicates): Add a new compiler macro, inlining this function if it's called with a literal #'eq or #'equal test arguments and no other keywords. * font-lock.el (font-lock-unique): Remove this function. * font-lock.el (font-lock-prepend-text-property): (font-lock-append-text-property): Use #'delete-duplicates instead of #'font-lock-unique. * font.el (font-unique): Remove this function. * font.el (font-combine-fonts-internal): (x-font-families-for-device): (xft-font-families-for-device): (ns-font-families-for-device): Use #'delete-duplicates instead of #'font-unique. * fontconfig.el (fc-delete-duplicates): * fontconfig.el (fc-filter): Remove these functions. * fontconfig.el (fc-find-available-font-families): Replace #'fc-delete-duplicates with #'delete-duplicates, #'fc-filter with #'delete-if-not. * format.el (format-make-relatively-unique): Document that this is equivalent to #'nset-exclusive-or with a test of #'equal.
author Aidan Kehoe <kehoea@parhasard.net>
date Sun, 08 Feb 2009 18:45:22 +0000
parents 13a418960a88
children 8f1ee2d15784
comparison
equal deleted inserted replaced
4606:88ba7d18dc23 4607:517f6887fbc0
3167 (cl-simple-expr-p val)) res 3167 (cl-simple-expr-p val)) res
3168 (let ((temp (gensym))) 3168 (let ((temp (gensym)))
3169 (list 'let (list (list temp val)) (subst temp val res))))) 3169 (list 'let (list (list temp val)) (subst temp val res)))))
3170 form)) 3170 form))
3171 3171
3172 ;; XEmacs; inline delete-duplicates if it's called with a literal
3173 ;; #'equal or #'eq and no other keywords, we want the speed in
3174 ;; font-lock.el.
3175 (define-compiler-macro delete-duplicates (&whole form cl-seq &rest cl-keys)
3176 (cond ((and (= 4 (length form))
3177 (eq :test (third form))
3178 (or (equal '(quote eq) (fourth form))
3179 (equal '(function eq) (fourth form))))
3180 `(let* ((begin ,cl-seq)
3181 (cl-seq begin))
3182 (while cl-seq
3183 (setq cl-seq (setcdr cl-seq (delq (car cl-seq) (cdr cl-seq)))))
3184 begin))
3185 ((and (= 4 (length form))
3186 (eq :test (third form))
3187 (or (equal '(quote equal) (fourth form))
3188 (equal '(function equal) (fourth form))))
3189 `(let* ((begin ,cl-seq)
3190 (cl-seq begin))
3191 (while cl-seq
3192 (setq cl-seq (setcdr cl-seq (delete (car cl-seq) (cdr cl-seq)))))
3193 begin))
3194 (t
3195 form)))
3172 3196
3173 (mapc 3197 (mapc
3174 #'(lambda (y) 3198 #'(lambda (y)
3175 (put (car y) 'side-effect-free t) 3199 (put (car y) 'side-effect-free t)
3176 (put (car y) 'byte-compile 'cl-byte-compile-compiler-macro) 3200 (put (car y) 'byte-compile 'cl-byte-compile-compiler-macro)