caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Merlin question about configuration file
@ 2013-11-15 12:52 Johan Mazel
  2013-11-15 13:26 ` François Bobot
  2013-11-16  9:55 ` Thomas Refis
  0 siblings, 2 replies; 9+ messages in thread
From: Johan Mazel @ 2013-11-15 12:52 UTC (permalink / raw)
  To: OCaml Mailing List

[-- Attachment #1: Type: text/plain, Size: 626 bytes --]

Hi
I managed to get merlin to work with auto-completion and so-on in Emacs 2.4.
I have a code base big enough to make it hard for me to manually setup the
.merlin configuration for every directory in src (with the S directive) and
_build (with the B directive).

Is there any way to only specify these two directory (src and _build) and
tell merlin to scan every subdirectory of these two directories ?
If it is not the case, I will write a small bash script to automatically
write/update the merlin file I would very much like to not have to resort
to this.

Thanks a lot to the authors of this great tool. :)
Regards.
Johan

[-- Attachment #2: Type: text/html, Size: 754 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Caml-list] Merlin question about configuration file
  2013-11-15 12:52 [Caml-list] Merlin question about configuration file Johan Mazel
@ 2013-11-15 13:26 ` François Bobot
  2013-11-15 13:35   ` Raphaël Proust
  2013-11-16  9:55 ` Thomas Refis
  1 sibling, 1 reply; 9+ messages in thread
From: François Bobot @ 2013-11-15 13:26 UTC (permalink / raw)
  To: caml-list

On 15/11/2013 13:52, Johan Mazel wrote:
> Hi
> I managed to get merlin to work with auto-completion and so-on in Emacs 2.4.
> I have a code base big enough to make it hard for me to manually setup
> the .merlin configuration for every directory in src (with the S
> directive) and _build (with the B directive).
>
> Is there any way to only specify these two directory (src and _build)
> and tell merlin to scan every subdirectory of these two directories ?
> If it is not the case, I will write a small bash script to automatically
> write/update the merlin file I would very much like to not have to
> resort to this.

I don't know an elegant solution, but I can give you the script I use.

There is another glitch if you have a big code base with many 
sub-...-subdirectories: merlin look for the .merlin in the current 
directory and the parent directory. So you need to copy or link the 
.merlin in many directories. And then the directories inside the .merlin 
must be absolute. Moreover you can't put the .merlin in every 
subdirectories (ex: .svn, tests,...).

For frama-c I added this Makefile target:

.PHONY:merlin
merlin:
#create Merlin file
         find `echo "src cil external" | xargs -n 1 -d ' ' readlink -f` 
\( -name .svn -name tests -o -name doc -o -name result -o -name -o -name 
oracle -o -name "*.cache" \) -prune -o \( -type d -printf "B %p\nS %p\n" 
  \) > .merlin
         echo $(OCAMLGRAPH_MERLIN) >> .merlin
         echo "PKG zarith" >> .merlin
#create link in subdirectories to the merlin file
         find `echo "src cil external" | xargs -n 1 -d ' ' readlink -f` 
\( -name tests -o -name doc -o -name result -o -name -o -name oracle -o 
-name "*.cache" \) -prune -o \( -type d -exec ln -fs $$PWD/.merlin 
\{\}/.merlin \;  \)



>
> Thanks a lot to the authors of this great tool. :)
+1

-- 
François


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Caml-list] Merlin question about configuration file
  2013-11-15 13:26 ` François Bobot
@ 2013-11-15 13:35   ` Raphaël Proust
  2013-11-15 13:48     ` François Bobot
  2013-11-15 13:51     ` Louis Gesbert
  0 siblings, 2 replies; 9+ messages in thread
From: Raphaël Proust @ 2013-11-15 13:35 UTC (permalink / raw)
  To: François Bobot; +Cc: OCaml Mailing List

On Fri, Nov 15, 2013 at 1:26 PM, François Bobot <francois.bobot@cea.fr> wrote:
> On 15/11/2013 13:52, Johan Mazel wrote:
>> […]
> There is another glitch if you have a big code base with many
> sub-...-subdirectories: merlin look for the .merlin in the current directory
> and the parent directory.[…]

Maybe there should be an option for Merlin to look arbitrarily far
into parent directories, stopping whenever a .git, .svn, _darcs, &c.
is found. (This is generally a good indication that one is at the root
of a project.)

Does that make sense?
Would that help?


-- 
______________
Raphaël Proust

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Caml-list] Merlin question about configuration file
  2013-11-15 13:35   ` Raphaël Proust
@ 2013-11-15 13:48     ` François Bobot
       [not found]       ` <CAD5gH1HxcrbYR5MgK+jOwuxonJAKfTMHUwTAxG7XwOip4K3_dQ@mail.gmail.com>
  2013-11-16  1:58       ` Edgar Friendly
  2013-11-15 13:51     ` Louis Gesbert
  1 sibling, 2 replies; 9+ messages in thread
From: François Bobot @ 2013-11-15 13:48 UTC (permalink / raw)
  To: Raphaël Proust; +Cc: OCaml Mailing List

On 15/11/2013 14:35, Raphaël Proust wrote:
> Maybe there should be an option for Merlin to look arbitrarily far
> into parent directories, stopping whenever a .git, .svn, _darcs, &c.
> is found. (This is generally a good indication that one is at the root
> of a project.)
>

There is a .svn in every sub-directory.

> Does that make sense?
> Would that help?

I would prefer an option of merlin that make it look arbitrarily far 
into parent directories until it find a .merlin.

-- 
François


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Caml-list] Merlin question about configuration file
  2013-11-15 13:35   ` Raphaël Proust
  2013-11-15 13:48     ` François Bobot
