Mercurial > hg > xemacs-beta
diff lisp/font-lock.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 | f6c39b2d8b62 |
children | c1784fd59d7d |
line wrap: on
line diff
--- a/lisp/font-lock.el Sat Feb 07 21:55:13 2009 +0100 +++ b/lisp/font-lock.el Sun Feb 08 18:45:22 2009 +0000 @@ -1636,27 +1636,6 @@ (put-nonduplicable-text-property start next markprop value object) (setq start (text-property-any next end markprop nil object))))) -;; This function (from simon's unique.el) is rewritten and inlined for speed. -;(defun unique (list function) -; "Uniquify LIST, deleting elements using FUNCTION. -;Return the list with subsequent duplicate items removed by side effects. -;FUNCTION is called with an element of LIST and a list of elements from LIST, -;and should return the list of elements with occurrences of the element removed, -;i.e., a function such as `delete' or `delq'. -;This function will work even if LIST is unsorted. See also `uniq'." -; (let ((list list)) -; (while list -; (setq list (setcdr list (funcall function (car list) (cdr list)))))) -; list) - -(defsubst font-lock-unique (list) - "Uniquify LIST, deleting elements using `delq'. -Return the list with subsequent duplicate items removed by side effects." - (let ((list list)) - (while list - (setq list (setcdr list (delq (car list) (cdr list)))))) - list) - ;; A generalisation of `facemenu-add-face' for any property, but without the ;; removal of inactive faces via `facemenu-discard-redundant-faces' and special ;; treatment of `default'. Uses `unique' to remove duplicate property values. @@ -1671,7 +1650,8 @@ prev (get-text-property start prop object)) (put-text-property start next prop - (font-lock-unique (append val (if (listp prev) prev (list prev)))) + (delete-duplicates (append val (if (listp prev) prev (list prev))) + :test #'eq) object) (setq start next)))) @@ -1686,7 +1666,8 @@ prev (get-text-property start prop object)) (put-text-property start next prop - (font-lock-unique (append (if (listp prev) prev (list prev)) val)) + (delete-duplicates (append (if (listp prev) prev (list prev)) val) + :test #'eq) object) (setq start next))))