elisp - regexp-opt function missing in Emacs? -
elisp - regexp-opt function missing in Emacs? -
i've started playing around elisp create font-locks (syntax highlighting) in emacs. of tutorials out there mention using elisp function "regexp-opt" optimize regular expressions, version of emacs (23.2) doesn't seem have function. furthermore, googling reply doesn't seem turn useful results. ideas?
as can find out via c-h f regexp-opt:
regexp-opt compiled lisp function.
(regexp-opt strings &optional paren)
return regexp match string in list strings. each string should unique in strings , should not contain regexps, quoted or not. if optional paren non-nil, ensure returned regexp enclosed @ to the lowest degree 1 regexp grouping construct. returned regexp typically more efficient equivalent regexp:
(let ((open (if paren "\(" "")) (close (if paren "\)" ""))) (concat open (mapconcat 'regexp-quote strings "\|") close))
if paren `words', resulting regexp additionally surrounded \< , >.
note, function used in lisp code, not interactive command run m-x
emacs elisp
Comments
Post a Comment