changeset 45250:21ed0daaa2c6

(ansi-color-get-face): Avoid add-to-list on local var. (ansi-color-apply-sequence): Avoid duplicates in combined face list.
author Richard M. Stallman <rms@gnu.org>
date Sun, 12 May 2002 16:46:54 +0000
parents 307e91e0f260
children b7c70c3b9faf
files lisp/ansi-color.el
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ansi-color.el	Sun May 12 16:42:26 2002 +0000
+++ b/lisp/ansi-color.el	Sun May 12 16:46:54 2002 +0000
@@ -554,7 +554,13 @@
 	  ((eq (car new-faces) 'default)
 	   (cdr new-faces))
 	  (t
-	   (append new-faces faces)))))
+	   ;; Like (append NEW-FACES FACES)
+	   ;; but delete duplicates in FACES.
+	   (let ((modified-faces (copy-sequence faces)))
+	     (dolist (face (nreverse new-faces))
+	       (setq modified-faces (delete face modified-faces))
+	       (push face modified-faces))
+	     modified-faces)))))
 
 (defun ansi-color-make-color-map ()
   "Creates a vector of face definitions and returns it.
@@ -637,7 +643,8 @@
 	    ((eq val 'default)
 	     (setq f (list val)))
 	    (t
-	     (add-to-list 'f val))))
+	     (unless (member val f)
+	       (push val f)))))
     f))
 
 (provide 'ansi-color)