This happens due to display-warning
delaying warnings until after init time. By then, the file name and location are no longer known.
(defun display-warning (type message &optional level buffer-name)
[...]
(if (not (or after-init-time noninteractive (daemonp)))
;; Ensure warnings that happen early in the startup sequence
;; are visible when startup completes (bug#20792).
(delay-warning type message level buffer-name)
(unless level
[... ]
You should be able to disable this with some advice:
(defun dont-delay-compile-warnings (fun type &rest args)
(if (eq type 'bytecomp)
(let ((after-init-time t))
(apply fun type args))
(apply fun type args)))
(advice-add 'display-warning :around #'dont-delay-compile-warnings)
Although this might prevent the *Warnings*
buffer from popping up (as described in Bug#20792), so you'll have to check it manually in the *Compile-Log*
buffer.
Previous case of this, reported on emacs-devel here (continues here).
report-emacs-bug
to request this feature.debug-on-message
toWarning (bytecomp)
, won't it trigger the debugger?debug-on-message
do anything. In the end, theinteractive-p
turned out to be caused by screen-lines.el, and thewith-current-buffer
one was due to an ancient version of tuareg-mode. I decided to remove both. I don't use tuareg-mode, and while I quite like screen-lines.el, it's long caused me all sorts of problems with keyboard macros.