OCamlPro / ocp-indent

Indentation tool for OCaml, to be used from editors like Emacs and Vim.
http://www.typerex.org/ocp-indent.html
Other
200 stars 63 forks source link

improve user-defined config file detection #311

Open zapashcanon opened 3 years ago

zapashcanon commented 3 years ago

Hi,

The idea behind this PR is to change the way the global user-defined configuration file path is chosen, to make it more standard and to follow the suitable conventions on all platforms. I used directories.

With this PR, the path is computed as follow:

directories has no dependency, except on Windows where it depends on ctypes, it works on all OCaml version from 4.07, but I haven't tested older versions.

nojb commented 3 years ago

Please don't add external dependencies to ocp-indent if it can be helped at all. They complicate using it in non-opam situations.

dbuenzli commented 3 years ago
  • on macOS, $HOME/Library/Application Support/com.OCamlPro.ocp-indent/config

Configurations for unix cli tool are perfectly fine according to xdg on macOS, for one thing that's where git puts its stuff and having it in .config makes it easy to sync over different unix machines.

I don't mind if you also want to too look there but please do not change the defaults as they are now.

zapashcanon commented 3 years ago

having it in .config makes it easy to sync over different unix machines

You could still sync it and just do a one time command d="$HOME/Library/Application Support/com.OCamlPro.ocp-indent/" && mkdir -p "$d" && ln -s $HOME/.config/ocp-indent/ "$d".

dbuenzli commented 3 years ago

and just do a one time command

I'd rather suggest not to try to "fix" things that are not broken.