branch: elpa/tuareg commit 5872d6b0b1e3762176855792b1e044da5d7c062a Author: Mattias EngdegÄrd <matti...@acm.org> Commit: Christophe Troestler <christophe.troest...@umons.ac.be>
Treat ancillary locations as messages at Info level, not Error Leading spaces (before the `File`) are assumed to indicate an ancillary location. This is mostly true but not for warnings. --- tuareg-tests.el | 4 ++-- tuareg.el | 10 ++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/tuareg-tests.el b/tuareg-tests.el index 7118a4b..c336ef1 100644 --- a/tuareg-tests.el +++ b/tuareg-tests.el @@ -458,8 +458,8 @@ Returns the value of the last FORM." " File \"main.ml\", line 7, characters 0-32:\n" " Definition of module M/2\n") ((1 error "main.ml" 13 13 34 34) - (225 error "main.ml" 10 10 2 40) - (308 error "main.ml" 7 7 0 31))) + (225 info "main.ml" 10 10 2 40) + (308 info "main.ml" 7 7 0 31))) (("Fatal error: exception Bad.Disaster(\"oh no!\")\n" "Raised at file \"bad.ml\", line 5, characters 4-22\n" "Called from file \"worse.ml\" (inlined), line 9, characters 2-5\n" diff --git a/tuareg.el b/tuareg.el index 5dd9429..3222ca1 100644 --- a/tuareg.el +++ b/tuareg.el @@ -3172,7 +3172,12 @@ Short cuts for interactions with the REPL: (defconst tuareg--error-regexp (rx bol - (* " ") + ;; Require either zero or 7 leading spaces, to avoid matching + ;; Python tracebacks. Assume that spaces mean that this is an + ;; ancillary location that should have level Info. + ;; FIXME: Ancillary locations for warnings probably have no spaces + ;; and are now treated as errors. Fortunately these are rare. + (? (group-n 9 " ")) ; 9: INFO (group-n 1 ; 1: HIGHLIGHT (or "File " ;; Exception backtrace. @@ -3220,7 +3225,8 @@ OCaml uses exclusive end-columns but Emacs wants them to be inclusive." (when (boundp 'compilation-error-regexp-alist-alist) (setq compilation-error-regexp-alist-alist (assq-delete-all 'ocaml compilation-error-regexp-alist-alist)) - (push `(ocaml ,tuareg--error-regexp 3 (4 . 5) (6 . tuareg--end-column) (8) 1 + (push `(ocaml ,tuareg--error-regexp 3 (4 . 5) (6 . tuareg--end-column) + (8 . 9) 1 (8 font-lock-function-name-face)) compilation-error-regexp-alist-alist))