emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master d082f46c8ca 1/2: vc-annotate.el: make a new face if it didn't exi


From: Mattias Engdegård
Subject: master d082f46c8ca 1/2: vc-annotate.el: make a new face if it didn't exist
Date: Tue, 26 Sep 2023 07:37:59 -0400 (EDT)

branch: master
commit d082f46c8cac02c3f871314c458a0bed43ce2ae4
Author: Mattias Engdegård <mattiase@acm.org>
Commit: Mattias Engdegård <mattiase@acm.org>

    vc-annotate.el: make a new face if it didn't exist
    
    * lisp/vc/vc-annotate.el (vc-annotate-lines): Check whether a symbol
    is a face, not just its existence.  Previously we would sometimes end
    up using non-faces resulting in complaints from the display system.
---
 lisp/vc/vc-annotate.el | 33 +++++++++++++++++----------------
 1 file changed, 17 insertions(+), 16 deletions(-)

diff --git a/lisp/vc/vc-annotate.el b/lisp/vc/vc-annotate.el
index d83660f9d79..de6c3adbbdb 100644
--- a/lisp/vc/vc-annotate.el
+++ b/lisp/vc/vc-annotate.el
@@ -718,23 +718,24 @@ The annotations are relative to the current time, unless 
overridden by OFFSET."
         (let* ((color (or (vc-annotate-compcar difference 
vc-annotate-color-map)
                           (cons nil vc-annotate-very-old-color)))
                ;; substring from index 1 to remove any leading `#' in the name
-               (face-name (concat "vc-annotate-face-"
-                                  (if (string-equal
-                                       (substring (cdr color) 0 1) "#")
-                                      (substring (cdr color) 1)
-                                    (cdr color))))
+               (face (intern (concat "vc-annotate-face-"
+                                     (if (string-equal
+                                          (substring (cdr color) 0 1) "#")
+                                         (substring (cdr color) 1)
+                                       (cdr color)))))
                ;; Make the face if not done.
-               (face (or (intern-soft face-name)
-                         (let ((tmp-face (make-face (intern face-name))))
-                           (set-face-extend tmp-face t)
-                           (cond
-                            (vc-annotate-background-mode
-                             (set-face-background tmp-face (cdr color)))
-                            (t
-                             (set-face-foreground tmp-face (cdr color))
-                             (when vc-annotate-background
-                              (set-face-background tmp-face 
vc-annotate-background))))
-                           tmp-face))))        ; Return the face
+               (face (if (facep face)
+                         face
+                       (make-face face)
+                       (set-face-extend face t)
+                       (cond
+                        (vc-annotate-background-mode
+                         (set-face-background face (cdr color)))
+                        (t
+                         (set-face-foreground face (cdr color))
+                         (when vc-annotate-background
+                          (set-face-background face vc-annotate-background))))
+                       face)))
           (put-text-property start end 'face face)))))
   ;; Pretend to font-lock there were no matches.
   nil)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]