emacs-pretest-bug
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Don't know where `open-network-stream' is defined


From: Stefan Monnier
Subject: Re: Don't know where `open-network-stream' is defined
Date: Mon, 21 Apr 2003 09:05:35 -0400

> > If I describe function on open-network-stream, I see this:
> >    open-network-stream is a compiled Lisp function.
> >    (open-network-stream NAME BUFFER HOST SERVICE)
> > 
> > i.e. I don't see the source file that the function was defined in.
> 
> > I can see source for the function in lisp/subr.el - why doesn't Emacs
> > know that's where it came from?
> 
> In CVS head, the defun for open-network-stream is conditioned like this:
> 
> (if (featurep 'make-network-process)
>     (progn
>      (defun open-network-stream ...)
>      ...))
> 
> Since subr.el is byte-compiled, the resulting code is something like
> 
> (byte-code "..." [featurep make-network-process open-network-stream ...])
> 
> whereas a normal, unconditioned defun is compiled into a defalias form.
> 
> The problem with this is that the load-history (which records which defuns
> and defaliases are loaded from which files) is NOT maintained when the
> byte code is evaluated (that's only done for the defalias).
> 
> A fix would be for the byte compiler to explicitly ensure that the
> load-history (or actually current-load-list) is updated properly for
> byte-compiled defuns like these.

I think that's the right fix.  Currently `defun's are compiled
differently if they're at the top-level (or within a `progn' which
is itself at top-level).  I think the distinction should be whether
the defun is "within a lambda" or not.

And since `defun' within lambdas are actually rather uncommon, we
might be able to simply treat all defuns as if they were top-level.


        Stefan





reply via email to

[Prev in Thread] Current Thread [Next in Thread]