[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: byte-compile-warn in do-after-load-evaluation - a bug?
From: |
Stefan Monnier |
Subject: |
Re: byte-compile-warn in do-after-load-evaluation - a bug? |
Date: |
Fri, 21 Jan 2022 13:39:26 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) |
> 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:
[...]
(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`).
> 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?
Stefan