From 291bcb5973230c36f9cec6f9fa91b553d944ccd2 Mon Sep 17 00:00:00 2001
From: Olivier Certner <olce.emacs@certner.fr>
Date: Thu, 14 Jan 2021 18:36:08 +0100
Subject: [PATCH] ERC: Track: Fix a perceived minor bug in mode line face
 selection

* lisp/erc/erc-track.el (erc-track-modified-channels): Fix what is a
probable bug when a new insert event happens for a buffer that was not
tracked or for which no mode line face was selected: in this case,
stop treating the latest buffer's face (first in list) as the previous
one, which could be overridden with an older one (in FACES' rest), as
if it had happened after.
---
 lisp/erc/erc-track.el | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/lisp/erc/erc-track.el b/lisp/erc/erc-track.el
index 7b9a2e9cd5b..2582a5039a6 100644
--- a/lisp/erc/erc-track.el
+++ b/lisp/erc/erc-track.el
@@ -818,18 +818,15 @@ is in `erc-mode'."
 		      (cons (cons (current-buffer)
 				  (cons
                                    1 (erc-track-select-mode-line-face
-                                      (car faces) (cdr faces))))
+                                      nil faces)))
 			    erc-modified-channels-alist))
 	      ;; Else modify the face for the buffer, if necessary.
 	      (when faces
 		(let* ((cell (assq (current-buffer)
 				   erc-modified-channels-alist))
 		       (old-face (cddr cell))
-		       (new-face (if old-face
-                                     (erc-track-select-mode-line-face
-                                      old-face faces)
-                                   (erc-track-select-mode-line-face
-                                    (car faces) (cdr faces)))))
+		       (new-face (erc-track-select-mode-line-face
+                                  old-face faces)))
 		  (setcdr cell (cons (1+ (cadr cell)) new-face)))))
 	    ;; And display it
 	    (erc-modified-channels-display)))
-- 
2.39.5