From 9778055f756529ccf0afe75a9ec7b6c17e6c8b2f Mon Sep 17 00:00:00 2001 From: Katsumi Yamaoka Date: Fri, 3 Dec 2010 07:49:34 +0000 Subject: [PATCH] gnus-util.el (gnus-macroexpand-all): Allow optional argument `environment'. --- lisp/gnus/ChangeLog | 3 ++- lisp/gnus/gnus-util.el | 8 +++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 85c8434a7e8..302a1c5e97d 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -1,6 +1,7 @@ 2010-12-03 Katsumi Yamaoka - * gnus-util.el (gnus-macroexpand-all): Don't modify argument. + * gnus-util.el (gnus-macroexpand-all): Don't modify argument; + allow optional argument `environment'. 2010-12-03 Glenn Morris diff --git a/lisp/gnus/gnus-util.el b/lisp/gnus/gnus-util.el index 1f391f0cc0c..1ba10f46f3c 100644 --- a/lisp/gnus/gnus-util.el +++ b/lisp/gnus/gnus-util.el @@ -2036,9 +2036,11 @@ Same as `string-match' except this function does not change the match data." (if (fboundp 'macroexpand-all) (defalias 'gnus-macroexpand-all 'macroexpand-all) - (defun gnus-macroexpand-all (form) + (defun gnus-macroexpand-all (form &optional environment) "Return result of expanding macros at all levels in FORM. -If no macros are expanded, FORM is returned unchanged." +If no macros are expanded, FORM is returned unchanged. +The second optional arg ENVIRONMENT specifies an environment of macro +definitions to shadow the loaded ones for use in file byte-compilation." (if (consp form) (let ((idx 1) (len (length (setq form (copy-sequence form)))) @@ -2046,7 +2048,7 @@ If no macros are expanded, FORM is returned unchanged." (while (< idx len) (setcar (nthcdr idx form) (gnus-macroexpand-all (nth idx form))) (setq idx (1+ idx))) - (if (eq (setq expanded (macroexpand form)) form) + (if (eq (setq expanded (macroexpand form environment)) form) form (gnus-macroexpand-all expanded))) form))) -- 2.39.2