diff --git a/src/cmp/cmpmac.lsp b/src/cmp/cmpmac.lsp index 8eec0e8e6..8ebd40f66 100644 --- a/src/cmp/cmpmac.lsp +++ b/src/cmp/cmpmac.lsp @@ -7,6 +7,7 @@ (in-package "COMPILER") #-new-cmp (import 'sys::arglist "COMPILER") +(import 'sys::with-clean-symbols "COMPILER") #+new-cmp (in-package "C-DATA") @@ -84,13 +85,6 @@ (incf *env*) (setq *max-env* (max *env* *max-env*)))) -(defmacro with-clean-symbols (symbols &body body) - "Rewrites the given forms replacing the given symbols with uninterned -ones, which is useful for creating hygienic macros." - `(progn ,@(sublis (loop for s in symbols - collect (cons s (make-symbol (symbol-name s)))) - body))) - (defmacro reckless (&rest body) `(locally (declare (optimize (safety 0))) ,@body)) diff --git a/src/lsp/cmuutil.lsp b/src/lsp/cmuutil.lsp index 1fd1a50ba..cfec649e5 100644 --- a/src/lsp/cmuutil.lsp +++ b/src/lsp/cmuutil.lsp @@ -146,3 +146,10 @@ `(,symbol (gensym ,stem)))) symbols) ,@body)) + +(defmacro with-clean-symbols (symbols &body body) + "Rewrites the given forms replacing the given symbols with uninterned +ones, which is useful for creating hygienic macros." + `(progn ,@(sublis (mapcar #'(lambda (s) (cons s (make-symbol (symbol-name s)))) + symbols) + body))) diff --git a/src/lsp/iolib.lsp b/src/lsp/iolib.lsp index a64b9ce98..73f7d62d7 100644 --- a/src/lsp/iolib.lsp +++ b/src/lsp/iolib.lsp @@ -245,17 +245,21 @@ is not given, ends the recording." The forms of the body are executed in a print environment that corresponds to the one defined in the ANSI standard. *print-base* is 10, *print-array* is t, *package* is \"CL-USER\", etc." - `(progv (car +io-syntax-progv-list+) - (cdr +io-syntax-progv-list+) - ,@body)) + (with-clean-symbols (%progv-list) + `(let ((%progv-list +io-syntax-progv-list+)) + (progv (car (ext:truly-the cons %progv-list)) + (cdr (ext:truly-the cons %progv-list)) + ,@body)))) (defmacro with-ecl-io-syntax (&body body) "Syntax: ({forms}*) The forms of the body are executed in a print environment that corresponds to the one used internally by ECL compiled files." - `(progv (car +ecl-syntax-progv-list+) - (cdr +ecl-syntax-progv-list+) - ,@body)) + (with-clean-symbols (%progv-list) + `(let ((%progv-list +ecl-syntax-progv-list+)) + (progv (car (ext:truly-the cons %progv-list)) + (cdr (ext:truly-the cons %progv-list)) + ,@body)))) #-formatter (defmacro formatter (control-string)