caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Matej Košík" <mail@matej-kosik.net>
To: caml users <caml-list@inria.fr>
Subject: [Caml-list] What is the right way to configure Tuareg to get the same indentation as in Batteries Included?
Date: Mon, 30 Oct 2017 11:08:16 +0100	[thread overview]
Message-ID: <6c2af6b6-2f9f-7f12-2bbf-22b1286d29d5@matej-kosik.net> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 1512 bytes --]

Hi,

Tuareg and indentation does not work for me very well.

I am trying to figure out how should I configure it so that I get the same indentation behavior as is used in Batteries Included.

One (of several) problem is with the or-patterns in match-expressions.

Here is the original sample:
(behavior I like)

  (* https://github.com/ocaml-batteries-team/batteries-included/blob/e069e28678a0d15d338721e1ff5e480fe0ad26c5/src/batComplex.ml#L82-L83 *)

  match BatEnum.peek enum with
  | None -> {re; im = multiplier}
  | Some (Kwd ".")
  | Some (Kwd "*") ->
    BatEnum.junk enum;
    parse_im ~multiplier re
  | Some _token ->
    parse_im ~multiplier re

However, Tuareg, in my currenct configuration does instead this:

  match BatEnum.peek enum with
  | None -> {re; im = multiplier}
  | Some (Kwd ".")
    | Some (Kwd "*") ->
     BatEnum.junk enum;
     parse_im ~multiplier re
  | Some _token ->
     parse_im ~multiplier re

I am using:
- Ocaml 4.06.0+beta2
- Tuareg 2.0.10 (installed via OPAM)
and my ~/.emacs file contains just this:

  (load "~/.opam/4.06.0+beta2/share/emacs/site-lisp/tuareg-site-file")
  (setq tuareg-indent-align-with-first-arg t)
  (setq tuareg-match-patterns-aligned t)

which is, I guess, wrong/insufficient.

I'd be grateful for any hints concerning how to fix/complete the configuration in order to get indentation behavior consistent with Ocaml Batteries.
Is that possible (with Tuareg or whatever other tool)?

---

Matej


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

             reply	other threads:[~2017-10-30 10:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-30 10:08 Matej Košík [this message]
2017-11-21 19:59 ` Stefan Monnier
2017-11-23  9:53   ` Matej Košík
2017-11-24  2:20     ` Stefan Monnier

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=6c2af6b6-2f9f-7f12-2bbf-22b1286d29d5@matej-kosik.net \
    --to=mail@matej-kosik.net \
    --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).