unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* funcall of load-read-function (default nil) in elisp--eval-defun
@ 2023-12-01 11:47 Robert Weiner
  2023-12-01 16:41 ` Michael Heerdegen via Emacs development discussions.
  0 siblings, 1 reply; 3+ messages in thread
From: Robert Weiner @ 2023-12-01 11:47 UTC (permalink / raw)
  To: emacs-devel

[-- Attachment #1: Type: text/plain, Size: 549 bytes --]

I see this line in elisp--eval-defun at least Emacs 28 - 30 (pre-release):

          (setq form (funcall load-read-function (current-buffer)))

The default for load-read-function is nil, so it can't be called as a
function by default.  The value for me is indeed nil and is triggering an
error for me when trying to evaluate an ert-deftest expression.

How does this work?  I don't see the value of load-read-function set
anywhere else in elisp-mode.el.  I see it set in debug.el and edebug.el but
not when doing a normal defun eval.

Thanks,

rsw

[-- Attachment #2: Type: text/html, Size: 1411 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: funcall of load-read-function (default nil) in elisp--eval-defun
  2023-12-01 11:47 funcall of load-read-function (default nil) in elisp--eval-defun Robert Weiner
@ 2023-12-01 16:41 ` Michael Heerdegen via Emacs development discussions.
  2023-12-01 17:06   ` [External] : " Drew Adams
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Heerdegen via Emacs development discussions. @ 2023-12-01 16:41 UTC (permalink / raw)
  To: emacs-devel

Robert Weiner <rsw@gnu.org> writes:

> I see this line in elisp--eval-defun at least Emacs 28 - 30 (pre-release):
>
>           (setq form (funcall load-read-function (current-buffer)))
>
> The default for load-read-function is nil, so it can't be called as a
> function by default.

The default has been `read' since Emacs 25.1.

> The value for me is indeed nil and is triggering an error for me when
> trying to evaluate an ert-deftest expression.

I don't see a place in Emacs where this variable is set to nil.  Why
could it be bound to nil for you?


Michael.




^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [External] : Re: funcall of load-read-function (default nil) in elisp--eval-defun
  2023-12-01 16:41 ` Michael Heerdegen via Emacs development discussions.
@ 2023-12-01 17:06   ` Drew Adams
  0 siblings, 0 replies; 3+ messages in thread
From: Drew Adams @ 2023-12-01 17:06 UTC (permalink / raw)
  To: Michael Heerdegen, emacs-devel@gnu.org

> > I see this line in elisp--eval-defun at least Emacs 28 - 30 (pre-
> release):
> >
> >           (setq form (funcall load-read-function (current-buffer)))
> >
> > The default for load-read-function is nil, so it can't be called as a
> > function by default.
> 
> The default has been `read' since Emacs 25.1.

Prior to Emacs 28 I don't find that variable at all,
so in those versions it's not the variable value
whose default is `read'; it's the (only) behavior
that's `read'.  But yes, in those prior versions,
function `read' is used literally where Emacs 28+
uses the variable.

It seems that (e.g. in 28.2) the variable is dynamic
and is let-bound in function `debug', in debug.el.
But it is used also in function `elisp--eval-defun'
in elisp-mode.el.  I see no place where it might get
bound to nil, but maybe that happens in some
non-vanilla code.  HTH.



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-12-01 17:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-01 11:47 funcall of load-read-function (default nil) in elisp--eval-defun Robert Weiner
2023-12-01 16:41 ` Michael Heerdegen via Emacs development discussions.
2023-12-01 17:06   ` [External] : " Drew Adams

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).