diff options
author | Damien Doligez <damien.doligez-inria.fr> | 2007-12-04 13:37:47 +0000 |
---|---|---|
committer | Damien Doligez <damien.doligez-inria.fr> | 2007-12-04 13:37:47 +0000 |
commit | 0593f338d4f9bb9942b6bc69e6786dba45f5d610 (patch) | |
tree | 3e96c4a66f40212a64526208bb1dd4a9f3783dc3 | |
parent | 9fec419841c79c9407ee46f6f757968694e02aed (diff) |
PR#4440 added function to skip warnings and jump to error
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@8704 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r-- | emacs/caml.el | 22 |
1 files changed, 19 insertions, 3 deletions
diff --git a/emacs/caml.el b/emacs/caml.el index 965cc788f..1c8957c11 100644 --- a/emacs/caml.el +++ b/emacs/caml.el @@ -809,6 +809,7 @@ from an error message produced by camlc.") ;; Wrapper around next-error. (defvar caml-error-overlay nil) +(defvar caml-next-error-skip-warnings-flag nil) ;;itz 04-21-96 somebody didn't get the documetation for next-error ;;right. When the optional argument is a number n, it should move @@ -825,7 +826,7 @@ fragment. The erroneous fragment is also temporarily highlighted if possible." (if (eq major-mode 'caml-mode) - (let (bol beg end) + (let (skip bol beg end) (save-excursion (set-buffer (if (boundp 'compilation-last-buffer) @@ -839,8 +840,15 @@ possible." (buffer-substring (match-beginning 1) (match-end 1))) end (string-to-int - (buffer-substring (match-beginning 2) (match-end 2))))))) - (cond (beg + (buffer-substring (match-beginning 2) (match-end 2))))) + (next-line) + (beginning-of-line) + (if (and (looking-at "Warning") + caml-next-error-skip-warnings-flag) + (setq skip 't)))) + (cond + (skip (next-error)) + (beg (setq end (- end beg)) (beginning-of-line) (forward-byte beg) @@ -860,6 +868,14 @@ possible." (sit-for 60)) (delete-overlay caml-error-overlay))))))))) +(defun caml-next-error-skip-warnings (&rest args) + (let ((old-flag caml-next-error-skip-warnings-flag)) + (unwind-protect + (progn (setq caml-next-error-skip-warnings-flag 't) + (apply 'next-error args)) + (setq caml-next-error-skip-warnings-flag old-flag)))) + + ;; Usual match-string doesn't work properly with font-lock-mode ;; on some emacs. |