From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#63204: 29.0.90; vc-annotate does not properly test whether a face exits Date: Mon, 01 May 2023 21:50:02 +0300 Message-ID: <83fs8fopid.fsf@gnu.org> References: <17c87d4a-3df1-ffdf-efe7-9d87de52b227@web.de> <87v8hbq4vi.fsf@posteo.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="21576"; mail-complaints-to="usenet@ciao.gmane.io" Cc: tbading@web.de, 63204@debbugs.gnu.org To: Philip Kaludercic Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon May 01 20:50:30 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ptYbV-0005NL-8A for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 01 May 2023 20:50:29 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ptYbA-000575-C1; Mon, 01 May 2023 14:50:08 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ptYb6-00056n-90 for bug-gnu-emacs@gnu.org; Mon, 01 May 2023 14:50:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ptYb3-0002Lc-Uo for bug-gnu-emacs@gnu.org; Mon, 01 May 2023 14:50:04 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ptYb3-0002T7-RK for bug-gnu-emacs@gnu.org; Mon, 01 May 2023 14:50:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 01 May 2023 18:50:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63204 X-GNU-PR-Package: emacs Original-Received: via spool by 63204-submit@debbugs.gnu.org id=B63204.16829669689435 (code B ref 63204); Mon, 01 May 2023 18:50:01 +0000 Original-Received: (at 63204) by debbugs.gnu.org; 1 May 2023 18:49:28 +0000 Original-Received: from localhost ([127.0.0.1]:41044 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ptYaW-0002S6-Av for submit@debbugs.gnu.org; Mon, 01 May 2023 14:49:28 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:57252) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ptYaU-0002Rr-Sw for 63204@debbugs.gnu.org; Mon, 01 May 2023 14:49:27 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ptYaO-0002HO-Go; Mon, 01 May 2023 14:49:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=eoovzHvPzOUEGscCz29c9Mnx0UwXK8K9mjAmpSb2yEU=; b=QmWt6jmEXPDxILqAyjd/ 0LiIQX5eXBwZ8Bdrsja+9FV/4elYq+odMGAlm3s+jCMSX39OtIZLSWJc5N3NA6nvWqz438zffzxaf nFrnhnGN5CgmXrgh5FQy3GWKzV6Qk9fZXcdhFRMDLlCjNMKlD4GGMnpIlPnWM/UUnia6aHSmXKyRS JTAMNe+TRrt2KKL9lRptJlsNlWdZlOgkXdgZcdzkvX3wJEgFSti/aNz+i/LnJ174Hpsx3n4brnKFu f0UJjBoXwYpYVf19rejPkV43AhoD1cDO9JtOjLWmFPbwfaxBiUSm39MJaEoZ4OcS5ThFOG0ZEdpSr FvovqM/Rsajp+g==; Original-Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ptYaN-0001by-T5; Mon, 01 May 2023 14:49:20 -0400 In-Reply-To: <87v8hbq4vi.fsf@posteo.net> (message from Philip Kaludercic on Mon, 01 May 2023 18:32:49 +0000) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:260887 Archived-At: > Cc: 63204@debbugs.gnu.org > From: Philip Kaludercic > Date: Mon, 01 May 2023 18:32:49 +0000 > > Tobias Bading writes: > > > 1. emacs -Q > > > > 2. Imagine that in a previous Emacs session you have copied a string with > >    text properties from a buffer in vc-annotate-mode, maybe also searched > >    for it somewhere. IOW, your ~/.emacs.d/.emacs.desktop file may contain > >    something like this: > > > >    (setq some-search-ring-or-whatever > >          '(#("heisenbug" 0 9 (face vc-annotate-face-CCCCFF)))) > > > >    Evaluate this expression to simulate a desktop-read of such a previous > >    session. > > > > 3. Open lisp/vc/vc-annotate.el from the Git branch emacs-29. > > > > 4. C-x v g (vc-annotate) > > > > 5. There are lines with white background caused by the use of undefined face > >    vc-annotate-face-CCCCFF. C-h e should contain: > > > >    Invalid face reference: vc-annotate-face-CCCCFF > > > >    If for whatever reason you don’t see these bad lines, use C-u C-x = to > >    see what face a line uses and repeat these steps with this face instead > >    of vc-annotate-face-CCCCFF. > > > > > > This can be fixed with: > > > > diff --git a/lisp/vc/vc-annotate.el b/lisp/vc/vc-annotate.el > > index 70057a6aac..ae8db021ad 100644 > > --- a/lisp/vc/vc-annotate.el > > +++ b/lisp/vc/vc-annotate.el > > @@ -724,7 +724,9 @@ vc-annotate-lines > >                                        (substring (cdr color) 1) > >                                      (cdr color)))) > >                 ;; Make the face if not done. > > -               (face (or (intern-soft face-name) > > +               (face (or (let ((sym (intern-soft face-name))) > > +                           (if (facep sym) > > +                               sym)) > > I'd write this as (and (facep sym) sym). > > >                           (let ((tmp-face (make-face (intern face-name)))) > >                             (set-face-extend tmp-face t) > >                             (cond > > > > My Emacs Lisp isn’t that great so please feel free to improve this code > > if needed. The important part is that (intern-soft face-name) is not > > sufficient to check whether a face exists. > > I think a better solution would be to revise general approach > vc-annotate takes, and instead of hard-coding faces/colours to use (that > break when switching between light and dark themes), to have a list of > faces that could be used independently of vc-annotate. We should probably do that on master, but for emacs-29 this is too much of a churn, I think. So for emacs-29, I think we should install something like the proposed patch, just a bit cleaned-up.