all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: <tomas@tuxteam.de>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: help-gnu-emacs@gnu.org
Subject: Re: New function: rcd-highlight-list
Date: Wed, 19 May 2021 09:52:54 +0200	[thread overview]
Message-ID: <20210519075254.GF7028@tuxteam.de> (raw)
In-Reply-To: <jwv1ra3ol5b.fsf-monnier+emacs@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 1231 bytes --]

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

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

  reply	other threads:[~2021-05-19  7:52 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-18 17:08 New function: rcd-highlight-list Jean Louis
2021-05-18 17:27 ` tomas
2021-05-18 17:43   ` Jean Louis
2021-05-18 18:47     ` tomas
2021-05-18 20:13       ` Stefan Monnier via Users list for the GNU Emacs text editor
2021-05-19  7:52         ` tomas [this message]
2021-05-19 10:15           ` Yuri Khan
2021-05-19 10:31             ` tomas
2021-05-19 10:27           ` Jean Louis
2021-05-18 20:14       ` Jean Louis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210519075254.GF7028@tuxteam.de \
    --to=tomas@tuxteam.de \
    --cc=help-gnu-emacs@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.