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 09:49:41 +0100 Message-ID: References: <9ZK1Solghrmps4AarUsz2E6-mAdkrTZoXPs4RTRTd9sZ0Cd8DGhK955im1kuug-EZXU3tc5rgDDd16vQexxpFnMvMFjFqnNnh0noashyLdE=@protonmail.com> <0RJB0bPRTMAqXlUbL2kGUvJtnCNPYwPhqTNi_l9nIpQAciTZYcYCikFVqi2Nr_UZLbT1_DRtX8G0dSkgI4jln5DTYBDxLz4i7L2d9wx-kA8=@protonmail.com> Reply-To: thibaut.verron@gmail.com Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="28183"; mail-complaints-to="usenet@ciao.gmane.io" 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 09:51:08 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 1p4eWi-00074Q-IQ for geh-help-gnu-emacs@m.gmane-mx.org; Mon, 12 Dec 2022 09:51:08 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p4eVh-0000C5-GG; Mon, 12 Dec 2022 03:50:05 -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 1p4eVd-0000B3-7F for help-gnu-emacs@gnu.org; Mon, 12 Dec 2022 03:50:03 -0500 Original-Received: from mail-pg1-x52e.google.com ([2607:f8b0:4864:20::52e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p4eVa-0000gq-LC for help-gnu-emacs@gnu.org; Mon, 12 Dec 2022 03:50:00 -0500 Original-Received: by mail-pg1-x52e.google.com with SMTP id 82so7746040pgc.0 for ; Mon, 12 Dec 2022 00:49:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:reply-to:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=CVimWrX8wlwAGCwFvTHPCJfAylhfkufEyLb+Y2YADmA=; b=btvKRxI0yP0ueorECcVkxo58Sig8ENI+77iKPeZBHmmweaAQ+w86aNXkkTltuGhrS3 8X422r9GZiJLkFAvzacjl5sBBPO15+VWrd0Vq+PUQtC1Dw5Xzz/lRjRmzsRxwJjUAWum uOvFM9J6j8Pr9i6K9NiM2rIFbfB+/kzQP37/sRgABZ/b7fTZkPJdRi9D/B7qZkup5xHJ 3Zqvw0PUC2XOpqU0pi0WeM5Wv0+LCGFWz4v0U7Vgdb3d5yKWNbifqt0kK9F5faSNhglZ GJXzLxWqyhdnkV1IqaPPijVGNAeSpL7o0KPT+xJnH4nUKafFHUVcf9SvoJXTxmrwjNCf sssA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:reply-to:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=CVimWrX8wlwAGCwFvTHPCJfAylhfkufEyLb+Y2YADmA=; b=BicsvcYVu/U5j4ESkj1rBvUNef2D7wlJfoK/v4ox74BoTKUd4Xqs1BBE+RHnOepMnH ddshyUKICSI+G+tNFwNnBcePpG2BQhkK6JMBlA6J1IjsqbyCvG5j+7tdHkRk87ydqeDy DBYsVY848mFf14CmxxpR/83HFShOEkOxp80hFTszLWWdb9qnDItUliEB8lf/Y3tAjYdp IeC0KMd/SCdN5IFH7DB4eHrOpDevbt+5BAVQxhw8bX2lp6j7MRHmtgAo1Xtv5+Lx/mF0 bSU0uPqVzA1O3ZY91ksvjViTjP/c1LHrjZ3fi44Z/1AQwKjAxy+1won5g1Dg/a59Qbu+ OSIQ== X-Gm-Message-State: ANoB5pmpnr/PHWtQYSr/0/F5sBNYBYEDs+YMwsGIpJ1RNfaK1E5MrPkK C0lT6O5cRisEMMriz1yUthph88exE0xrdeqzL1c= X-Google-Smtp-Source: AA0mqf71XH4FZT7uyvw/nrXYs+4yRAqlQzjXaPrEu/YBWurwrNohHCVllXQ+FbsZxmjcweQMmO9xdXHG3nbfBigUXxI= X-Received: by 2002:a62:ea0e:0:b0:575:7bb:d6fc with SMTP id t14-20020a62ea0e000000b0057507bbd6fcmr55733794pfh.79.1670834996485; Mon, 12 Dec 2022 00:49:56 -0800 (PST) In-Reply-To: <0RJB0bPRTMAqXlUbL2kGUvJtnCNPYwPhqTNi_l9nIpQAciTZYcYCikFVqi2Nr_UZLbT1_DRtX8G0dSkgI4jln5DTYBDxLz4i7L2d9wx-kA8=@protonmail.com> Received-SPF: pass client-ip=2607:f8b0:4864:20::52e; envelope-from=thibaut.verron@gmail.com; helo=mail-pg1-x52e.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, 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:141667 Archived-At: Le lun. 12 d=C3=A9c. 2022 =C3=A0 04:01, Heime = a =C3=A9crit : > > > > > > Sent with Proton Mail secure email. > > ------- Original Message ------- > On Monday, December 12th, 2022 at 2:24 AM, Heime < > heimeborgia@protonmail.com> wrote: > > > > ------- Original Message ------- > > On Sunday, December 11th, 2022 at 5:40 PM, Stefan Monnier via Users lis= t > 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. 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. 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. Best wishes, Thibaut > > > > > > > Yes. I use headings as you describe to identify sections of code that > focus on a particular task. But I also wanted to have some lower level > categorisation (within a function, say) to group some descriptions togeth= er. > > > > > 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)) > >