Subject: Re: bug#78156: 31.0.50; 3.2 Install a Function Definition

From: badli al rashid <[email-masked]>
Date: Wed, 30 Apr 2025 14:57:32 +0800

I just do what the info file stated "Place the cursor after the last
parenthesis of the
function definition and type ‘C-x C-e’" but the output was the one I got.
Sent from Gmail

On Wed, Apr 30, 2025, 14:31 Eli Zaretskii <[email-masked]> wrote:

> > From: badli al rashid <[email-masked]>
> > Date: Wed, 30 Apr 2025 14:01:30 +0800
> >
> > From the elisp intro book, 3.2 Install a Function Definition.
> > An error occur when installing / running (C-x C-e) the function below
> >
> >      (defun multiply-by-seven (number)
> >        "Multiply NUMBER by seven."
> >        (* 7 number))
> >
> > Debugger entered--Lisp error: (void-variable number)
> >   (* 7 number)
> >   (progn (* 7 number))
> >   eval((progn (* 7 number)) t)
> >   elisp--eval-last-sexp(nil)
> >   #f(compiled-function () #<bytecode 0x18675df5af7f>)()
> >   handler-bind-1(#f(compiled-function () #<bytecode 0x18675df5af7f>)
> (error) eval-expression--debug)
> >   eval-last-sexp(nil)
> >   funcall-interactively(eval-last-sexp nil)
> >   call-interactively(eval-last-sexp nil nil)
> >   command-execute(eval-last-sexp)
> >   recursive-edit()
> >   debug(error (void-variable definition.) :backtrace-base
> eval-expression--debug)
> >   eval-expression--debug((void-variable definition.))
> >   (progn definition.)
> >   eval((progn definition.) t)
> >   elisp--eval-last-sexp(nil)
> >   #f(compiled-function () #<bytecode 0x18675df5af7f>)()
> >   handler-bind-1(#f(compiled-function () #<bytecode 0x18675df5af7f>)
> (error) eval-expression--debug)
> >   eval-last-sexp(nil)
> >   funcall-interactively(eval-last-sexp nil)
> >   call-interactively(eval-last-sexp nil nil)
> >   command-execute(eval-last-sexp)
> >   recursive-edit()
> >   debug(error (void-variable number) :backtrace-base
> eval-expression--debug)
> >   eval-expression--debug((void-variable number))
> >   (* 7 number)
> >   (progn (* 7 number))
> >   eval((progn (* 7 number)) t)
> >   elisp--eval-last-sexp(nil)
> >   #f(compiled-function () #<bytecode 0x18675df5af7f>)()
> >   handler-bind-1(#f(compiled-function () #<bytecode 0x18675df5af7f>)
> (error) eval-expression--debug)
> >   eval-last-sexp(nil)
> >   funcall-interactively(eval-last-sexp nil)
> >   call-interactively(eval-last-sexp nil nil)
> >   command-execute(eval-last-sexp)
>
> Please describe what you did, because I cannot reproduce the problem.
> My steps were:
>
>  . emacs -Q
>  . insert the function's definition into the *scratch* buffer
>  . C-x C-e on the closing parenthesis of the function to install the
>    function in Emacs
>  . type (multiply-by-seven 10) into *scratch* buffer
>  . type C-x C-e after that
>  . the result (70) is shown in the echo area, as expected
>
> So I see no bug here.
>
> From the backtrace you show, I'm guessing that you evaluated something
> like
>
>    (multiply-by-seven number)
>
> without making 'number' a variable with some numerical value.
>