Subject: Re: bug#47747: 28.0.50; `eval-defun' may evaluate previous sexp

From: Lars Ingebrigtsen <[email-masked]>
Date: Wed, 05 May 2021 18:10:02 +0200

Sebastian Miele <[email-masked]> writes:

> With emacs -Q, a *scratch* buffer of
>
>   ;; start of buffer
>   (error "")
>   ;; !!! point somewhere here !!!
>   ;; end of buffer
>
> and point where indicated, invoking `eval-defun' (C-M-x) evaluates the
> expression (error "").
>
> Expected: An error indicating that there is no top-level form containing
> point, or after point.  (From `eval-defun's docstring: "Evaluate the
> top-level form containing point, or after point.")

If there are no forms after point, it'll eval the form before point --
and it's been that way for as long as I can remember, so I think the doc
string is just wrong here.

Does anybody else have an opinion here?  Would it make sense to have the
command signal an error if there's no forms at or after point?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no