From: Louis Gesbert <louis.gesbert@ocamlpro.com>
To: caml-list@inria.fr
Cc: "Török Edwin" <edwin+ml-ocaml@etorok.net>
Subject: Re: [Caml-list] ocp-indent 1.0.0 release
Date: Mon, 18 Feb 2013 10:50:36 +0100 [thread overview]
Message-ID: <201302181050.37011.louis.gesbert@ocamlpro.com> (raw)
In-Reply-To: <512121DB.1080405@etorok.net>
You can use the --lines option for that purpose: it will assume that all lines
not in the interval are correctly indented, and indent the lines in the
interval relative to that (to some extent, see
https://github.com/OCamlPro/ocp-indent/issues/39).
In your example, you could use '--lines 2-'
However, that supposes that the block you submit is more or less syntactically
correct. You can also submit the whole file with '--lines <current-line>' to
guarantee the syntax but indent only the current line; that is how it is done
in the emacs mode when you press TAB.
Don't hesitate to submit on https://github.com/OCamlPro/ocp-
indent/issues?state=open for further discussion if you are reluctant on
spamming the caml-list.
--
Louis, OCamlPro
Le Sunday 17 February 2013 19:30:51, Török Edwin a écrit :
> On 02/17/2013 08:05 PM, Raphael Proust wrote:
> > On Sat, Feb 16, 2013 at 8:34 PM, Niki Yoshiuchi <aplusbi@gmail.com> wrote:
> >> The second thing I've noticed is that "=" indents only relative to the
> >> selected text. In other words, if I have
> >>
> >>
> >> let my_fun f =
> >> . . let nested_fun g =
> >> . . . . (* content *)
> >> . . . . (* more content *)
> >>
> >> and I hit "=" while the cursor is on the third line I end up with:
> >>
> >> let my_fun f =
> >> . . let nested_fun g =
> >> (* content *)
> >> . . . . (* more content *)
> >>
> >> Doing something like "ggVG=" will properly indent the text.
> >
> > This is the expected behaviour. ocp-indent is only given the selected
> > text and thus can only work correctly when receiving complete blocks.
> > (Indentation is relative to the first line of the chunk that is
> > passed.)
>
> Could ocp-indent consider the indentation of the first line to be correct
> when it is working on incomplete blocks, and indent everything in relation
> to that? i.e. call ocp-indent with a new flag --incomplete, and if first
> line got 2 spaces, then have the starting indentation be 2 spaces, and
> then increase/decrease indentation relative to that. That seems how vim's
> '=' works for other languages, or without ocp-indent.
>
> Best regards,
> --Edwin
next prev parent reply other threads:[~2013-02-18 9:45 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-08 15:25 [Caml-list] ocp-indent beta release 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
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 [this message]
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=201302181050.37011.louis.gesbert@ocamlpro.com \
--to=louis.gesbert@ocamlpro.com \
--cc=caml-list@inria.fr \
--cc=edwin+ml-ocaml@etorok.net \
/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