diff lisp/fontconfig.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 f5693b5f7f2d
children cd167465bf69 91b3aa59f49b
line wrap: on
line diff
--- a/lisp/fontconfig.el	Sat Feb 07 21:55:13 2009 +0100
+++ b/lisp/fontconfig.el	Sun Feb 08 18:45:22 2009 +0000
@@ -494,13 +494,13 @@
 	(objectset '("family" "style")))
     (let* ((all-fonts
 	    (fc-list-fonts-pattern-objects device pattern objectset)))
-      (fc-delete-duplicates
+      (delete-duplicates
        (mapcar
 	#'(lambda (pattern)
             (fc-pattern-get-family pattern 0))
 	(if filter-fun
-	    (fc-filter all-fonts filter-fun)
-	  all-fonts))))))
+	    (delete-if-not filter-fun all-fonts)
+	  all-fonts)) :test #'equal))))
 
 (defun fc-find-available-weights-for-family (family &optional style device)
   "Find available weights for font FAMILY."
@@ -534,28 +534,6 @@
        (not (equal result 'fc-result-no-id))
        (not (equal result 'fc-internal-error))))
 
-;;; DELETE-DUPLICATES and REMOVE-DUPLICATES from cl-seq.el do not
-;;; seem to work on list of strings...
-;;; #### Presumably just use :test 'equal!
-(defun fc-delete-duplicates (l)
-  (let ((res nil)
-	(in l))
-    (while (not (null in))
-      (if (not (member (car in) res))
-	  (setq res (append res (list (car in)))))
-      (setq in (cdr in)))
-    res))
-
-;; #### Use delete-if with :test 'equal.
-(defun fc-filter (l fun)
-  (let ((res nil)
-	(in l))
-    (while (not (null in))
-      (if (funcall fun (car in))
-	  (setq res (append res (list (car in)))))
-      (setq in (cdr in)))
-    res))
-
 (provide 'fontconfig)
 
 ;;; fontconfig.el ends here