<br><br><div class="gmail_quote">On Sun, Sep 25, 2011 at 7:42 AM, Paulo Madeira <span dir="ltr"><<a href="mailto:acelent@gmail.com">acelent@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
2011/09/23 Alistair Gee:<br>
<div><div></div><div class="h5">> I am using the latest version of slime from cvs. I noticed that macros such<br>
> as iter (from the iterate package) indents differently now than sometime in<br>
> the past.<br>
><br>
> Current indentation:<br>
><br>
> (iter (for i below 3)<br>
>   (collect i))<br>
><br>
> Old indentation:<br>
><br>
> (iter (for i below 3)<br>
>       (collect i))    ; "collect" is lined up with "for"<br>
><br>
> An example with a macro from the clsql package:<br>
><br>
> Current indentation:<br>
><br>
> (clsql:with-default-database (db)<br>
>                              (progn))<br>
><br>
> Old indentation:<br>
><br>
> (clsql:with-default-database (db)<br>
>   (progn)) ; &body is indented 2 spaces<br>
><br>
> How do I configure slime to indent with the older styles?<br>
> My .emacs has:<br>
> (slime-setup '(slime-fancy<br>
>                slime-asdf<br>
>                slime-sprof<br>
>                slime-compiler-notes-tree<br>
>                slime-hyperdoc<br>
>                slime-mdot-fu<br>
>                slime-mrepl<br>
>                slime-indentation<br>
>                slime-repl))<br>
<br>
</div></div>The old behaviour depended solely on the Emacs side of things.<br>
<br>
The `iter' form didn't actually indent the `collect' form with the<br>
`for' form on purpose, it indented just like it would any other<br>
function call.<br>
<br>
The `with-default-database' form has a first element whose name starts<br>
with "with-", a very common prefix for macros with a body, so it was<br>
assumed and indented as such.<br>
<br>
When connected to lisp, the new indentation mechanism can detects<br>
`&body' arguments.<br>
<br>
If you add a newline right before the `for' form, you'll see it's<br>
indented at 2, because `iter' has a single `&body' arguments.<br>
<br>
The `with-default-database' has a `&rest' argument, so it's not<br>
indented like a body.<br>
<br>
The best solution would be to update clsql to declare the macro<br>
argument as `&body'. One workaround is to add something like this to<br>
your Emacs init.el (note: I didn't actually test this):<br>
<br>
(put 'with-default-database<br>
     'common-lisp-indent-function<br>
     1)<br>
<font color="#888888"><br>
Paulo Madeira<br>
</font></blockquote></div><div><br></div>Thanks for the help. Your workaround for with-default-database works. I am also now using the following workaround for iter:<div><br></div><div>(put 'iter 'common-lisp-indent-function '(&lambda))</div>
<div><br></div><div><br></div>