I have a hard time writing and reading cl-loops with they way they're indented by default as I can't easily tell what the control flow is:
(cl-loop for x below 10
if (cl-oddp x)
collect x into odds
and if (memq x funny-numbers) return (cdr it) end
else
collect x into evens
finally return (vector odds evens))
I'd like it to be indented like how it's shown in its documentation:
(cl-loop for x below 10
if (cl-oddp x)
collect x into odds
and if (memq x funny-numbers) return (cdr it) end
else
collect x into evens
finally return (vector odds evens))
I know this has to do with Indenting Macros
manual page. And possibly this question on indenting a common lisp loop in emacs. Additionally, I've looked at a post on irreal and this question on the indentation of lisp forms.
The general idea I got from reading is to use (declare (indent n))
where n is an integer. I see this works for simple examples. However, how I want the cl-loop
to be indented seems too complex for this. I need to tell emacs to recognize the specific if
else
keywords in the cl-loop.
I am confused as I don't see a clear way to properly indent cl-loop
. Any ideas?
(debug ...)
is for Edebug.