From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Gregory Heytings via "Emacs development discussions." Newsgroups: gmane.emacs.devel Subject: Re: buffer-face-set changes the fringe, is it a bug? Date: Wed, 8 Jul 2020 08:55:15 +0200 (CEST) Message-ID: References: <2E75863E-82E2-4D61-AD34-0282362C6E99@gnu.org> <835zb2t1t8.fsf@gnu.org> <83lfjwsiin.fsf@gnu.org> <83h7uksehi.fsf@gnu.org> <838sfvs755.fsf@gnu.org> <834kqjrx6v.fsf@gnu.org> <83zh8bqghl.fsf@gnu.org> <83wo3erbga.fsf@gnu.org> Reply-To: emacs-devel@gnu.org, Gregory Heytings Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset=US-ASCII Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11207"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Alpine 2.21 (NEB 202 2017-01-01) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Jul 08 08:56:32 2020 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 1jt40O-0002oU-7X for ged-emacs-devel@m.gmane-mx.org; Wed, 08 Jul 2020 08:56:32 +0200 Original-Received: from localhost ([::1]:58274 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jt40N-0004L3-9m for ged-emacs-devel@m.gmane-mx.org; Wed, 08 Jul 2020 02:56:31 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50944) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jt3zZ-0003pY-Pj for emacs-devel@gnu.org; Wed, 08 Jul 2020 02:55:41 -0400 Original-Received: from mx.sdf.org ([205.166.94.24]:49795) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jt3zW-0004PR-Ih for emacs-devel@gnu.org; Wed, 08 Jul 2020 02:55:41 -0400 Original-Received: from sdf.org (IDENT:ghe@faeroes.freeshell.org [205.166.94.9]) by mx.sdf.org (8.15.2/8.14.5) with ESMTPS id 0686tJR2013635 (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits) verified NO); Wed, 8 Jul 2020 06:55:20 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=sdf.org; s=default; t=1594191321; bh=Xn/gBrOJczpyJnIl5vxmA6i8pGD5JAGkwsRX7dKkXdY=; h=Date:From:Reply-To:To:Subject:In-Reply-To:References; b=kxCx5WeLyK7ck9ekGMQdW3wkI1yKe4onsg6fX2JdMJQLoxhqoq/MVPVEisneKwcXW B04FQ8PI78YxHRWPP+lrlYoXj1895s7MoXr4ZTBcWfpuqxDoN9kCzUTNqveH6cH52W Y6TxEbjKzIMlf81YDGbud1NT1x7b05vs4tTq6RYc= Original-Received: (from ghe@localhost) by sdf.org (8.15.2/8.12.8/Submit) id 0686tIIw022252; Wed, 8 Jul 2020 06:55:18 GMT In-Reply-To: <83wo3erbga.fsf@gnu.org> Received-SPF: none client-ip=205.166.94.24; envelope-from=ghe@sdf.org; helo=mx.sdf.org X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/08 02:55:35 X-ACL-Warn: Detected OS = ??? X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, SPF_HELO_PASS=-0.001, SPF_NONE=0.001, URIBL_BLOCKED=0.001 autolearn=no autolearn_force=no X-Spam_action: no action 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:252766 Archived-At: > >> (2) When the 'default' face is remapped, Emacs completely ignores the >> 'fringe' face, and uses the remapped 'default' face instead. > > It doesn't "ignore", but because the remapped face specifies both > colors, the fringe colors don't show. That's what happens when you > merge two faces one of which specifies both colors: if the face that > specifies both colors is merged last, the colors of the first one will > not show. > And the question is precisely: why is the default face merged LAST in this case when, according to the documentation and to what you wrote, it should be merged FIRST? IOW, there are two cases: (1) "Emacs merges the 'fringe' and the 'default' faces, starting from 'default' (so any color specified by 'fringe' overrides the corresponding color of 'default')." (2) When the 'default' face is remapped, Emacs merges the 'fringe' and the 'default' faces, starting from 'fringe' (which effictively means that, given that 'default' always specifies a foreground and a background, any color specified by 'fringe' will be overridden). Four more examples: (a) This works even if the remapping of the default face does not change the color specified for the fringe face. Try this: (set-face-attribute 'fringe nil :foreground "red") (let ((o (make-overlay 0 1)) (s "_")) (put-text-property 0 1 'display '(left-fringe question-mark) s) (overlay-put o 'after-string s)) (face-remap-add-relative 'default '(:background "yellow")) (b) This works even if the remapping of the default face does not change the colors at all. Try this: (set-face-attribute 'fringe nil :background "red" :foreground "yellow") (let ((o (make-overlay 0 1)) (s "_")) (put-text-property 0 1 'display '(left-fringe question-mark) s) (overlay-put o 'after-string s)) (face-remap-add-relative 'default '(:weight bold)) (c) This works even if the remapping of the default face does not change anything visually. Try this: (set-face-attribute 'fringe nil :background "red" :foreground "yellow") (let ((o (make-overlay 0 1)) (s "_")) (put-text-property 0 1 'display '(left-fringe question-mark) s) (overlay-put o 'after-string s)) (face-remap-add-relative 'default `(:weight ,(face-attribute 'default :weight))) (d) This works also when one simply adjust the text scale with C-x C-- and C-x C-+: (set-face-attribute 'fringe nil :background "red" :foreground "yellow") (let ((o (make-overlay 0 1)) (s "_")) (put-text-property 0 1 'display '(left-fringe question-mark) s) (overlay-put o 'after-string s)) (text-scale-adjust -1) (text-scale-adjust +1) After C-x C-- the question mark is black on white, after C-x C-+ the question mark is yellow on red again. I start arguing now. Apparently this behavior is old enough that it is now, by definition, a feature. Moreover I'm the only one who took part of this thread, so it is perhaps not important. But please adjust the documentation (I've just seen that you updated it twice already) as follows: The optional @var{face} names a face whose foreground and background colors are to be used to display the bitmap, using the attributes of the @code{fringe} face for colors that @var{face} didn't specify. It is not recommended to omit the @var{face}, and to explicitly indicate the @code{fringe} face when one does not want to use specific colors to display the bitmap in the fringe, as an omitted @var{face} leads to unexpected behavior. If @var{face} is omitted and the @code{default} face is not remapped, that means to use the attributes of the @code{default} face for the colors which the @code{fringe} face didn't specify. If @var{face} is omitted and the @code{default} face is remapped, that means to use the attributes of the @code{fringe} face for the colors which the @code{default} face didn't specify. Thank you (once again) for your attention. Gregory