merlin icon indicating copy to clipboard operation
merlin copied to clipboard

How to request special preprocessing flags on a per-file basis

Open fpottier opened this issue 4 years ago • 0 comments

Hi!

My project Sek involves a source file with extension .cppo.ml, which needs preprocessing with cppo. This file is src/ShareableChunk.cppo.ml.

In src/dune, I have this rule:

(rule
  (targets ShareableChunk.ml)
  (deps ShareableChunk.cppo.ml)
  (action (run %{bin:cppo} -D %{profile} %{deps} -o %{targets})))

For the file src/ShareableChunk.cppo.ml to be properly understood by Merlin, I need to pass the flags -pp "cppo -D dev" to Merlin. How can I automate this?

I can use M-x merlin-flags every time I open the file, but this is painful.

In the past, dune would generate a .merlin file and my Makefile would extend it with a FLG directive. This no longer works.

Could one for instance add a special comment (* merling-flags: -pp "cppo -D dev" *) at the end of the file, which would be recognized by Merlin?

Thanks!

fpottier avatar Jan 06 '22 18:01 fpottier