help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fancy C/C++ Code Coloring: Useable but too slow for large buffers. W


From: Nikolaj Schumacher
Subject: Re: Fancy C/C++ Code Coloring: Useable but too slow for large buffers. Wanted: Optimization!
Date: Mon, 17 Mar 2008 18:09:45 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1.92 (darwin)

Nordlöw <per.nordlow@gmail.com> wrote:

> (defun regexp-quote-alt-list (list)
>   "Return a regexp string which exactly matches any of the
> elements (alternatives) in the LIST of strings."
>   (interactive)
>   (mapconcat 'regexp-quote list "\\|"))

I didn't read much further, but you should use `regexp-opt' instead.
It's a pretty smart function.

Using your own example:

(regexp-quote-alt-list '("*a" "*b" "*c"))
-> "\\*a\\|\\*b\\|\\*c"

(regexp-opt '("*a" "*b" "*c"))
-> "\\*[abc]"



regards,
Nikolaj Schumacher




reply via email to

[Prev in Thread] Current Thread [Next in Thread]