Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions dev/README
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,6 @@ Makefile.subdir: makefile dedicated to intensive work in a given subdirectory
Makefile.devel: utilities to automatically launch coq in various states
Makefile.common: used by other Makefiles
objects.el: various development utilities at emacs level
anomaly-traces-parser.el: a .emacs-ready elisp snippet to parse
location of Anomaly backtraces and jump to them conveniently from
the Emacs *compilation* output.
28 changes: 28 additions & 0 deletions dev/tools/anomaly-traces-parser.el
Original file line number Diff line number Diff line change
@@ -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)