diff 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
line wrap: on
line diff
--- a/lisp/cl-macs.el	Sat Feb 07 21:55:13 2009 +0100
+++ b/lisp/cl-macs.el	Sun Feb 08 18:45:22 2009 +0000
@@ -3169,6 +3169,30 @@
 	    (list 'let (list (list temp val)) (subst temp val res)))))
     form))
 
+;; XEmacs; inline delete-duplicates if it's called with a literal
+;; #'equal or #'eq and no other keywords, we want the speed in
+;; font-lock.el.
+(define-compiler-macro delete-duplicates (&whole form cl-seq &rest cl-keys)
+  (cond ((and (= 4 (length form))
+              (eq :test (third form))
+              (or (equal '(quote eq) (fourth form))
+                  (equal '(function eq) (fourth form))))
+         `(let* ((begin ,cl-seq)
+                 (cl-seq begin))
+           (while cl-seq
+             (setq cl-seq (setcdr cl-seq (delq (car cl-seq) (cdr cl-seq)))))
+           begin))
+        ((and (= 4 (length form))
+              (eq :test (third form))
+              (or (equal '(quote equal) (fourth form))
+                  (equal '(function equal) (fourth form))))
+         `(let* ((begin ,cl-seq)
+                 (cl-seq begin))
+           (while cl-seq
+             (setq cl-seq (setcdr cl-seq (delete (car cl-seq) (cdr cl-seq)))))
+           begin))
+        (t
+         form)))
 
 (mapc
  #'(lambda (y)