caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Adding another "let ... in"-like construct for fontification/indentation
@ 2007-06-30 16:57 Denis Bueno
  2007-07-01 11:22 ` Philippe Wang
  0 siblings, 1 reply; 2+ messages in thread
From: Denis Bueno @ 2007-06-30 16:57 UTC (permalink / raw)
  To: OCaml Mailing List

All,

In tuareg-mode, is there a simple way to add support for indentation
for a new syntactic construct that behaves exactly like "let ... in
..."?  I'd like "def ... in ..." to behave the same way.  I'm thinking
of some code I can stuff in my .emacs, hopefuly, as opposed to a
modification of tuareg.el.

I'd like to be able to write:

    let foo a b = a + b in
    def hi(x) = print_int x; 0 in
    let bar x = x in
      <some body where foo and hi are in scope>

i.e. I'd like to interleave let .. in ... and def ... in ..., and have
them cooperate.

I looked around tuareg.el and found a bunch of places where "let" is
mentioned in a regexp, and even found `tuareg-make-find-kwop-regexp',
whose doc string says "Make a custom indentation regexp".  That doc
string seems like it's what I want, but that function has no side
effects, so clearly it's not the whole story.

What I'm eventually shooting for is a tuareg mode that "knows" about
Jocaml syntax, since I'm fiddling around with that for the moment.
There are more new pieces of syntax on Jocaml (new keywords "spawn"
and "reply to") which seem pretty simple to support, but I haven't
thought about them very much.

Thanks in advance.

-- 
                              Denis


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

* Re: Adding another "let ... in"-like construct for fontification/indentation
  2007-06-30 16:57 Adding another "let ... in"-like construct for fontification/indentation Denis Bueno
@ 2007-07-01 11:22 ` Philippe Wang
  0 siblings, 0 replies; 2+ messages in thread
From: Philippe Wang @ 2007-07-01 11:22 UTC (permalink / raw)
  To: Denis Bueno, ocaml ml, jocaml-list

Denis Bueno wrote:
> All,
>
> In tuareg-mode, is there a simple way to add support for indentation
> for a new syntactic construct that behaves exactly like "let ... in
> ..."?  I'd like "def ... in ..." to behave the same way.  I'm thinking
> of some code I can stuff in my .emacs, hopefuly, as opposed to a
> modification of tuareg.el.
>
> I'd like to be able to write:
>
>    let foo a b = a + b in
>    def hi(x) = print_int x; 0 in
>    let bar x = x in
>      <some body where foo and hi are in scope>
>
> i.e. I'd like to interleave let .. in ... and def ... in ..., and have
> them cooperate.
>
> I looked around tuareg.el and found a bunch of places where "let" is
> mentioned in a regexp, and even found `tuareg-make-find-kwop-regexp',
> whose doc string says "Make a custom indentation regexp".  That doc
> string seems like it's what I want, but that function has no side
> effects, so clearly it's not the whole story.
>
> What I'm eventually shooting for is a tuareg mode that "knows" about
> Jocaml syntax, since I'm fiddling around with that for the moment.
> There are more new pieces of syntax on Jocaml (new keywords "spawn"
> and "reply to") which seem pretty simple to support, but I haven't
> thought about them very much.
>
> Thanks in advance.
>

Hi,

I sent the following text last week but, I don't know why, it got lost...


Well, I played a little bit with tuareg, to try to adapt it to JoCaml.
The keywords are well colored (well, I think they are), but the 
indentation is not finished (well, let's say it : it's wrong).

You can get what I have done if ever you are interested :
http://philippewang.info/cs/misc/juareg-mode-1.46.2.tar.gz

(there is in particular a bug : a function call finds nil... why why why 
is dynamic typing so mean with me...)

Well, I've spent only a few minutes on it, plus a few hours trying to 
catch bugs, most of which I haven't caught.

I have no idea if someone else is working on it, I just wanted to "play" 
with elisp...
But I don't have time to continue right now, that's the reason why I 
give you the sources.


Cheers,

Philippe Wang
 mail[at]philippewang.info

PS :
if ever you want to compare tuareg sources with juareg sources, I 
suggest you apply :
for i in * ; sed -i -e 's/juareg/tuareg/g' -e 's/jocaml/ocaml/g' $i ; done
on the sources first.
The advantage in naming it juareg instead of tuareg is that it can be 
used without interfering with tuareg.


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

end of thread, other threads:[~2007-07-01 11:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-06-30 16:57 Adding another "let ... in"-like construct for fontification/indentation Denis Bueno
2007-07-01 11:22 ` Philippe Wang

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