From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Davin Pearson Newsgroups: gmane.emacs.devel Subject: Re: Date: Wed, 29 Dec 2021 12:41:50 +1300 Message-ID: References: <83r1a6yqth.fsf@gnu.org> <83h7aslit4.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000002f297005d43d5ed2" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="36410"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Wed Dec 29 00:43: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 1n2M8G-0009Jq-Kt for ged-emacs-devel@m.gmane-mx.org; Wed, 29 Dec 2021 00:43:52 +0100 Original-Received: from localhost ([::1]:36656 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n2M8F-0005Hb-IR for ged-emacs-devel@m.gmane-mx.org; Tue, 28 Dec 2021 18:43:51 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:57658) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n2M6a-0004Qf-H3 for emacs-devel@gnu.org; Tue, 28 Dec 2021 18:42:09 -0500 Original-Received: from [2a00:1450:4864:20::22d] (port=43677 helo=mail-lj1-x22d.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n2M6W-0007fI-S7; Tue, 28 Dec 2021 18:42:08 -0500 Original-Received: by mail-lj1-x22d.google.com with SMTP id g13so20806386ljj.10; Tue, 28 Dec 2021 15:42:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=0bdMrWPReCCSn5WKiBZgyk4HGZetvZtYlxE+2dIbTAU=; b=hzXBUaYz1SzRy3x7lsFnfC7LWF9n3uWFVuzsyPdlzR+MvKvW+ULRu83LZpMdHSAQzM kFZDybBK2e0ZYg6j4nfweQnvcVbn9zB5a2ACSsSvHE+JRv4RJdkP5te/7FzeMYgebNXC kKDIaGuxxPBmtTV5mhLv5usRMFszGWpm+5Q8hlMH6GStRubebZhjtO78zN7WabviJCm/ R3Qp7ymTeA2hnf7O9gxgqveC3qScOIeTa3DMYTLiMH6wcDq7fnXl0IMhAxTUgi6lRA2s n6cVyWDdd2dDmmkeG5sVCRHbjgByOuTbBgKUKoeacreQgPmzNX+rmL23/JbGMx6lHSh6 S+VA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=0bdMrWPReCCSn5WKiBZgyk4HGZetvZtYlxE+2dIbTAU=; b=CRBsCMwOj4e5IgNyDobvzpcL+EUekSKpDPubLjWnQdyeOJMPTOk82AESrWIS13dIhd jEK0XE6IA5hRCiE6KH1lvkPI+Z3gcz9YHGG9c9+v8dYV3YB1nyN9c5Wq43almzFQhcd8 PbFCRagvyJUgTYrGtEp0Er/vda+/pZtOVYrQ126LO1R2UAt9+NL7FZZmgBG/JEzVqOUl Oyzx4Ze4Y2kyoqt5bD7I5N/38R6JDWkj2FRmzk0qqCJ/v0GzUEpYfg6shj/n7Jga+I4i 81l5V1Y0iqC7nCNXPtLvlLyMVIzCNZOxqeAkQUdBOGpQqrphHX0MuCuXAVtGs+Dl7/CS MLHQ== X-Gm-Message-State: AOAM533r+YFRU32VxLbmiO6eyCGm08L2jdEcOG+QtISIaibIpvpwXIwB S9YGRpc4jUyR0A9p1RBtQemKj2D+iWT4cKnXomplVSLe X-Google-Smtp-Source: ABdhPJwRgWvbduwUeLqXQ9biKrWy9aFR7LbhUaMFdoErI94o6o5pbm45I1/FoCxhXBX/lrKMd+O2OK71iW5Jk2pyi3g= X-Received: by 2002:a2e:9659:: with SMTP id z25mr18829361ljh.16.1640734921794; Tue, 28 Dec 2021 15:42:01 -0800 (PST) In-Reply-To: <83h7aslit4.fsf@gnu.org> X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::22d (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::22d; envelope-from=davin.pearson@gmail.com; helo=mail-lj1-x22d.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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:283524 Archived-At: --0000000000002f297005d43d5ed2 Content-Type: text/plain; charset="UTF-8" Could you please run my code on your machine to verify that it works on your machine but not mine. On Wed, 29 Dec 2021 at 06:51, Eli Zaretskii wrote: > [Please keep the list address on the CC.] > > > From: Davin Pearson > > Date: Tue, 28 Dec 2021 16:58:50 +1300 > > > > In your email to me you said that one of the foreground colours > > will "win" and the other will be ignored. What I want is the > > same thing for the background colour. As far as I understand the > > winning foreground colour will be the one that is added last in > > the fontification spec, and with the symbol 'end added to > > font-lock-add-keywords. > > > > Here is my font-lock-string-face > > > > "assdsdasd" > > > > Here is the text dmp-asdssd coloured in my choice of colours: red > > and green: > > > > "dmp-asdssd" (*) > > > > Here is the code that fontifies the above code. > > > > (make-face 'dmp-face--line0--col1-red) > > (set-face-foreground 'dmp-face--line0--col1-red "#ff0000") > > (set-face-background 'dmp-face--line0--col1-red nil) > > (make-face-bold 'dmp-face--line0--col1-red) > > > > (make-face 'dmp-face--line0--col2-green) > > (set-face-foreground 'dmp-face--line0--col2-green "#00ff00") > > (set-face-background 'dmp-face--line0--col2-green nil) > > (make-face-bold 'dmp-face--line0--col2-green) > > > > (make-face 'dmp-face--line0--col3-blue) > > (set-face-foreground 'dmp-face--line0--col3-blue "#0000ff") > > (set-face-background 'dmp-face--line0--col3-blue nil) > > (make-face-bold 'dmp-face--line0--col3-blue) > > > > Here are some useful constant strings: > > > > (defvar dmp-defun-inner-regexp-less-dash+star > "a-zA-Z0-9_.!@$%^&=<>/|+:;?~") > > (defvar dmp-defun-inner-regexp-less-dash (concat "" > dmp-defun-inner-regexp-less-dash+star)) > > (defvar dmp-defun-inner-regexp-less-star (concat "-" > dmp-defun-inner-regexp-less-dash+star)) > > (defvar dmp-defun-inner-regexp (concat "-," > dmp-defun-inner-regexp-less-dash+star)) > > (defvar dmp-defun-outer-regexp (concat "[" > dmp-defun-inner-regexp "]+")) > > (defvar dmp-bra "\\(^\\|[][ > \t\r\n()'\",.:=]\\)") > > (defvar dmp-ket "\\($\\|[][ > \t\r\n()\",.:=]\\)") > > > > Here is the actual font lock code: > > > > (defun dmp-getting--syntax-highlighting--online () > > (font-lock-add-keywords > > 'emacs-lisp-mode > > '( > > (, (format "\\(dmp[0-9]\\)\\(\\(-[%s]+\\)+\\)%s" > > dmp-defun-inner-regexp-less-dash > > dmp-ket) > > (1 'dmp-face--line0--col1-red t) > > (2 'dmp-face--line0--col2-green t) > > ) > > (, (format > "\\(dmp[0-9]\\(-[%s]+\\)\\)\\(\\([-_][-_]\\|:\\)[%s]+\\)%s" > > dmp-defun-inner-regexp-less-dash > > dmp-defun-inner-regexp > > dmp-ket) > > (1 'dmp-face--line0--col1-red t) > > (3 'dmp-face--line0--col2-green t)) > > (, (format > "\\(dmp[0-9]*\\(-[%s]+\\)*\\)\\([_-][_-][%s]+\\)\\([_-][_-][%s]+\\)%s" > > *dmp-defun-inner-regexp-less-dash* > > *dmp-defun-inner-regexp* > > *dmp-defun-inner-regexp* > > *dmp-ket*) > > (1 'dmp-face--line0--col1-red t) > > (3 'dmp-face--line0--col2-green t) > > (4 'dmp-face--line0--col3-blue t)) > > ) > > 'end) > > ) > > (add-hook 'font-lock-mode-hook 'dmp-getting--syntax-highlighting--online > 'APPEND) > > > > Notice that in the text marked with a (*) the background colour > > of the above text is the same as the background colour of the > > screen. > > > > When dmp-face--line0--col1-red, dmp-face--line0--col2-green and > > dmp-face--line0--col3-blue 's set-face-foreground set to nil, as it > > is above, I want the for the string face's background colour to > > show through as light blue in the fontification of dmp-asdssd. > > I think this is something that your code does. If I just merge two > faces, one with a background color, the other with a foreground color, > the result of the merge has the background of the first faces and the > foreground of the second. > > So I conclude that something goes wrong in your > dmp-getting--syntax-highlighting--on-line function, or in how it > interacts with font-lock. > --0000000000002f297005d43d5ed2 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Could you please run my code on your= machine to verify that it works on your machine but not mine.
<= br>
On Wed,= 29 Dec 2021 at 06:51, Eli Zaretskii <el= iz@gnu.org> wrote:
[Please keep the list address on the CC.]

