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

From: Eli Zaretskii <[email-masked]>
Date: Wed, 30 Apr 2025 09:31:17 +0300

> 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.