diff options
Diffstat (limited to 'devdocs/elisp/simple-macro.html')
| -rw-r--r-- | devdocs/elisp/simple-macro.html | 11 |
1 files changed, 0 insertions, 11 deletions
diff --git a/devdocs/elisp/simple-macro.html b/devdocs/elisp/simple-macro.html deleted file mode 100644 index b2e75c46..00000000 --- a/devdocs/elisp/simple-macro.html +++ /dev/null @@ -1,11 +0,0 @@ - <h3 class="section">A Simple Example of a Macro</h3> <p>Suppose we would like to define a Lisp construct to increment a variable value, much like the <code>++</code> operator in C. We would like to write <code>(inc x)</code> and have the effect of <code>(setq x (1+ x))</code>. Here’s a macro definition that does the job: </p> <div class="example"> <pre class="example">(defmacro inc (var) - (list 'setq var (list '1+ var))) -</pre> -</div> <p>When this is called with <code>(inc x)</code>, the argument <var>var</var> is the symbol <code>x</code>—<em>not</em> the <em>value</em> of <code>x</code>, as it would be in a function. The body of the macro uses this to construct the expansion, which is <code>(setq x (1+ x))</code>. Once the macro definition returns this expansion, Lisp proceeds to evaluate it, thus incrementing <code>x</code>. </p> <dl> <dt id="macrop">Function: <strong>macrop</strong> <em>object</em> -</dt> <dd><p>This predicate tests whether its argument is a macro, and returns <code>t</code> if so, <code>nil</code> otherwise. </p></dd> -</dl><div class="_attribution"> - <p class="_attribution-p"> - Copyright © 1990-1996, 1998-2022 Free Software Foundation, Inc. <br>Licensed under the GNU GPL license.<br> - <a href="https://www.gnu.org/software/emacs/manual/html_node/elisp/Simple-Macro.html" class="_attribution-link">https://www.gnu.org/software/emacs/manual/html_node/elisp/Simple-Macro.html</a> - </p> -</div> |
