comparison lisp/cl.el @ 5615:5f4f92a31875

Move the functionality of #'cl-macroexpand into Fmacroexpand, eval.c src/ChangeLog addition: 2011-12-22 Aidan Kehoe <kehoea@parhasard.net> * eval.c (Fmacroexpand): Rename Fmacroexpand_internal, add the functionality that used to be in #'cl-macroexpand--it makes no sense for us, and needlessly slows things down, to have two separate functions. * eval.c: * eval.c (syms_of_eval): Move byte-compile-macro-environment here, now it's used by #'macroexpand. lisp/ChangeLog addition: 2011-12-22 Aidan Kehoe <kehoea@parhasard.net> * bytecomp-runtime.el: * bytecomp-runtime.el (byte-compile-macro-environment): Moved to eval.c. * cl.el: * cl.el ('cl-macroexpand): New alias. * cl.el ('macroexpand-internal): New alias. * cl.el (cl-macroexpand): Move the functionality of this to #'macroexpand (formerly #'macroexpand-internal) in eval.c; since CL is always loaded in XEmacs, it brings nothing and slows things down to have the two functions separate.
author Aidan Kehoe <kehoea@parhasard.net>
date Thu, 22 Dec 2011 12:51:03 +0000
parents 855b667dea13
children bd80d9103fc8
comparison
equal deleted inserted replaced
5614:281bf2b87915 5615:5f4f92a31875
211 211
212 (make-obsolete 'multiple-value-apply 'multiple-value-call) 212 (make-obsolete 'multiple-value-apply 'multiple-value-call)
213 213
214 ;;; Macros. 214 ;;; Macros.
215 215
216 ;; XEmacs: we renamed the internal function to macroexpand-internal 216 ;; XEmacs: incorporate the functionality of #'cl-macroexpand into
217 ;; to avoid doc-file problems. 217 ;; #'macroexpand, in eval.c.
218 (defvar cl-old-macroexpand (prog1 (symbol-function 'macroexpand-internal) 218 (defalias 'cl-macroexpand 'macroexpand)
219 (defalias 'macroexpand 'cl-macroexpand))) 219 (defalias 'macroexpand-internal 'macroexpand)
220
221 (defun cl-macroexpand (cl-macro &optional cl-env)
222 "Return result of expanding macros at top level of FORM.
223 If FORM is not a macro call, it is returned unchanged.
224 Otherwise, the macro is expanded and the expansion is considered
225 in place of FORM. When a non-macro-call results, it is returned.
226
227 The second optional arg ENVIRONMENT specifies an environment of macro
228 definitions to shadow the loaded ones for use in file byte-compilation."
229 (let ((byte-compile-macro-environment
230 (if byte-compile-macro-environment
231 (append cl-env byte-compile-macro-environment) cl-env))
232 eq-hash)
233 (while (progn (setq cl-macro
234 (macroexpand-internal cl-macro
235 byte-compile-macro-environment))
236 (and (symbolp cl-macro)
237 (setq eq-hash (eq-hash cl-macro))
238 (cdr (if (fixnump eq-hash)
239 (assq eq-hash byte-compile-macro-environment)
240 (assoc eq-hash byte-compile-macro-environment)))))
241 (setq cl-macro (cadr (assoc* eq-hash byte-compile-macro-environment))))
242 cl-macro))
243
244 ;;; Declarations.
245 220
246 (defvar cl-compiling-file nil) 221 (defvar cl-compiling-file nil)
247 (defun cl-compiling-file () 222 (defun cl-compiling-file ()
248 (or cl-compiling-file 223 (or cl-compiling-file
249 ;; XEmacs change 224 ;; XEmacs change