help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Introducing face in comments for various modes


From: Heime
Subject: Re: Introducing face in comments for various modes
Date: Mon, 12 Dec 2022 03:00:29 +0000





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 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.   





> 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 together.
> 
> > 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))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]