> From: Davin Pearson <davin.pearson@gmail.com>
> Date: Tue, 28 Dec 2021 16:58:50 +1300
>
> In your email to me you said that one of the foreground colours
> will "win" and the other will be ignored.=C2=A0 What I want = is the
> same thing for the background colour.=C2=A0 As far as I understand the=
> winning foreground colour will be the one that is added last in
> the fontification spec, and with the symbol 'end added to
> font-lock-add-keywords.
>
> Here is my font-lock-string-face
>
> "assdsdasd"
>
> Here is the text dmp-asdssd coloured in my choice of colours: red
> and green:
>
> "dmp-asdssd" (*)
>
> Here is the code that fontifies the above code.
>
> (make-face 'dmp-face--line0--col1-red)
> (set-face-foreground 'dmp-face--line0--col1-red "#ff0000"= ;)
> (set-face-background 'dmp-face--line0--col1-red nil)
> (make-face-bold 'dmp-face--line0--col1-red)
>
> (make-face 'dmp-face--line0--col2-green)
> (set-face-foreground 'dmp-face--line0--col2-green "#00ff00&qu= ot;)
> (set-face-background 'dmp-face--line0--col2-green nil)
> (make-face-bold 'dmp-face--line0--col2-green)
>
> (make-face 'dmp-face--line0--col3-blue)
> (set-face-foreground 'dmp-face--line0--col3-blue "#0000ff&quo= t;)
> (set-face-background 'dmp-face--line0--col3-blue nil)
> (make-face-bold 'dmp-face--line0--col3-blue)
>
> Here are some useful constant strings:
>
> (defvar dmp-defun-inner-regexp-less-dash+star "a-zA-Z0-9_.!@$%^&a= mp;=3D<>/|+:;?~")
> (defvar dmp-defun-inner-regexp-less-dash=C2=A0 =C2=A0 =C2=A0 (concat &= quot;"=C2=A0 dmp-defun-inner-regexp-less-dash+star))
> (defvar dmp-defun-inner-regexp-less-star=C2=A0 =C2=A0 =C2=A0 (concat &= quot;-"=C2=A0 dmp-defun-inner-regexp-less-dash+star))
> (defvar dmp-defun-inner-regexp=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 (concat "-," dmp-defun-inner-regexp-less-dash+s= tar))
> (defvar dmp-defun-outer-regexp=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 (concat "["=C2=A0 dmp-defun-inner-regexp=C2=A0 = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 "]+"))
> (defvar dmp-bra=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"\\(^\\|[][ \t= \r\n()'\",.:=3D]\\)")
> (defvar dmp-ket=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"\\($\\|[][ \t= \r\n()\",.:=3D]\\)")
>
> Here is the actual font lock code:
>
> (defun dmp-getting--syntax-highlighting--online ()
>=C2=A0 =C2=A0(font-lock-add-keywords
>=C2=A0 =C2=A0 'emacs-lisp-mode
>=C2=A0 =C2=A0 '(
>=C2=A0 =C2=A0 =C2=A0 (, (format "\\(dmp[0-9]\\)\\(\\(-[%s]+\\)+\\)= %s"
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0dmp-defun= -inner-regexp-less-dash
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0dmp-ket)<= br> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(1 'dmp-face--line0--col1-red t)<= br> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(2 'dmp-face--line0--col2-green t= )
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0)
>=C2=A0 =C2=A0 =C2=A0 (, (format "\\(dmp[0-9]\\(-[%s]+\\)\\)\\(\\([= -_][-_]\\|:\\)[%s]+\\)%s"
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0dmp-defun= -inner-regexp-less-dash
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0dmp-defun= -inner-regexp
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0dmp-ket)<= br> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(1 'dmp-face--line0--col1-red t)<= br> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(3 'dmp-face--line0--col2-green t= ))
>=C2=A0 =C2=A0 =C2=A0 (, (format "\\(dmp[0-9]*\\(-[%s]+\\)*\\)\\([_= -][_-][%s]+\\)\\([_-][_-][%s]+\\)%s"
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*dmp-defu= n-inner-regexp-less-dash*
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*dmp-defu= n-inner-regexp*
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*dmp-defu= n-inner-regexp*
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0*dmp-ket*= )
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(1 'dmp-face--line0--col1-red t)<= br> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(3 'dmp-face--line0--col2-green t= )
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(4 'dmp-face--line0--col3-blue t)= )
>=C2=A0 =C2=A0 =C2=A0 )
>=C2=A0 =C2=A0 'end)
>=C2=A0 =C2=A0)
> (add-hook 'font-lock-mode-hook 'dmp-getting--syntax-highlighti= ng--online 'APPEND)
>
> Notice that in the text marked with a (*) the background colour
> of the above text is the same as the background colour of the
> screen.
>
> When dmp-face--line0--col1-red, dmp-face--line0--col2-green and
> dmp-face--line0--col3-blue 's set-face-foreground set to nil, as i= t
> is above, I want the for the string face's background colour to > show through as light blue in the fontification of dmp-asdssd.

I think this is something that your code does.=C2=A0 If I just merge two faces, one with a background color, the other with a foreground color,
the result of the merge has the background of the first faces and the
foreground of the second.

So I conclude that something goes wrong in your
dmp-getting--syntax-highlighting--on-line function, or in how it
interacts with font-lock.
--0000000000002f297005d43d5ed2--