@ 2013-11-15 13:51     ` Louis Gesbert
  1 sibling, 0 replies; 9+ messages in thread
From: Louis Gesbert @ 2013-11-15 13:51 UTC (permalink / raw)
  To: caml-list, Raphaël Proust; +Cc: François Bobot

[-- Attachment #1: Type: text/plain, Size: 958 bytes --]

Le vendredi 15 novembre 2013 13:35:19 Raphaël Proust a écrit :
> On Fri, Nov 15, 2013 at 1:26 PM, François Bobot <francois.bobot@cea.fr> wrote:
> > On 15/11/2013 13:52, Johan Mazel wrote:
> >> […]
> > There is another glitch if you have a big code base with many
> > sub-...-subdirectories: merlin look for the .merlin in the current directory
> > and the parent directory.[…]
> 
> Maybe there should be an option for Merlin to look arbitrarily far
> into parent directories, stopping whenever a .git, .svn, _darcs, &c.
> is found. (This is generally a good indication that one is at the root
> of a project.)
> 
> Does that make sense?
> Would that help?
> 

That's what I do in ocp-index, a bit of a hack but quite handy, and I've not had problems with it so far. (As François points out, .svn is probably not a good idea though)

Implementation here: https://github.com/OCamlPro/ocp-index/blob/master/src/indexOptions.ml#L62


[-- Attachment #2: Type: text/html, Size: 4359 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Caml-list] Merlin question about configuration file
       [not found]       ` <CAD5gH1HxcrbYR5MgK+jOwuxonJAKfTMHUwTAxG7XwOip4K3_dQ@mail.gmail.com>
@ 2013-11-15 14:13         ` François Bobot
  0 siblings, 0 replies; 9+ messages in thread
From: François Bobot @ 2013-11-15 14:13 UTC (permalink / raw)
  To: Olivier Andrieu; +Cc: Raphaël Proust, OCaml Mailing List

On 15/11/2013 15:00, Olivier Andrieu wrote:
>
>> I would prefer an option of merlin that make it look arbitrarily far into
>> parent directories until it find a .merlin.
>
> That's how it works in the current codebase:
>    https://github.com/def-lkb/merlin/blob/master/src/dot_merlin.ml#L67,L76
>

Great! And the option -project-find is very handy for testing:

#ocamlmerlin -project-find src/wp/qed/src
/home/bobot/Sources/frama-c/.merlin

+1 again for merlin!

-- 
François

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Caml-list] Merlin question about configuration file
  2013-11-15 13:48     ` François Bobot
       [not found]       ` <CAD5gH1HxcrbYR5MgK+jOwuxonJAKfTMHUwTAxG7XwOip4K3_dQ@mail.gmail.com>
@ 2013-11-16  1:58       ` Edgar Friendly
  2013-11-16  9:52         ` Thomas Refis
  1 sibling, 1 reply; 9+ messages in thread
From: Edgar Friendly @ 2013-11-16  1:58 UTC (permalink / raw)
  To: François Bobot; +Cc: Raphaël Proust, OCaml Mailing List

[-- Attachment #1: Type: text/plain, Size: 209 bytes --]

On Fri, Nov 15, 2013 at 8:48 AM, François Bobot <francois.bobot@cea.fr>wrote:

> There is a .svn in every sub-directory.
>
> Then keep looking at parent directories until there's *no* .svn folder.

E.

[-- Attachment #2: Type: text/html, Size: 623 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Caml-list] Merlin question about configuration file
  2013-11-16  1:58       ` Edgar Friendly
@ 2013-11-16  9:52         ` Thomas Refis
  0 siblings, 0 replies; 9+ messages in thread
From: Thomas Refis @ 2013-11-16  9:52 UTC (permalink / raw)
  To: Edgar Friendly
  Cc: François Bobot, Raphaël Proust, OCaml Mailing List

> Maybe there should be an option for Merlin to look arbitrarily far
> into parent directories, stopping whenever a .git, .svn, _darcs, &c.
> is found. (This is generally a good indication that one is at the root
> of a project.)

There is such an option.
You just need to add the "REC" flag to the .merlin files of your
deepest directories.
As described here : https://github.com/def-lkb/merlin#merlin-project

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Caml-list] Merlin question about configuration file
  2013-11-15 12:52 [Caml-list] Merlin question about configuration file Johan Mazel
  2013-11-15 13:26 ` François Bobot
@ 2013-11-16  9:55 ` Thomas Refis
  1 sibling, 0 replies; 9+ messages in thread
From: Thomas Refis @ 2013-11-16  9:55 UTC (permalink / raw)
  To: Johan Mazel; +Cc: OCaml Mailing List

2013/11/15 Johan Mazel <johan.mazel@gmail.com>:
> Is there any way to only specify these two directory (src and _build) and
> tell merlin to scan every subdirectory of these two directories ?

Not at the moment no, sorry.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2013-11-16  9:55 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-15 12:52 [Caml-list] Merlin question about configuration file Johan Mazel
2013-11-15 13:26 ` François Bobot
2013-11-15 13:35   ` Raphaël Proust
2013-11-15 13:48     ` François Bobot
     [not found]       ` <CAD5gH1HxcrbYR5MgK+jOwuxonJAKfTMHUwTAxG7XwOip4K3_dQ@mail.gmail.com>
2013-11-15 14:13         ` François Bobot
2013-11-16  1:58       ` Edgar Friendly
2013-11-16  9:52         ` Thomas Refis
2013-11-15 13:51     ` Louis Gesbert
2013-11-16  9:55 ` Thomas Refis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).