From fd52e0b08866ecdb93088e539423ee8af6db2fa9 Mon Sep 17 00:00:00 2001 From: "Basil L. Contovounesios" Date: Tue, 9 Apr 2019 20:55:25 +0100 Subject: [PATCH] Update side-effect-free primitive docs * doc/lispref/internals.texi (Writing Emacs Primitives): Describe currently preferred approach to marking built-in functions as side-effect-free. --- doc/lispref/internals.texi | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/doc/lispref/internals.texi b/doc/lispref/internals.texi index 8ebe47d9ad..826818c380 100644 --- a/doc/lispref/internals.texi +++ b/doc/lispref/internals.texi @@ -1031,10 +1031,13 @@ Writing Emacs Primitives @file{lisp.h} contains the definitions for some important macros and functions. - If you define a function which is side-effect free, update the code -in @file{byte-opt.el} that binds @code{side-effect-free-fns} and -@code{side-effect-and-error-free-fns} so that the compiler optimizer -knows about it. + If you define a function which is side-effect free, give it a +non-@code{nil} @code{side-effect-free} declaration (@pxref{Declare +Form}) or function property (@pxref{Symbol Plists}) so that the +compiler optimizer knows about it. Alternatively, you can update the +code in @file{byte-opt.el} that binds @code{side-effect-free-fns} and +@code{side-effect-and-error-free-fns}, but this approach is less +modular and no longer encouraged. @node Writing Dynamic Modules @section Writing Dynamically-Loaded Modules -- 2.20.1