<div dir="ltr">Hi,<div><br></div><div>I use metal-mercury-mode in emacs but I am slowly but surely getting a little sick and tired of it seemingly not lining things up. I copied the code from page 15 of the Ralph Becket tutoral and it just doesn't line up. Normally if emacs indenting is out then you left a bracket out somewhere but didn't see it yet.</div><div>For example, this is the code as I want it</div><div><br></div><div><font face="courier new, monospace">   9 │main(!IO) :-<br>  10 │    io.read_line_as_string(Result, !IO),<br>  11 │    (<br>  12 │        Result = eof,<br>  13 │        io.format("bye bye...\n", [], !IO)<br>  14 │    ;<br>  15 │        Result = ok(String),<br>  16 │        (<br>  17 │            if<br>  18 │                string.to_int(string.strip(String), N)<br>  19 │            then<br>  20 │                io.format("fib(%d) = %d\n", [i(N), i(fib(N))], !IO)<br>  21 │            else<br>  22 │                io.format("That isn't a number\n", [], !IO)<br>  23 │        ),<br>  24 │        main(!IO)<br>  25 │    ;<br>  26 │        Result = error(ErrorCode),<br>  27 │        io.format("%s...\n", [s(io.error_message(ErrorCode))], !IO)<br>  28 │    ).</font><br></div><div><br></div><div>but when I select the main predicate and let rip with "indent-region" it looks like this...</div><div><font face="courier new, monospace">   9 │main(!IO) :-<br>  10 │    io.read_line_as_string(Result, !IO),<br>  11 │    (<br>  12 │        Result = eof,<br>  13 │        io.format("bye bye...\n", [], !IO)<br>  14 │    ;<br>  15 │        Result = ok(String),<br>  16 │        (<br>  17 │            if<br>  18 │                string.to_int(string.strip(String), N)<br>  19 │            then<br>  20 │                io.format("fib(%d) = %d\n", [i(N), i(fib(N))], !IO)<br>  21 │            else<br>  22 │                io.format("That isn't a number\n", [], !IO)<br>  23 │            ),<br>  24 │                main(!IO)<br>  25 │            ;<br>  26 │                Result = error(ErrorCode),<br>  27 │                io.format("%s...\n", [s(io.error_message(ErrorCode))], !IO)<br>  28 │            ).<br></font></div><div><br></div><div>Lines 24-28 just won't go back....I almost give up with it all today. Nothing behaves!!! </div><div><br></div><div>I have also noticed that the comments don't always line up especially if there is a word like "if" in the comment.<br></div><div><br></div><div>What does everybody else use...it's driving me nuts TBH.</div><div><br></div><div>Sean.</div><div><br></div></div>