# HG changeset patch # User Aidan Kehoe # Date 1256915416 0 # Node ID ebca981a0012e33e27a3264a1fcfbbd0308d25fc # Parent dfc9fe46c294bf70c4d7f3219bff3334ee851bf4 If STRING is constant, call regexp-quote at compile time. 2009-10-30 Aidan Kehoe * cl-macs.el (regexp-quote): If STRING is constant, call regexp-quote at compile time. diff -r dfc9fe46c294 -r ebca981a0012 lisp/ChangeLog --- a/lisp/ChangeLog Mon Oct 26 15:41:26 2009 -0600 +++ b/lisp/ChangeLog Fri Oct 30 15:10:16 2009 +0000 @@ -1,3 +1,8 @@ +2009-10-30 Aidan Kehoe + + * cl-macs.el (regexp-quote): + If STRING is constant, call regexp-quote at compile time. + 2009-10-24 Aidan Kehoe * files.el (default-file-system-ignore-case): New variable. diff -r dfc9fe46c294 -r ebca981a0012 lisp/cl-macs.el --- a/lisp/cl-macs.el Mon Oct 26 15:41:26 2009 -0600 +++ b/lisp/cl-macs.el Fri Oct 30 15:10:16 2009 +0000 @@ -3271,6 +3271,14 @@ form (cons 'mapcar (cdr form)))) +;; XEmacs; it's perfectly reasonable, and often much clearer to those +;; reading the code, to call regexp-quote on a constant string, which is +;; something we can optimise here easily. +(define-compiler-macro regexp-quote (&whole form string) + (if (stringp string) + (regexp-quote string) + form)) + (mapc #'(lambda (y) (put (car y) 'side-effect-free t)