kovisoft / slimv

Official mirror of Slimv versions released on vim.org
454 stars 60 forks source link

Indentation issue with macro &body #73

Closed FiV0 closed 5 years ago

FiV0 commented 5 years ago

Hey,

I have some indentation issues with macros. When the macro argument consists of a single &body the arguments are indented like a function call.

(defmacro test (a &body body)
  `(,a ,@body))

;; works fine
(test "yes"
  "yo")

(defmacro test2 (&body body)
  `(,@body))

(test2 "yes"
       "yo")

#| Would expect
(test2 "yes"
  "yo")
|#

Let me know if you can reproduce the issue or if it some setup thingy on my side.

Thanks for this software.

kovisoft commented 5 years ago

Thank you for the feedback. I was able to reproduce the issue, but I'm not quite sure that this is a real problem with the indentation. In test2 the first argument is already an &body, so normally either all arguments go in one line, or the first argument ("yes" in the above case) should already go into a separate line, don't you think so? I mean something like that:

(test2 "yes" "yo")

; or

(test2
  "yes"
    "yo")

I'll still try to search such examples on the net as in your test2 case, and I'll also check how emacs is indenting that.

kovisoft commented 5 years ago

In the meantime I checked it in Emacs with SLIME and it indents test2 exactly the same as Slimv.

FiV0 commented 5 years ago

You are right, it seems to be the right formatting. I just have seen some people (who I consider to write idiomatic CL) indent some cases differently. The $ macro here is an example.