[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: byte-compile-warn in do-after-load-evaluation - a bug?
From: |
Alan Mackenzie |
Subject: |
Re: byte-compile-warn in do-after-load-evaluation - a bug? |
Date: |
Fri, 21 Jan 2022 21:33:30 +0000 |
Hello, Stefan.
On Fri, Jan 21, 2022 at 13:39:26 -0500, Stefan Monnier wrote:
> > Might it be that somebody not having a good day just used that function
> > thinking it was a general purpose warning function?
> No, and I think the code makes it pretty clear:
Sorry, yes it does. I think it's me that's having the bad day.
> [...]
> (cond
> ((bound-and-true-p byte-compile-current-file)
> ;; Don't warn about obsolete files using other obsolete files.
> (unless (and (stringp byte-compile-current-file)
> (string-match-p "/obsolete/[^/]*\\'"
> (expand-file-name
> byte-compile-current-file
> byte-compile-root-dir)))
> (byte-compile-warn "%s" msg)))
> [...]
> The intention is to use this code when the load was performed by the
> byte-compiler (presumably because of a `require`).
I think I've got it sorted out, now. By pushing an element onto
byte-compile-form-stack when handling a `require', we can ensure
byte-compile-warn will have something to chew on.
(scratch/correct-warning-pos branch.)
> > The problem with it is that it uses an implicit (compilation) source
> > position in the message it outputs. There is no compilation going on at
> > the moment.
> I suspect that what we should do here is to make the byte-compiler
> provide more info. E.g. instead of just testing
> `byte-compile-current-file`, which is a kind of "accidental" info, we
> should have `bytecomp.el` do a
> (let ((byte-compile-triggered-load-source <sourcedata>))
> ...)
> so `do-after-load-evaluation` can check this specific var and use its
> info to provide proper source information.
> WDYT?
I'm not convinced. I think byte-compile-form-stack already provides (or
can provide) sufficient source position information.
> Stefan
--
Alan Mackenzie (Nuremberg, Germany).