Make compilation mode work with warnings from compiled buffer functions
commit1ca436a33c7de612e44409841d6bed0fe6268141
authorAlan Mackenzie <acm@muc.de>
Wed, 28 Nov 2018 13:15:50 +0000 (28 13:15 +0000)
committerAlan Mackenzie <acm@muc.de>
Wed, 28 Nov 2018 13:19:04 +0000 (28 13:19 +0000)
tree688efed7f76dc37d3556b1ebaa9c379e5a9c0dba
parentcef3f8fbf98296eaa59f80716db33b4f8689889a
Make compilation mode work with warnings from compiled buffer functions

In particular, warning messages from compile_defun now contain the source
buffer name and line and column numbers.  Typing CR on such a warning now
moves to the pertinent place in the source buffer.

This fixes bug #33475

* lisp/emacs-lisp/bytecomp.el (top-level): Require compile.elc?.
(emacs-lisp-compilation-file-name-or-buffer)
(emacs-lisp-compilation-parse-errors-filename-function): New
variables/constants.
(emacs-lisp-compilation-mode): New mode derived from compilation-mode.
(byte-compile-log-file): Check byte-compile-current-file for being a string,
not merely non-nil.  Change wording in message from "buffer" to "in buffer".
Go into emacs-lisp-compilation-mode rather than the plain compilation-mode.
(compile-defun): Bind byte-compile-current-file to current-buffer, not nil.

* lisp/progmodes/compilation-mode
(compilation-parse-errors-filename-function): Amend comments to specify that
this function may return a buffer, and that it need not save the match data.
(Several places): Amend comments to allow for the use of a buffer rather than
a file name.
(compilation-next-error-function): If the "file name" in file struct is
actually a buffer, use it rather than compilation-find-file's result.
(compilation-get-file-structure): save-match-data around the call to
compilation-parse-errors-filename-function.  Only call
command-line-normalize-file-name when `filename' is a string.
lisp/emacs-lisp/bytecomp.el
lisp/progmodes/compile.el