caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Christophe TROESTLER <Christophe.Troestler@umh.ac.be>
To: "O'Caml Mailing List" <caml-list@inria.fr>
Subject: Re: tuareg-mode v.s. caml-mode (was: Wishes for an easy install of Ocaml)
Date: Sun, 02 Jan 2005 16:44:42 +0100 (CET)	[thread overview]
Message-ID: <20050102.164442.74087888.Christophe.Troestler@umh.ac.be> (raw)
In-Reply-To: <20050102.102149.112764189.garrigue@math.nagoya-u.ac.jp>

On Sun, 02 Jan 2005, Jacques Garrigue <garrigue@math.nagoya-u.ac.jp> wrote:
> 
> Having never tried Tuareg (mostly out of inertia, since I'm
> satisfied with the core mode), could you be more precise about what
> is better in Tuareg.

For me essentially
- font-lock
- more customizable

Caml-mode font-lock is not bad but it has some shortcomings and is
difficult to tailor to one likes [1] -- as far as I know (please,
correct me if I am wrong), one cannot change the font-lock colors on a
per-mode basis.  Granted, this is a convenience issue but when you get
used to comfort...

On the other hand, the caml-mode has also strong points: it has the
ability to display the "definitions" in the speedbar -- at least if
you add

(speedbar-add-supported-extension '(".ml" ".mli" ".mll" ".mly"))

in ~/.emacs -- and tuareg currently does not. :(

> Ditching the core mode would indeed save time for some people.

Note that tuareg uses some files of the caml-mode.  What about some
collaboration to merge the better of the two modes into a unique one??

> (But note that in order to replace the core mode, you have to be
> able to indent in exactly the same way.)

I do not know all params of the core mode but here is my config and it
is pretty close:

          (setq tuareg-in-indent 0)
          (setq tuareg-let-always-indent t)
          (setq tuareg-let-indent 2)
          (setq tuareg-with-indent 0)
          (setq tuareg-function-indent 0)
          (setq tuareg-fun-indent 0)
          (setq tuareg-parser-indent 0)
          (setq tuareg-match-indent 0)
          (setq tuareg-begin-indent 2)
          (setq tuareg-parse-indent 2); .mll
          (setq tuareg-rule-indent 2)

Here is an example where it is not exactly the same but tuareg mode
behavior seems more reasonable to me:

caml-mode:

    Hashtbl.iter (fun id buf ->
      output_string fcgi_stdout fd id (Buffer.contents buf);
      Buffer.clear buf
		 ) outputs_stdout;

tuareg-mode:

    Hashtbl.iter (fun id buf ->
		    output_string fcgi_stdout fd id (Buffer.contents buf);
		    Buffer.clear buf
		 ) outputs_stdout;

Happy new year,
ChriS

---
[1] Some examples to give you an idea:

- [data: string] and [data : string] get highlighted differently
  (yes, there is only a non-significant space difference);

- "|" and "->" are set to font-lock-constant-face (too bright for me)
  but I cannot change their colors without affecting other symbols and
  other modes.  Moreover in "[|" both or none should be highlighted.

- Constructors get the font-lock-function-name-face (which I would do
  without personally) but the real functions [let f x =...] do not.
  Tuareg is much better at highlighting functions and variables.

- The main thing that bother me basically is that the faces are not
  set in a way that reflects their semantic : for example

  * [open] is colored with font-lock-variable-name-face (sic),
  * [raise] is with font-lock-comment-face,
  * [for] and [if] are keywords and should be treated as such!
  * font-lock-doccomment-face should be replaced with font-lock-doc-face

  and so caml-mode colors do not have the same meaning as in other
  buffers...

- Here is a doc comment not which is not highlighted:

  (** [decode_range s low up] decodes the substring [s.[low .. up-1]]
      i.e., in the returned string the '%XX' and '+' are converted
      into their chars.  The range [s.[low .. up-1]] is overwritten.
      It returns the decoded string.

      [decode_range_strip] does the same, except that the decoded
      strings are stripped of heading and trailing spaces.

      It is ASSUMED that the range is valid i.e., [0 <= low] and [up <=
      String.length s].  Invalid '%XX' are left unchanged. *)

- Here is a normal comment which is not highlighted:

(* File: cgi_common.ml

   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public
   License as published by the Free Software Foundation; either
   version 2 of the License, or (at your option) any later version.

   This library is distributed in the hope that it will be useful, but
   WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   General Public License for more details; it is available at
   <http://www.fsf.org/copyleft/gpl.html>, or by writing to the Free
   Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
   02111-1307, USA.
*)


  parent reply	other threads:[~2005-01-02 15:44 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-24  8:58 Wishes for an easy install of Ocaml Philippe Lelédy
2004-12-24 11:04 ` [Caml-list] " Stefano Zacchiroli
2004-12-24 11:36   ` skaller
2004-12-27 15:18   ` Ralf Treinen
2004-12-27 16:54     ` Sven Luther
2004-12-31 16:20       ` Richard Jones
2004-12-31 22:31         ` Sven Luther
2005-01-15 12:29           ` Lionel Elie Mamane
2005-01-02  1:21         ` Jacques Garrigue
2005-01-02 10:50           ` Richard Jones
2005-01-02 11:13             ` Janne Hellsten
2005-01-02 12:16             ` Jacques GARRIGUE
2005-01-02 15:44           ` Christophe TROESTLER [this message]
2004-12-24 11:22 ` Christophe TROESTLER
2004-12-24 17:24 ` Sylvain LE GALL
2004-12-24 18:21 ` Matthew O'Connor
2004-12-27 16:35 ` Didier Remy

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=20050102.164442.74087888.Christophe.Troestler@umh.ac.be \
    --to=christophe.troestler@umh.ac.be \
    --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).