Mercurial > hg > xemacs-beta
diff lisp/font.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 | de0228446b18 |
children | 90dbf8e772b6 |
line wrap: on
line diff
--- a/lisp/font.el Sat Feb 07 21:55:13 2009 +0100 +++ b/lisp/font.el Sun Feb 08 18:45:22 2009 +0000 @@ -295,18 +295,6 @@ ; (setq retval (cons type retval)))) ; retval)) -;; #### only used in this file; maybe there's a cl.el function? -(defun font-unique (list) - (let ((retval) - (cur)) - (while list - (setq cur (car list) - list (cdr list)) - (if (member cur retval) - nil - (setq retval (cons cur retval)))) - (nreverse retval))) - (defun font-higher-weight (w1 w2) (let ((index1 (length (memq w1 font-possible-weights))) (index2 (length (memq w2 font-possible-weights)))) @@ -424,8 +412,10 @@ (font-spatial-to-canonical (font-size fontobj-2))))) (set-font-weight retval (font-higher-weight (font-weight fontobj-1) (font-weight fontobj-2))) - (set-font-family retval (font-unique (append (font-family fontobj-1) - (font-family fontobj-2)))) + (set-font-family retval + (delete-duplicates (append (font-family fontobj-1) + (font-family fontobj-2))) + :test #'equal) (set-font-style retval (logior (font-style fontobj-1) (font-style fontobj-2))) (set-font-registry retval (or (font-registry fontobj-1) @@ -651,7 +641,8 @@ (aref menu 0))) (normal (mapcar #'(lambda (x) (if x (aref x 0))) (aref menu 1)))) - (sort (font-unique (nconc scaled normal)) 'string-lessp)))) + (sort (delete-duplicates (nconc scaled normal) :test 'equal) + 'string-lessp)))) (cons "monospace" (mapcar 'car font-x-family-mappings)))) (defun x-font-create-name (fontobj &optional device) @@ -842,7 +833,8 @@ (aref menu 0))) (normal (mapcar #'(lambda (x) (if x (aref x 0))) (aref menu 1)))) - (sort (font-unique (nconc scaled normal)) 'string-lessp)))) + (sort (delete-duplicates (nconc scaled normal) :test #'equal) + 'string-lessp)))) ;; #### FIXME clearly bogus for Xft (cons "monospace" (mapcar 'car font-xft-family-mappings)))) @@ -872,7 +864,8 @@ (aref menu 0))) (normal (mapcar #'(lambda (x) (if x (aref x 0))) (aref menu 1)))) - (sort (font-unique (nconc scaled normal)) 'string-lessp)))))) + (sort (delete-duplicates (nconc scaled normal) :test #'equal) + 'string-lessp)))))) (defun ns-font-create-name (fontobj &optional device) "Return a font name constructed from FONTOBJ, appropriate for NextSTEP devices."