Skip to content

Commit

Permalink
Sync modified buffers too
Browse files Browse the repository at this point in the history
ocaml/merlin#320 seems to be fixed
now, so we can always sync again. Many thanks, @def-lkb
  • Loading branch information
swsnr committed Dec 25, 2014
1 parent 23a513b commit 8246d8f
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 17 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ master (in development)

- Fix warning about parsing messages [GH-1]
- Fix error column offsets [GH-2]
- Constantly sync buffer with Merlin to keep error reporting up to date

0.1 (Nov 30, 2014)
==================
Expand Down
7 changes: 0 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,6 @@ If you enable Merlin's error checking with `M-x merlin-toggle-view-errors`,
Flycheck will not use the `ocaml-merlin` syntax checker anymore, to avoid
duplicate overlays.

Known issues
------------

Like Merlin itself `ocaml-merlin` only checks buffers on save. While Flycheck
itself is capable of on-the-fly checking while editing, Merlin does not handle
this well, and tends to freeze if the buffer is checked too frequently.

License
-------

Expand Down
11 changes: 1 addition & 10 deletions flycheck-ocaml.el
Original file line number Diff line number Diff line change
Expand Up @@ -107,16 +107,7 @@ Return the corresponding `flycheck-error'."
"Start a Merlin syntax check with CHECKER.
CALLBACK is the status callback passed by Flycheck."
(when (flycheck-buffer-saved-p)
;; Sync the buffer contents with Merlin, if the buffer is saved, like Merlin
;; does. Ideally, we'd sync on every check, but Merlin tends to freeze
;; randomly when synching too frequently (see
;; https://github.com/the-lambda-church/merlin/issues/320).
;;
;; So now we just get the old errors when checking a modified buffer, but at
;; least we get any errors at all, so that the mode line display and the
;; error list can show something that's at least half way correct.
(merlin-sync-to-point (point-max) t))
(merlin-sync-to-point (point-max) t)
;; Put the current buffer into the closure environment so that we have access
;; to it later.
(let ((buffer (current-buffer)))
Expand Down

0 comments on commit 8246d8f

Please sign in to comment.