From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Thibaut Verron Newsgroups: gmane.emacs.help Subject: Re: Introducing face in comments for various modes Date: Mon, 12 Dec 2022 10:58:55 +0100 Message-ID: <21708ec2-d908-4e91-6c0a-4b1cd253e707@gmail.com> References: <9ZK1Solghrmps4AarUsz2E6-mAdkrTZoXPs4RTRTd9sZ0Cd8DGhK955im1kuug-EZXU3tc5rgDDd16vQexxpFnMvMFjFqnNnh0noashyLdE=@protonmail.com> <0RJB0bPRTMAqXlUbL2kGUvJtnCNPYwPhqTNi_l9nIpQAciTZYcYCikFVqi2Nr_UZLbT1_DRtX8G0dSkgI4jln5DTYBDxLz4i7L2d9wx-kA8=@protonmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10057"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Cc: Stefan Monnier , help-gnu-emacs@gnu.org To: Heime Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Mon Dec 12 10:59:49 2022 Return-path: Envelope-to: geh-help-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 1p4fbB-0002Oy-6e for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 12 Dec 2022 10:59:49 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p4faR-00076m-Al; Mon, 12 Dec 2022 04:59:03 -0500 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 1p4faQ-000764-1E for help-gnu-emacs@gnu.org; Mon, 12 Dec 2022 04:59:02 -0500 Original-Received: from mail-wr1-x42d.google.com ([2a00:1450:4864:20::42d]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p4faN-0004FT-FH for help-gnu-emacs@gnu.org; Mon, 12 Dec 2022 04:59:01 -0500 Original-Received: by mail-wr1-x42d.google.com with SMTP id bx10so11515356wrb.0 for ; Mon, 12 Dec 2022 01:58:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=/PitZ3PgJn9NqB/RwaCzbw55BxccMP0vXMqJ1KgQcbo=; b=LWvtQCdhNNuty27ttxDo7a2yW9GJFufG+2WQpFw8YlqLb/s/oUbb0fSBZ0cLTqcWzA uR2iDrLu4uT7FHjYvWsPzrh50gXNI/5JaphV05gxPinR0PAZDzti1sXlp2JEWBV8n6Kb 4x1W0m2ULPP/TiW5yq2YLtHqePd6japzp6hVbQoXv7s9Vt2lWKw69+R2uXhKLzgsDhDx n9GJD0t8AYdA7y0LJVL4okObWvoTutMDhBXz+c5ur821f/78tLW0HIi7eIVSbg7ZIgrI e+dY6CtPaHI1xr/olqY8pfroUGe2Vt/JrTwtA/4KXAdh9oqPEEPide9bhx1tOrG05BE/ Ty4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=/PitZ3PgJn9NqB/RwaCzbw55BxccMP0vXMqJ1KgQcbo=; b=QlQnBW0sMzM2z3M40LGf1XCKZH7w5+bjwTLGzhGaGsZ3oWWi8tmnpu5gRWQRdhVWDS COLRQYK0oxqMSaVMAPKv2c1Y7x2W3nXQQz1i3x6DevdCaN9o1semo84fkPT27VDH4554 YBW2STHO24tXWxB4961pvyPyR9R1lckQOXeQ0w6vniwhvABaKmTUMUiqJWgpa9jM54QH XfvhOvW3/5lGClprNfrouwS7BOSMARhO/zqwocuhWb8GX+s7zn7QXOIv/sX5hJOqzMHu uylidMD2h7Y4Y7wFo1y5uv42eiSWlox1NoT2pdA+4giK1k9r1rILM9q2I25qKzn5Ww+9 cmEg== X-Gm-Message-State: ANoB5plawxtid9KI1L19hjMOEzfFvFCM/VwMPeyNB2eDw+q8MZAafN0/ OAHdwXkjFsgf643pqJuvyhepulJcIZE= X-Google-Smtp-Source: AA0mqf7DnoQIgN8svLUwlr28p1KotMnbyOOdghP8fdx7rQOmbvk+DrlaR4KJXNnSV7XaClG9WlJocg== X-Received: by 2002:adf:d0ca:0:b0:243:2077:8d55 with SMTP id z10-20020adfd0ca000000b0024320778d55mr10454527wrh.26.1670839137629; Mon, 12 Dec 2022 01:58:57 -0800 (PST) Original-Received: from ?IPV6:2001:628:2010:4094:29f:ef59:b326:7dad? ([2001:628:2010:4094:29f:ef59:b326:7dad]) by smtp.gmail.com with ESMTPSA id j3-20020a5d4643000000b0023677e1157fsm8477503wrs.56.2022.12.12.01.58.56 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 12 Dec 2022 01:58:57 -0800 (PST) Content-Language: en-US In-Reply-To: Received-SPF: pass client-ip=2a00:1450:4864:20::42d; envelope-from=thibaut.verron@gmail.com; helo=mail-wr1-x42d.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:141669 Archived-At: On 12/12/2022 10:21, Heime wrote: > ------- Original Message ------- > On Monday, December 12th, 2022 at 8:49 AM, Thibaut Verron > wrote: > >> Le lun. 12 déc. 2022 à 04:01, Heime a >> écrit : >> >> >> >> ------- Original Message ------- >> On Monday, December 12th, 2022 at 2:24 AM, Heime >> wrote: >> >> >> > ------- Original Message ------- >> > On Sunday, December 11th, 2022 at 5:40 PM, Stefan Monnier via >> Users list for the GNU Emacs text editor help-gnu-emacs@gnu.org >> wrote: >> > >> > > BTW, there is a related convention in ELisp code where >> comments that >> > > start in column 0 and which are introduced with 3 or more >> semi-colons >> > > are considered sectioning headers (where ";;;" means a top-level >> > > header, ";;;;" a subheader, ";;;;;" a subsubheader, ...). >> > > >> > > I'd be happy if Emacs were changed to highlighting those. >> > > >> > > Stefan >> >> If you are colourising "Sectioning Headers", ensure that vibrant >> and good contrast: >> >> 1) betweenthe text and the background; >> >> 2) and between a header, subheader, subsubheader, ... >> >> Use some colour metric (e.g. using the Web Content Accessibility >> Guidelines [WCAG]). >> >> Because I consistently see that developers almost never care (or >> have the skills) >> to properly set up colours. Have suggested changing the colour >> scheme as described, >> for "Org Headings" because they are indistinguishable against a >> dark background and >> between a heading and its subheading. Applying such metrics have >> been turned down, >> with the excuse that if I want them right, I have to work on >> emacs customisations >> myself, as the crappy colours are there to stay. >> >> >> > The colors of the standard themes are chosen with its (light) >> background in mind. If you change that background, it is not >> surprising that things fall apart. > > Choosing colours with a light background in mind is the wrong approach > because colours produce far greater visual > impact. There is no right or wrong approach, but individual preferences. If you want a dark background, just use a dark background theme. For instance, emacs has a built-in implementation of the tango dark color palette. If contrast if your primary concern, you should look at the modus themes (modus-vivendi for the dark background), which is also part of emacs now. M-x customize-themes and make your choice. > > Rather, there there should be carefully chosen colour settings for > both light and dark backgrounds. That's how you end up with settings which are at best acceptable, but not perfect, for both light and dark backgrounds. The range of colors which are suitable for both light and dark backgrounds is just too narrow. The proper way is the current way: carefully curated themes implementing all colors in a consistent ways. > > > It is not a new problem, but it doesn't mean that you have to customize all the individual faces yourself. Instead, you should look for a theme implementing >> > the colors you like, and install it. The responsibility for having >> consistent colors across all emacs fonts is on the theme designer. >> You can still tweak some >> > faces from there if you choose to of course. >> >> At any rate, Stefan's suggestion would not require making new design >> choices, as there are already faces designed for fontifying headers: >> outline-1, outline-2, etc. > > Making a new design choice is a necessity if you want to move forward. No. The question is whether to fontify those headers, how to identify them, etc. That's completely separate from the question of changing the face currently used for headers in other places. > >> Those faces are used by outline-mode, but not by outline-minor-mode >> (which emacs-lisp-mode uses to implement the ;;; comment headers) at >> the moment. > > Which proves my point that changes are necessary.  What needs to be > done is for colour contrast metrics > to be taken seriously by all packages, rather than relying on some > theme to fix the crappy default choices. Sorry to be blunt, but you couldn't be more wrong. For a start, outline-mode and outline-minor-mode are the same package. :) But more to the point, with the current system, packages choose existing faces to implement coloring based on *what* they should color (e.g. is it a comment, is it a header, is it a keyword, is it something important). And the theme designers choose colors (and other features) for those faces. As a result, colors are the same across all of Emacs (for example comments look the same in elisp and python), and -- if the theme maker is competent -- the colors will implement good contrast and be readable everywhere. If instead we were to let each package decide on its colors, Emacs would look like a Christmas tree with different colors all over the place. And most of them would be really crappy because the package developer was never trained in graphic design, or because they didn't plan for all possible background colors (it's not as simple as light and dark, some people use blue, or green backgrounds), or because they didn't predict that their choice of color would conflict with the choice made by a minor mode in another package, or... You shouldn't think of themes as "fixing the default choices" (especially considering that you are the one "breaking" them by insisting to use them with a background they weren't designed for). Their purpose is to implement different choices in a consistent way. >> > >> > > Heime [2022-12-11 15:35:41] wrote: >> > > >> > > > The following uses `hi-lock` to change the foreground of >> comments matching >> > > > a regexp. This is implemented for emacs-lisp files where >> comments start >> > > > with ";;". >> > > > >> > > > I would like to extend this for other programming languages >> besides emacs-lisp >> > > > files, using the relevant comment character automatically >> for that language. >> > > > >> > > > (defface elfa-face >> > > > '((t :foreground "magenta")) >> > > > "Face for comment headings.") >> > > > >> > > > (defun elfa-regexp (&optional actm) >> > > > "Identify comment category ';; [Category]'." >> > > > (highlight-regexp >> > > > "^;;\s+\\[.+\\].*$" 'elfa-face)) >> > > > >> > > > (defun elfa-category () >> > > > "TODO." >> > > > (interactive) >> > > > (add-to-list 'auto-mode-alist '("\\.el\\'" . hi-lock-mode)) >> > > > (add-hook 'emacs-lisp-mode-hook 'hi-lock-mode t) >> > > > (add-hook 'hi-lock-mode-hook 'elfa-regexp)) >> >