[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Changing highlight colours of headings when using outline-minor-mode
From: |
Eli Zaretskii |
Subject: |
Re: Changing highlight colours of headings when using outline-minor-mode |
Date: |
Sat, 17 Jun 2023 08:41:44 +0300 |
> Date: Fri, 16 Jun 2023 18:37:39 +0000
> From: uzibalqa <uzibalqa@proton.me>
> Cc: help-gnu-emacs@gnu.org
>
> > > Have spent quite some time writing a function to do this but I am finding
> > > it very hard
> > > to get something that actually works.
> >
> >
> > I don't understand what could be hard here. Just use
> > set-face-foreground and set-face-background.
>
> I had written this, but which has got resulted in any effect upon heading
> colours.
This doesn't use set-face-background and set-face-foreground.
> (defun heading-tyface ()
> "Set colours for headings in `outline-minor-mode'."
> (interactive)
>
> (let ( (beg (point-min))
> (end (point-max)) )
>
> (outline-map-region
>
> (lambda ()
> (let* ( ($hglevl (funcall outline-level))
> ($tyface (cond
> ((= $hglevl 1) '(:foreground "red"))
> ((= $hglevl 2) '(:foreground "blue"))
> ((= $hglevl 3) '(:foreground "green"))
> (t '(:foreground "white")))) )
> ;;--------------------------
> (when (looking-at outline-regexp)
> (put-text-property (point-at-bol) (point-at-eol)
> '$tyface $tyface))))
>
> beg end)
>
> (font-lock-flush)))
You cannot usefully use put-text-property to change faces in a buffer
in which font-lock-mode is turned on, because font-lock-mode begins by
erasing all the 'face' text properties, then puts its own 'face'
properties.
- Re: Changing highlight colours of headings when using outline-minor-mode, (continued)
- Re: Changing highlight colours of headings when using outline-minor-mode, Eli Zaretskii, 2023/06/16
- Re: Changing highlight colours of headings when using outline-minor-mode, uzibalqa, 2023/06/16
- Re: Changing highlight colours of headings when using outline-minor-mode, Bruno Barbier, 2023/06/16
- Re: Changing highlight colours of headings when using outline-minor-mode, uzibalqa, 2023/06/16
- Re: Changing highlight colours of headings when using outline-minor-mode, Bruno Barbier, 2023/06/16
- Re: Changing highlight colours of headings when using outline-minor-mode, uzibalqa, 2023/06/16
- Re: Changing highlight colours of headings when using outline-minor-mode, uzibalqa, 2023/06/16
- RE: [External] : Re: Changing highlight colours of headings when using outline-minor-mode, Drew Adams, 2023/06/16
- RE: [External] : Re: Changing highlight colours of headings when using outline-minor-mode, uzibalqa, 2023/06/16
- RE: [External] : Re: Changing highlight colours of headings when using outline-minor-mode, uzibalqa, 2023/06/16
- Re: Changing highlight colours of headings when using outline-minor-mode,
Eli Zaretskii <=