From 7f0986e3eb8496dd2a4d6c8fc8cab19c7acc9441 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Sun, 12 May 2002 16:46:54 +0000 Subject: [PATCH] (ansi-color-get-face): Avoid add-to-list on local var. (ansi-color-apply-sequence): Avoid duplicates in combined face list. --- lisp/ansi-color.el | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lisp/ansi-color.el b/lisp/ansi-color.el index 0412392cd05..3c15528d092 100644 --- a/lisp/ansi-color.el +++ b/lisp/ansi-color.el @@ -554,7 +554,13 @@ case we return nil." ((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 @@ ESCAPE-SEQ is a SGR control sequences such as \\033[34m. The parameter ((eq val 'default) (setq f (list val))) (t - (add-to-list 'f val)))) + (unless (member val f) + (push val f))))) f)) (provide 'ansi-color) -- 2.39.5