[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Special hilighting for comments
From: |
Heime |
Subject: |
Re: Special hilighting for comments |
Date: |
Sun, 11 Dec 2022 02:10:22 +0000 |
------- Original Message -------
On Saturday, December 10th, 2022 at 7:44 PM, Jean Louis <bugs@gnu.support>
wrote:
> * Heime heimeborgia@protonmail.com [2022-12-10 20:12]:
>
>
> ;; [Highlighted line]
>
> > > This works well:
> > >
> > > (highlight-regexp "^;; \\[.*$")
> >
> > Would it be possible to change only the foreground to some specified
> > colour?
>
>
> Always use {C-h f FUNCTION-NAME} to find description of the function.
>
> {C-h f highlight-regexp RET} tells you:
>
> (highlight-regexp REGEXP &optional FACE SUBEXP LIGHTER)
>
> Set face of each match of REGEXP to FACE.
> Interactively, prompt for REGEXP using ‘read-regexp’, then FACE.
> Use the global history list for FACE. Limit face setting to the
> corresponding SUBEXP (interactively, the prefix argument) of REGEXP.
> If SUBEXP is omitted or nil, the entire REGEXP is highlighted.
>
> That means you can use FACE for which you may define foreground and
> background.
>
> To find some interesting face I did following:
>
> {M-x list-faces-display RET}
>
> then I found one like 'custom-invalid and did following:
>
> (highlight-regexp "^;; \\[.$" 'custom-invalid)
>
> So that one
>
> ;; [Highlights this line]
>
> To define your special face:
>
> (info "(elisp) Defining Faces")
>
> Use the function `defface'. Here is example from Emacs library: (defface
> ansi-color-black '((t :foreground "black" :background "black")) "Face used to
> render black color code." :group 'ansi-colors :version "28.1") Now that means
> it should not be hard to replicate it and create your own face with
> foreground and background and then to use the function` highlight-regexp' as
> above shown or as:
>
> (highlight-regexp "^;; \\[.$" 'my-face)
>
> --
> Jean
Made my own face with your help.
- Re: Special hilighting for comments, (continued)
- Re: Special hilighting for comments, Jean Louis, 2022/12/10
- Re: Special hilighting for comments, Heime, 2022/12/10
- Re: Special hilighting for comments, Eli Zaretskii, 2022/12/10
- Re: Special hilighting for comments, Heime, 2022/12/10
- Re: Special hilighting for comments, Thibaut Verron, 2022/12/10
- Re: Special hilighting for comments, Eli Zaretskii, 2022/12/10
- Re: Special hilighting for comments, Heime, 2022/12/11
- Re: Special hilighting for comments, Jean Louis, 2022/12/10
- Re: Special hilighting for comments,
Heime <=
- Re: Special hilighting for comments, Heime, 2022/12/10
- Re: Special hilighting for comments, Jean Louis, 2022/12/10
- Re: Special hilighting for comments, Heime, 2022/12/11
- Re: Special hilighting for comments, Jean Louis, 2022/12/11
- Re: Special hilighting for comments, tomas, 2022/12/11
- Re: Special hilighting for comments, Heime, 2022/12/11
- Re: Special hilighting for comments, tomas, 2022/12/11
- Re: Special hilighting for comments, Heime, 2022/12/11
- Re: Special hilighting for comments, tomas, 2022/12/11
- Re: Special hilighting for comments, Heime, 2022/12/11