When I start emacs, I get a couple of byte compilation warnings in a window that pops up:

Warning (bytecomp): `interactive-p' is an obsolete function (as of 23.2); use `called-interactively-p' instead. [7 times]
Warning (bytecomp): Use `with-current-buffer' rather than save-excursion+set-buffer

Can I get emacs to give me locations?

  • 3
    This info would be useful to everyone. Use M-x report-emacs-bug to request this feature.
    – abo-abo
    Commented Jun 29, 2015 at 7:52
  • If you try to set debug-on-message to Warning (bytecomp), won't it trigger the debugger?
    – wvxvw
    Commented Jun 29, 2015 at 9:38
  • 2
    IIRC you do get file names when Emacs knows the file. So presumably the above comes from some Elisp code which was "generated on the fly" rather than saved to a file and then passed to the byte-compiler. In 99% of the cases, starting Emacs should actually not compile any code at all, so maybe the problem can be fixed at an even higher level.
    – Stefan
    Commented Jun 29, 2015 at 12:51
  • @wvxvw - I didn't manage to make debug-on-message do anything. In the end, the interactive-p turned out to be caused by screen-lines.el, and the with-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.
    – Tom Seddon
    Commented Aug 23, 2015 at 1:35

2 Answers 2


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).


I'm going to guess the warnings are coming from on-the-fly compilation of ELPA packages. Try running the following code:

(defun my-package-recompile()
  "Recompile all packages"
  (byte-recompile-directory "~/.emacs.d/elpa" 0 t))

After M-x my-package-recompile switch the the Compile-Log buffer and see if these warnings are replicated in there?

  • I have the same problem but only the first error and 2 times. This solution didn't work. Also, it said Done (Total of 4 files compiled, 1 failed, 2 skipped in 3 directories).
    – trss
    Commented Sep 28, 2016 at 10:25
  • Sorry, thought this was about fixing the problem, not obtaining more information. I tried looking for the error now but it didn't appear in the list.
    – trss
    Commented Sep 28, 2016 at 10:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.