diff options
| author | Richard M. Stallman | 2002-05-12 16:46:54 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2002-05-12 16:46:54 +0000 |
| commit | 7f0986e3eb8496dd2a4d6c8fc8cab19c7acc9441 (patch) | |
| tree | bc593f1424373b956a98682c88613a294a293cf5 | |
| parent | 384bcc6495e2c1ae0e0f54707506cd50a39a59e0 (diff) | |
| download | emacs-7f0986e3eb8496dd2a4d6c8fc8cab19c7acc9441.tar.gz emacs-7f0986e3eb8496dd2a4d6c8fc8cab19c7acc9441.zip | |
(ansi-color-get-face): Avoid add-to-list on local var.
(ansi-color-apply-sequence): Avoid duplicates in combined face list.
| -rw-r--r-- | lisp/ansi-color.el | 11 |
1 files 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." | |||
| 554 | ((eq (car new-faces) 'default) | 554 | ((eq (car new-faces) 'default) |
| 555 | (cdr new-faces)) | 555 | (cdr new-faces)) |
| 556 | (t | 556 | (t |
| 557 | (append new-faces faces))))) | 557 | ;; Like (append NEW-FACES FACES) |
| 558 | ;; but delete duplicates in FACES. | ||
| 559 | (let ((modified-faces (copy-sequence faces))) | ||
| 560 | (dolist (face (nreverse new-faces)) | ||
| 561 | (setq modified-faces (delete face modified-faces)) | ||
| 562 | (push face modified-faces)) | ||
| 563 | modified-faces))))) | ||
| 558 | 564 | ||
| 559 | (defun ansi-color-make-color-map () | 565 | (defun ansi-color-make-color-map () |
| 560 | "Creates a vector of face definitions and returns it. | 566 | "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 | |||
| 637 | ((eq val 'default) | 643 | ((eq val 'default) |
| 638 | (setq f (list val))) | 644 | (setq f (list val))) |
| 639 | (t | 645 | (t |
| 640 | (add-to-list 'f val)))) | 646 | (unless (member val f) |
| 647 | (push val f))))) | ||
| 641 | f)) | 648 | f)) |
| 642 | 649 | ||
| 643 | (provide 'ansi-color) | 650 | (provide 'ansi-color) |