]> git.eshelyaron.com Git - emacs.git/commitdiff
Revision: miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-205
authorMiles Bader <miles@gnu.org>
Mon, 12 Apr 2004 05:43:12 +0000 (05:43 +0000)
committerMiles Bader <miles@gnu.org>
Mon, 12 Apr 2004 05:43:12 +0000 (05:43 +0000)
Add macroexpand-all to lisp reference manual

lispref/ChangeLog
lispref/macros.texi

index ada77ec4a3634904c1c679cbb0ca87689bd73f0d..aa20df103079c2803b0cb8c5aae4c8a79e0f7233 100644 (file)
@@ -1,3 +1,7 @@
+2004-04-12  Miles Bader  <miles@gnu.org>
+
+       * macros.texi (Expansion): Add description of `macroexpand-all'.
+
 2004-04-05  Jesper Harder  <harder@ifa.au.dk>
 
        * variables.texi (Variable Aliases): Mention
index 53f082cf46cd76af76d8149250a71077e27af5cd..b940125cb87fc4ad174c235c42dc6e072bf8a8eb 100644 (file)
@@ -1,6 +1,6 @@
 @c -*-texinfo-*-
 @c This is part of the GNU Emacs Lisp Reference Manual.
-@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998 Free Software Foundation, Inc.
+@c Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1998, 2004 Free Software Foundation, Inc.
 @c See the file elisp.texi for copying conditions.
 @setfilename ../info/macros
 @node Macros, Customization, Functions, Top
@@ -137,6 +137,28 @@ uses this feature.
 @end smallexample
 @end defun
 
+
+@defun macroexpand-all form &optional environment
+@cindex macro expansion in entire form
+
+@code{macroexpand-all} expands macros like @code{macroexpand}, but
+will look for and expand all macros in @var{form}, not just at the
+top-level.
+
+In emacs-lisp, @code{macroexpand-all} guarantees that if no macros
+are expanded, the return value will be @code{eq} to @var{form}.
+
+Repeating the example used for @code{macroexpand} above with
+@code{macroexpand-all}, we see that @code{macroexpand-all} @emph{does}
+expand the embedded calls to @code{inc}:
+
+@smallexample
+(macroexpand-all '(inc2 r s))
+     @result{} (progn (setq r (1+ r)) (setq s (1+ s)))
+@end smallexample
+
+@end defun
+
 @node Compiling Macros
 @section Macros and Byte Compilation
 @cindex byte-compiling macros