ocaml / tuareg

Emacs OCaml mode
GNU General Public License v3.0
363 stars 79 forks source link

Fix `tuareg-interactive-error-range-regexp` #274

Closed mattiase closed 3 years ago

mattiase commented 3 years ago

Update it to match error messages from recent OCaml versions, and fix related problems.

See #248, #273 and #231.

monnier commented 3 years ago
  • ;; Move before the comment, if we are in one.
  • (let ((ppss (syntax-ppss)))
  • (if (nth 4 ppss) (goto-char (- (nth 8 ppss) 1))))

Use (1- (nth 8 ppss)) (I know it wasn't done in the code you replace, here we get the chance! 😀)

Actually, I was wondering: why decrement by 1? I think we should either not decrement by 1 or add a comment explaining why we decrement.

  • ((region-active-p)
  • (setq start (min (point) (mark)))
  • (setq end (max (point) (mark)))
  • ;; Extend the region at the endpoints if they are in a phrase.
  • (dolist (pos (list start end))

You could just do (dolist (pos (list (point) (mark))) right? — they do not need to be ordered. One can initialize start and end with (point).

There's also region-beginning and region-end if you want them in-order.

mattiase commented 3 years ago

Patch rebased to master and fixed according to review comments (many thanks) and some bug fixes.

Chris00 commented 3 years ago

Thanks for your work!

mattiase commented 3 years ago

Always a pleasure to have an experienced reviewer!