Browsing source with merlin (& tuareg) the right way?

On Emacs:
C-c C-l fires merlin-locate
C-c & fires merlin-pop-stack

Is there a simple way to automatically close the opened buffer when just looking at at file? (as the opened buffer replaces another buffer in the chosen window)

Also, merlin-locate opens the .mli while I may want to open the .ml (this can be changed, but then it will always open .ml).

Using C-c C-a (tuareg-find-alternate-file) allows to alternate ml/mli . It would be enough but it positions the cursor at the beginning of the file, which requires an additional search.

If I browse inside my own program, I would like to jump from .ml to .ml .
If I browse libraries used by my program, I would like to open library .mli first, then dig into its .ml, if necessary.
If I want to dig down into the library funtion of the library function, I would like to stay in the same (Emacs) window not to get a bunch of buffers opened. And get buffers automatically closed/killed when doing merlin-pop-stack to avoid burden.

Can you share your merlin and tuareg best practices for Emacs and some ~/.emacs configuration that allow to use merlin more smoothly, or as I quickly describe?

Thanks.

3 Likes

Browsing the source of your own program and libraries and of other people’s libraries is a key for being able to smoothly program and also to attract more people to OCaml.

Am I the only one that find this it so archaic programming in OCaml with Emacs/Tuareg? (compared to other mainstream PLs IDE and (integrated) tooling).

Can you share your (Emacs) OCaml IDE setup or give some advice?
This should also be of interest for new comers to OCaml that may find IDE support neither easy nor fantastic.

You can check out:

3 Likes

vscode:
it works well, except that it’s not possible yet to evaluate OCaml expressions.

emacs:
my main concern is about this editor because tuareg handles correctly sending OCaml expressions to a Toplevel.
Is there a recommended kit of emacs extensions and parameters that turns it into a real fully fledged IDE that would look like vscode?

Each time I need to setup or fine tune something I need in emacs, I spend hours digging into more or less recent documentation. Eventually, I find something but it’s always.
The right and ultimate solution should be learning Emacs/Elisp in details to build my own editor, while I would like to focus on OCaml and its large body of libraries.

Thanks.