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.devel Subject: Re: Consistent face for keys in *Help* and `substitute-command-keys' Date: Thu, 04 Mar 2021 16:00:04 +0200 Message-ID: <83zgzjhvdn.fsf@gnu.org> References: <87h7m5iagw.fsf@gnus.org> <83blc9tnvz.fsf@gnu.org> <83y2fcrzkt.fsf@gnu.org> <831rd4romg.fsf@gnu.org> <83zgzsq7xn.fsf@gnu.org> <83v9afriqp.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="9348"; mail-complaints-to="usenet@ciao.gmane.io" Cc: larsi@gnus.org, emacs-devel@gnu.org To: Stefan Kangas Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Mar 04 15:02:53 2021 Return-path: Envelope-to: ged-emacs-devel@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 1lHoZ2-0002Hh-Ac for ged-emacs-devel@m.gmane-mx.org; Thu, 04 Mar 2021 15:02:52 +0100 Original-Received: from localhost ([::1]:53400 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lHoZ1-0006fc-9u for ged-emacs-devel@m.gmane-mx.org; Thu, 04 Mar 2021 09:02:51 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:46046) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lHoWh-0005gT-QP for emacs-devel@gnu.org; Thu, 04 Mar 2021 09:00:28 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:59741) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lHoWg-0002Ya-Sn; Thu, 04 Mar 2021 09:00:26 -0500 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:1935 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1lHoWb-0007a2-2k; Thu, 04 Mar 2021 09:00:24 -0500 In-Reply-To: (message from Stefan Kangas on Thu, 4 Mar 2021 00:24:14 -0600) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:265953 Archived-At: > From: Stefan Kangas > Date: Thu, 4 Mar 2021 00:24:14 -0600 > Cc: larsi@gnus.org, emacs-devel@gnu.org > > > So I guess we will need to change the design of this to avoid overriding > > the whole face of a tooltip, or maybe add some special code to > > help_echo_substitute_command_keys. > > Could we just use `add-face-text-property' here, perhaps? > > It seems to do what we want: > > (let ((foo "x") bar) > (add-face-text-property 0 (length foo) 'bold nil foo) > (setq bar (concat "y" foo "y")) > (add-face-text-property 0 (length bar) 'italic nil bar) > bar) > > => #("yxy" 0 1 (face italic) 1 2 (face (italic bold)) 2 3 (face italic)) That's because you add a property which was unspecified by the original face. But in the tooltip case, the function tooltip-show propertizes the entire text it receives with the 'tooltip' face, so any face attributes in the text that are also specified by the 'tooltip' face will be overwritten. So, for example, if the tooltip text had a :background attribute, that attribute would be overwritten by the background color of the 'tooltip' face. Isn't that what you see?