comparison 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
comparison
equal deleted inserted replaced
4606:88ba7d18dc23 4607:517f6887fbc0
492 (let ((device (or device (default-x-device))) 492 (let ((device (or device (default-x-device)))
493 (pattern (make-fc-pattern)) 493 (pattern (make-fc-pattern))
494 (objectset '("family" "style"))) 494 (objectset '("family" "style")))
495 (let* ((all-fonts 495 (let* ((all-fonts
496 (fc-list-fonts-pattern-objects device pattern objectset))) 496 (fc-list-fonts-pattern-objects device pattern objectset)))
497 (fc-delete-duplicates 497 (delete-duplicates
498 (mapcar 498 (mapcar
499 #'(lambda (pattern) 499 #'(lambda (pattern)
500 (fc-pattern-get-family pattern 0)) 500 (fc-pattern-get-family pattern 0))
501 (if filter-fun 501 (if filter-fun
502 (fc-filter all-fonts filter-fun) 502 (delete-if-not filter-fun all-fonts)
503 all-fonts)))))) 503 all-fonts)) :test #'equal))))
504 504
505 (defun fc-find-available-weights-for-family (family &optional style device) 505 (defun fc-find-available-weights-for-family (family &optional style device)
506 "Find available weights for font FAMILY." 506 "Find available weights for font FAMILY."
507 (let* ((device (or device (default-x-device))) 507 (let* ((device (or device (default-x-device)))
508 (pattern (make-fc-pattern)) 508 (pattern (make-fc-pattern))
532 (defun fc-pattern-get-successp (result) 532 (defun fc-pattern-get-successp (result)
533 (and (not (equal result 'fc-result-no-match)) 533 (and (not (equal result 'fc-result-no-match))
534 (not (equal result 'fc-result-no-id)) 534 (not (equal result 'fc-result-no-id))
535 (not (equal result 'fc-internal-error)))) 535 (not (equal result 'fc-internal-error))))
536 536
537 ;;; DELETE-DUPLICATES and REMOVE-DUPLICATES from cl-seq.el do not
538 ;;; seem to work on list of strings...
539 ;;; #### Presumably just use :test 'equal!
540 (defun fc-delete-duplicates (l)
541 (let ((res nil)
542 (in l))
543 (while (not (null in))
544 (if (not (member (car in) res))
545 (setq res (append res (list (car in)))))
546 (setq in (cdr in)))
547 res))
548
549 ;; #### Use delete-if with :test 'equal.
550 (defun fc-filter (l fun)
551 (let ((res nil)
552 (in l))
553 (while (not (null in))
554 (if (funcall fun (car in))
555 (setq res (append res (list (car in)))))
556 (setq in (cdr in)))
557 res))
558
559 (provide 'fontconfig) 537 (provide 'fontconfig)
560 538
561 ;;; fontconfig.el ends here 539 ;;; fontconfig.el ends here