From: Richard M. Stallman Date: Sun, 12 May 2002 16:46:54 +0000 (+0000) Subject: (ansi-color-get-face): Avoid add-to-list on local var. X-Git-Tag: ttn-vms-21-2-B4~15092 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=7f0986e3eb8496dd2a4d6c8fc8cab19c7acc9441;p=emacs.git (ansi-color-get-face): Avoid add-to-list on local var. (ansi-color-apply-sequence): Avoid duplicates in combined face list. --- 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)