From: Katsumi Yamaoka Date: Sun, 5 Dec 2010 23:29:50 +0000 (+0000) Subject: gnus-util.el (gnus-macroexpand-all): Use eval-and-compile. X-Git-Tag: emacs-pretest-24.0.90~104^2~275^2~438^2~45^2~39 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=c67e426e957225cbd792325e31e4d4178e3c66d3;p=emacs.git gnus-util.el (gnus-macroexpand-all): Use eval-and-compile. --- diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 6ca94d17600..d71d546a2c9 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -1,3 +1,7 @@ +2010-12-05 Katsumi Yamaoka + + * gnus-util.el (gnus-macroexpand-all): Use eval-and-compile. + 2010-12-05 Lars Magne Ingebrigtsen * gnus-sum.el (gnus-summary-respool-article): The completion function diff --git a/lisp/gnus/gnus-util.el b/lisp/gnus/gnus-util.el index 45fd26c86c0..fa4bf076a30 100644 --- a/lisp/gnus/gnus-util.el +++ b/lisp/gnus/gnus-util.el @@ -2037,25 +2037,26 @@ Same as `string-match' except this function does not change the match data." (save-match-data (string-match regexp string start)))) -(if (fboundp 'macroexpand-all) - (defalias 'gnus-macroexpand-all 'macroexpand-all) - (defun gnus-macroexpand-all (form &optional environment) - "Return result of expanding macros at all levels in FORM. +(eval-and-compile + (if (fboundp 'macroexpand-all) + (defalias 'gnus-macroexpand-all 'macroexpand-all) + (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. 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)))) - expanded) - (while (< idx len) - (setcar (nthcdr idx form) (gnus-macroexpand-all (nth idx form) - environment)) - (setq idx (1+ idx))) - (if (eq (setq expanded (macroexpand form environment)) form) - form - (gnus-macroexpand-all expanded environment))) - form))) + (if (consp form) + (let ((idx 1) + (len (length (setq form (copy-sequence form)))) + expanded) + (while (< idx len) + (setcar (nthcdr idx form) (gnus-macroexpand-all (nth idx form) + environment)) + (setq idx (1+ idx))) + (if (eq (setq expanded (macroexpand form environment)) form) + form + (gnus-macroexpand-all expanded environment))) + form)))) (provide 'gnus-util)