comparison lispref/compile.texi @ 90787:91bf6e05918b

Merge from emacs--devo--0 Patches applied: * emacs--devo--0 (patch 662-669) - Update from CVS - Fix read-only prompt problem in isearch - Merge from gnus--rel--5.10 * gnus--rel--5.10 (patch 207-208) - Merge from emacs--devo--0 - Update from CVS Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-184
author Miles Bader <miles@gnu.org>
date Sun, 18 Mar 2007 14:11:08 +0000
parents 95d0cdf160ea 656132bca5c0
children 4ef881a120fe
comparison
equal deleted inserted replaced
90786:ca12f314faac 90787:91bf6e05918b
452 @lisp 452 @lisp
453 (eval-when-compile 453 (eval-when-compile
454 (require 'my-macro-package)) ;; only macros needed from this 454 (require 'my-macro-package)) ;; only macros needed from this
455 @end lisp 455 @end lisp
456 456
457 The same sort of thing goes for macros or @code{defalias}es defined 457 The same sort of thing goes for macros and @code{defsubst} functions
458 locally and only for use within the file. They can be defined while 458 defined locally and only for use within the file. They are needed for
459 compiling, but then not needed when executing. This is good for code 459 compiling the file, but in most cases they are not needed for
460 that's only a fallback for compatibility with other versions of Emacs. 460 execution of the compiled file. For example,
461 For example.
462 461
463 @lisp 462 @lisp
464 (eval-when-compile 463 (eval-when-compile
465 (unless (fboundp 'some-new-thing) 464 (unless (fboundp 'some-new-thing)
466 (defmacro 'some-new-thing () 465 (defmacro 'some-new-thing ()
467 (compatibility code)))) 466 (compatibility code))))
468 @end lisp 467 @end lisp
468
469 @noindent
470 This is often good for code that's only a fallback for compatibility
471 with other versions of Emacs.
469 472
470 @strong{Common Lisp Note:} At top level, @code{eval-when-compile} is analogous to the Common 473 @strong{Common Lisp Note:} At top level, @code{eval-when-compile} is analogous to the Common
471 Lisp idiom @code{(eval-when (compile eval) @dots{})}. Elsewhere, the 474 Lisp idiom @code{(eval-when (compile eval) @dots{})}. Elsewhere, the
472 Common Lisp @samp{#.} reader macro (but not when interpreting) is closer 475 Common Lisp @samp{#.} reader macro (but not when interpreting) is closer
473 to what @code{eval-when-compile} does. 476 to what @code{eval-when-compile} does.