[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: New function: rcd-highlight-list
From: |
tomas |
Subject: |
Re: New function: rcd-highlight-list |
Date: |
Wed, 19 May 2021 09:52:54 +0200 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
On Tue, May 18, 2021 at 04:13:56PM -0400, Stefan Monnier via Users list for the
GNU Emacs text editor wrote:
> tomas@tuxteam.de [2021-05-18 20:47:48] wrote:
> > On Tue, May 18, 2021 at 08:43:21PM +0300, Jean Louis wrote:
> >> * tomas@tuxteam.de <tomas@tuxteam.de> [2021-05-18 20:28]:
> >> > On Tue, May 18, 2021 at 08:08:29PM +0300, Jean Louis wrote:
> >> > >
> >> > > (defun rcd-highlight-list (list)
> >> > > "Uses LIST to highlight strings in buffer."
> >> > > (hi-lock-mode)
> >> > > (let* ((list (delete "" list))
> >> > > (highlights hi-lock-face-defaults))
> >> > > (while list
> >> > > (highlight-regexp (pop list) (pop highlights)))))
> >> > >
> >> > > Just feed to this function a list of strings to highlight:
> >> >
> >> > What happens if one of the strings is ".*"?
> >>
> >> Yes, it is not for all circumstances. It will also not support too
> >> many keywords as it uses hi-lock-face-defaults list
> >
> > Perhaps the function `regexp-quote' is built for you :)
>
> I think you mistyped `regexp-opt`.
Always taking things to the next level.
But yes, you're right: the whole while loop above would collapse
in a puff of pink smoke or something ;-)
Cheers
- t
signature.asc
Description: Digital signature