]> git.eshelyaron.com Git - emacs.git/commitdiff
Better eval-when-compile example in manual
authorMattias EngdegÄrd <mattiase@acm.org>
Thu, 25 Apr 2024 09:33:25 +0000 (11:33 +0200)
committerEshel Yaron <me@eshelyaron.com>
Thu, 25 Apr 2024 16:46:38 +0000 (18:46 +0200)
* doc/lispref/compile.texi (Eval During Compile):
`regexp-opt` makes for a poor example because as a pure function it
doesn't need `eval-when-compile` for constant inputs.

(cherry picked from commit 88ebabe23a253ce040de94e6396bc4f587ba6e69)

doc/lispref/compile.texi

index 00602198da521fc7364e7acd96c28a500fdc4fbd..08e824d27816f34b2e699944d129ff2c0bea9f73 100644 (file)
@@ -334,8 +334,8 @@ If you have a constant that needs some calculation to produce,
 @code{eval-when-compile} can do that at compile-time.  For example,
 
 @lisp
-(defvar my-regexp
-  (eval-when-compile (regexp-opt '("aaa" "aba" "abb"))))
+(defvar gauss-schoolboy-problem
+  (eval-when-compile (apply #'+ (number-sequence 1 100))))
 @end lisp
 
 @cindex macros, at compile time