diff options
author | Gabriel Scherer <gabriel.scherer@gmail.com> | 2015-06-25 10:48:03 +0200 |
---|---|---|
committer | Gabriel Scherer <gabriel.scherer@gmail.com> | 2015-06-26 00:12:21 +0200 |
commit | d974365ef5928048edb87af218f6105ae454c3b6 (patch) | |
tree | 9a51ac6865d64ce3bfb337db365d5b83d9437a02 /dev/tools | |
parent | 9420069e4d0bf3bf377c950bbc41ea762fbcfce8 (diff) |
dev/tool/anomaly-traces-parser.el
An .emacs-ready elisp snippet to parse location of Anomaly backtraces
and jump to them conveniently from the Emacs *compilation* output.
Diffstat (limited to 'dev/tools')
-rw-r--r-- | dev/tools/anomaly-traces-parser.el | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/dev/tools/anomaly-traces-parser.el b/dev/tools/anomaly-traces-parser.el new file mode 100644 index 000000000..68f54266f --- /dev/null +++ b/dev/tools/anomaly-traces-parser.el @@ -0,0 +1,28 @@ +;; This Elisp snippet adds a regexp parser for the format of Anomaly +;; backtraces (coqc -bt ...), to the error parser of the Compilation +;; mode (C-c C-c: "Compile command: ..."). Once the +;; coq-change-error-alist-for-backtraces function has run, file +;; locations in traces are recognized and can be jumped from easily +;; from the *compilation* buffer. + +;; You can just copy everything below to your .emacs and this will be +;; enabled from any compilation command launched from an OCaml file. + +(defun coq-change-error-alist-for-backtraces () + "Hook to change the compilation-error-regexp-alist variable, to + search the coq backtraces for error locations" + (interactive) + (add-to-list + 'compilation-error-regexp-alist-alist + '(coq-backtrace + "^ *\\(?:raise\\|frame\\) @ file \\(\"?\\)\\([^,\" \n\t<>]+\\)\\1,\ + lines? \\([0-9]+\\)-?\\([0-9]+\\)?\\(?:$\\|,\ + \\(?: characters? \\([0-9]+\\)-?\\([0-9]+\\)?:?\\)?\\)" + 2 (3 . 4) (5 . 6))) + (add-to-list 'compilation-error-regexp-alist 'coq-backtrace)) + +;; this Anomaly parser should be available when one is hacking +;; on the *OCaml* code of Coq (adding bugs), so we enable it +;; through the OCaml mode hooks. +(add-hook 'caml-mode-hook 'coq-change-error-alist-for-backtraces) +(add-hook 'tuareg-mode-hook 'coq-change-error-alist-for-backtraces) |