comparison lisp/cl-macs.el @ 4723:ebca981a0012

If STRING is constant, call regexp-quote at compile time. 2009-10-30 Aidan Kehoe <kehoea@parhasard.net> * cl-macs.el (regexp-quote): If STRING is constant, call regexp-quote at compile time.
author Aidan Kehoe <kehoea@parhasard.net>
date Fri, 30 Oct 2009 15:10:16 +0000
parents bd51ab22afa8
children 4cf435fcebbc
comparison
equal deleted inserted replaced
4722:dfc9fe46c294 4723:ebca981a0012
3269 (define-compiler-macro mapcar* (&whole form cl-func cl-x &rest cl-rest) 3269 (define-compiler-macro mapcar* (&whole form cl-func cl-x &rest cl-rest)
3270 (if cl-rest 3270 (if cl-rest
3271 form 3271 form
3272 (cons 'mapcar (cdr form)))) 3272 (cons 'mapcar (cdr form))))
3273 3273
3274 ;; XEmacs; it's perfectly reasonable, and often much clearer to those
3275 ;; reading the code, to call regexp-quote on a constant string, which is
3276 ;; something we can optimise here easily.
3277 (define-compiler-macro regexp-quote (&whole form string)
3278 (if (stringp string)
3279 (regexp-quote string)
3280 form))
3281
3274 (mapc 3282 (mapc
3275 #'(lambda (y) 3283 #'(lambda (y)
3276 (put (car y) 'side-effect-free t) 3284 (put (car y) 'side-effect-free t)
3277 (put (car y) 'byte-compile 'cl-byte-compile-compiler-macro) 3285 (put (car y) 'byte-compile 'cl-byte-compile-compiler-macro)
3278 (put (car y) 'cl-compiler-macro 3286 (put (car y) 'cl-compiler-macro