kjones@talos.UUCP (Kyle Jones) (06/03/89)
In article <40865@bbn.COM> jr@bbn.com (John Robinson) writes: > (require 'cl) > (defmacro save-match-data (&rest body) > "Execute the BODY forms, restoring the global value of the match data." > (let ((original (gensym))) > (list > 'let (list (list original '(match-data))) > (list 'unwind-protect > (cons 'progn body) > (list 'store-match-data original))))) > (put 'save-match-data 'lisp-indent-hook 0) This version of save-match-data has the unfortunate side effect of dragging in all the Common LISP routines in cl.el, just to get the `gensym' function. Since the symbol returned by gensym is not interned and never will be, there is no need for each save-match-data expansion to get a different symbol *name*. Thus the call to gensym can be replaced with (make-symbol "match-data"), and the (require 'cl) line can go away. I flew this by Cesar Quiroz (who I believe wrote save-match-data) and he didn't see any problems with the change. So here is the modified save-match-data: (defmacro save-match-data (&rest body) "Execute the BODY forms, restoring the global value of the match data." (let ((original (make-symbol "match-data"))) (list 'let (list (list original '(match-data))) (list 'unwind-protect (cons 'progn body) (list 'store-match-data original))))) (put 'save-match-data 'lisp-indent-hook 0) kyle jones <kyle@cs.odu.edu> ...!uunet!talos!kjones