caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] indenting a .ml file with emacs in batch mode using ocaml-mode style
@ 2015-02-24 17:57 Francois Berenger
  2015-02-24 20:26 ` Thomas Gazagnaire
  2015-02-25  8:43 ` Ronan Le Hy
  0 siblings, 2 replies; 3+ messages in thread
From: Francois Berenger @ 2015-02-24 17:57 UTC (permalink / raw)
  To: OCaml Mailing List

Hello,

Is there anyone who knows how to tell emacs how to indent a given .ml 
file using the indentation style from ocaml-mode?

It should ressemble something like this:

emacs -batch source.ml \
   --eval '(indent-region (point-min) (point-max) nil)' \
   -f save-buffer

I just don't know how to tell emacs to use the ocaml-mode for that
instead of whatever the user has configured in his ~/.emacs (for 
example, instead of tuareg-mode).

Thanks a lot,
Francois.

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

* Re: [Caml-list] indenting a .ml file with emacs in batch mode using ocaml-mode style
  2015-02-24 17:57 [Caml-list] indenting a .ml file with emacs in batch mode using ocaml-mode style Francois Berenger
@ 2015-02-24 20:26 ` Thomas Gazagnaire
  2015-02-25  8:43 ` Ronan Le Hy
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Gazagnaire @ 2015-02-24 20:26 UTC (permalink / raw)
  To: Francois Berenger; +Cc: OCaml Mailing List

`ocp-indent -i <file>` ?

Thomas
> On 24 Feb 2015, at 17:57, Francois Berenger <francois.berenger@inria.fr> wrote:
> 
> Hello,
> 
> Is there anyone who knows how to tell emacs how to indent a given .ml file using the indentation style from ocaml-mode?
> 
> It should ressemble something like this:
> 
> emacs -batch source.ml \
>  --eval '(indent-region (point-min) (point-max) nil)' \
>  -f save-buffer
> 
> I just don't know how to tell emacs to use the ocaml-mode for that
> instead of whatever the user has configured in his ~/.emacs (for example, instead of tuareg-mode).
> 
> Thanks a lot,
> Francois.
> 
> -- 
> Caml-list mailing list.  Subscription management and archives:
> https://sympa.inria.fr/sympa/arc/caml-list
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs


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

* Re: [Caml-list] indenting a .ml file with emacs in batch mode using ocaml-mode style
  2015-02-24 17:57 [Caml-list] indenting a .ml file with emacs in batch mode using ocaml-mode style Francois Berenger
  2015-02-24 20:26 ` Thomas Gazagnaire
@ 2015-02-25  8:43 ` Ronan Le Hy
  1 sibling, 0 replies; 3+ messages in thread
From: Ronan Le Hy @ 2015-02-25  8:43 UTC (permalink / raw)
  To: OCaml Mailing List

Hi François,

2015-02-24 18:57 GMT+01:00 Francois Berenger <francois.berenger@inria.fr>:
> Is there anyone who knows how to tell emacs how to indent a given .ml file
> using the indentation style from ocaml-mode?
> emacs -batch source.ml \
>   --eval '(indent-region (point-min) (point-max) nil)' \
>   -f save-buffer

You can set the major mode using (caml-mode):
 emacs --batch source.ml --eval '(progn (caml-mode) (message "mode:
%s" major-mode) (indent-region (point-min) (point-max) nil)
(save-buffer))'

-- 
Ronan

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

end of thread, other threads:[~2015-02-25  8:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-24 17:57 [Caml-list] indenting a .ml file with emacs in batch mode using ocaml-mode style Francois Berenger
2015-02-24 20:26 ` Thomas Gazagnaire
2015-02-25  8:43 ` Ronan Le Hy

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).