[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Colour Capital Letters
From: |
Philip Kaludercic |
Subject: |
Re: Colour Capital Letters |
Date: |
Mon, 02 Oct 2023 10:28:49 +0000 |
Heime <heimeborgia@protonmail.com> writes:
> I want to make a stand alone function that uses a different colour for
> capital letters
> in CamelCase names. Possibly taking code from glasses.el.
>
> (defun color-camelcase-capital-letters ()
> "Color capital letters in CamelCase variables."
> (interactive)
> (highlight-regexp "\\(?:^\\|\\b\\)[[:upper:]][[:lower:]]*" 'hi-yellow))
^
this part will only match a the beginning of a
line or an empty string at the beginning or the
end of a word, so if you want
CamelCase
^ ^
here and here
to be highlighted, then that won't work.
A variation of your code might be this, that highlights just the
capital letters, using `highlight-regexp's optional SUBEXP argument:
(highlight-regexp (rx word-start (group upper) (+ alnum)) 'hi-yellow 1)
>
> What can I do ?