summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/bytecomp.el
diff options
context:
space:
mode:
authorJoão Távora <joaotavora@gmail.com>2017-10-03 14:48:22 +0100
committerJoão Távora <joaotavora@gmail.com>2017-10-03 14:48:22 +0100
commitca08b6954974555ba929b4f9b6b0a52d48d1f8e6 (patch)
tree7dcbfc1aefac11fe8dda4f2d9090e4b4bd5f32ca /lisp/emacs-lisp/bytecomp.el
parent0fff900c18c3ae497294f26fd42b70990638d3ed (diff)
parent5d922e5d7eb3eace966a7f6bb834c8cb77f1cf14 (diff)
downloademacs-ca08b6954974555ba929b4f9b6b0a52d48d1f8e6.tar.gz
emacs-ca08b6954974555ba929b4f9b6b0a52d48d1f8e6.tar.bz2
emacs-ca08b6954974555ba929b4f9b6b0a52d48d1f8e6.zip
Merge branch 'scratch/flymake-refactor-clean-for-emacs-26' into emacs-26
Diffstat (limited to 'lisp/emacs-lisp/bytecomp.el')
-rw-r--r--lisp/emacs-lisp/bytecomp.el22
1 files changed, 22 insertions, 0 deletions
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 1b42961f1a4..590db570c56 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -1183,7 +1183,29 @@ Each function's symbol gets added to `byte-compile-noruntime-functions'."
(compilation-forget-errors)
pt))))
+(defvar byte-compile-log-warning-function
+ #'byte-compile--log-warning-for-byte-compile
+ "Function called when encountering a warning or error.
+Called with arguments (STRING POSITION FILL LEVEL). STRING is a
+message describing the problem. POSITION is a buffer position
+where the problem was detected. FILL is a prefix as in
+`warning-fill-prefix'. LEVEL is the level of the
+problem (`:warning' or `:error'). POSITION, FILL and LEVEL may be
+nil.")
+
(defun byte-compile-log-warning (string &optional fill level)
+ "Log a byte-compilation warning.
+STRING, FILL and LEVEL are as described in
+`byte-compile-log-warning-function', which see."
+ (funcall byte-compile-log-warning-function
+ string byte-compile-last-position
+ fill
+ level))
+
+(defun byte-compile--log-warning-for-byte-compile (string &optional
+ _position
+ fill
+ level)
"Log a message STRING in `byte-compile-log-buffer'.
Also log the current function and file if not already done. If
FILL is non-nil, set `warning-fill-prefix' to four spaces. LEVEL