The info page doesn't mention this declaration. I found uses where it is set to either 1, 2 or 3, but what other options are possible? What exactly does it do?
On the surface of it, it looks like the digit means the number of lines after the macro name to indent further right, but in that case, how do I tell it to indent all forms as the first one?
Examples:
(declare (indent 1)) does this:
(-iter
(with (a b c))
(for i from 0 to 5)
(collect i)
(message "i: %s" i))
(declare (indent 2)) does this:
(-iter
(with (a b c))
(for i from 0 to 5)
(collect i)
(message "i: %s" i))
(declare (indent 256)) (or just any large enough number) does this:
(-iter
(with (a b c))
(for i from 0 to 5)
(collect i)
(message "i: %s" i))
I would like to do the last one, except for providing an arbitrary large number. Is there any way to tell "all" or some thing to that effect?
It's in the manual:
C-hig (elisp) Indenting Macros RET
Linked to from the index entry for declare, FYI. (Emacs 24.2.1)
Since the accepted answer doesn't actually answer the question, and the manual is fairly obtuse, let me point to this blog which reveals that a value of 0 actually works here, and is synonymous to defun.
However, the indentation level does not go as far as with a number. Examine:
With (indent nil) or without an (indent ...) declaration:
(-iter
(with (a b c))
(for i from 0 to 5)
(collect i)
(message "i: %s" i))
With (indent defun) or (indent 0):
(-iter
(with (a b c))
(for i from 0 to 5)
(collect i)
(message "i: %s" i))
With (indent 256):
(-iter
(with (a b c))
(for i from 0 to 5)
(collect i)
(message "i: %s" i))
With (indent (lambda (x y) 4)) you get the same result as for (indent 256). Hardcoding an indent probably conflicts slightly with the mechanisms for specifying different indentation styles with lisp-indent-function, though.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With