caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Louis Gesbert <gesbert@antislash.info>
To: caml-list@inria.fr
Subject: Re: [Caml-list] ocp-indent beta release
Date: Tue, 12 Feb 2013 12:33:00 +0100	[thread overview]
Message-ID: <201302121233.00379.gesbert@antislash.info> (raw)
In-Reply-To: <51153ACE.6070909@inria.fr>

You can get this behaviour with `ocp-indent --config with=3,match_clause=4`

The default behaviour was chosen to reflect the most common current indentation 
practices (and the guidelines, 
http://caml.inria.fr/resources/doc/guides/guidelines.en.html) ; I guess it was 
found that indenting the | doesn't improve readability and makes you run into 
the right margin more quickly.

--
Louis Gesbert

Le vendredi 8 février 2013 18:50:06, Romain Bardou a écrit :
> I tried it very quickly, it seems to work fine.
> 
> I'm curious though, when did this way of indenting pattern-matching
> became a thing? When I started programming in OCaml, the default Tuareg
> behavior was:
> 
> match x with
> 
>    | A ->
> 
>        b
> 
> Now it seems everywhere I go it's like this never existed.
> 
> Cheers,
> 
> > OCamlPro is proud to announce the beta-release of ocp-indent.
> > 
> > Ocp-indent is a simple tool, entirely written in OCaml, which sole
> > purpose is to indent OCaml code. It can plug-in seamlessly into emacs'
> > tuareg mode, or be run from vim.
> > 
> > You can try it now with:
> > 
> > $ opam install ocp-indent
> > 
> > $ INSTDIR="$(opam config var prefix)/share/typerex/ocp-indent"
> > 
> > $ echo '(load-file "'"$INSTDIR/ocp-indent.el"'")'>>~/.emacs
> > 
> > $ echo 'autocmd FileType ocaml source
> > '"$INSTDIR"'/ocp-indent.vim'>>~/.vimrc
> > 
> > 
> > Or check it out at https://github.com/OCamlPro/ocp-indent
> > 
> > 
> > 
> > It presents many improvements over the tuareg indentation engine, a much
> > better understanding of the syntax, linear complexity, specific handling
> > for many cases. Also, it was intentionally provided with much less
> > customisation options.
> > 
> > Feel free to submit any code snippet that is not indented to your taste,
> > to help us improve ocp-indent further.
> > 
> > 
> > Some comparison with tuareg on a few big OCaml projects can be seen at
> > http://htmlpreview.github.com/?https://github.com/AltGr/ocp-indent-
> > tests/blob/master/status.html
> > 
> > 
> > --
> > Louis Gesbert, OCamlPro

  reply	other threads:[~2013-02-12 11:33 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-08 15:25 Louis Gesbert
2013-02-08 15:55 ` Gabriel Kerneis
2013-02-08 16:09   ` Louis Gesbert
2013-02-08 16:02 ` Daniel Bünzli
2013-02-08 16:22   ` Louis Gesbert
2013-02-08 17:50 ` Romain Bardou
2013-02-12 11:33   ` Louis Gesbert [this message]
2013-02-08 18:10 ` Ashish Agarwal
2013-02-08 18:19   ` Ashish Agarwal
2013-02-12 10:42 ` Didier Remy
2013-02-12 11:20   ` Louis Gesbert
2013-02-14 16:18     ` Daniel Bünzli
2013-02-15  0:00       ` Daniel Bünzli
2013-02-15 11:01         ` Louis Gesbert
2013-02-15 11:30           ` Daniel Bünzli
2013-02-13  3:48 ` Ivan Gotovchits
2013-02-13  9:00   ` Louis Gesbert
2013-02-15 13:57 ` [Caml-list] ocp-indent 1.0.0 release Louis Gesbert
2013-02-16 20:34   ` Niki Yoshiuchi
2013-02-17 18:05     ` Raphael Proust
2013-02-17 18:30       ` Török Edwin
2013-02-18  9:50         ` Louis Gesbert
2013-02-17 18:37       ` David Powers
2013-02-17 23:51       ` Niki Yoshiuchi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201302121233.00379.gesbert@antislash.info \
    --to=gesbert@antislash.info \
    --cc=caml-list@inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).