I am trying to expand all macros inside a nested list structure. macroexpand-all almost works, but skips (does not expand) the first form in every nested list.
I am using this as a template-mechanism for org-agenda-custom-commands. I can generate agenda-blocks for multiple agenda-commands via macros. This is in init.el (emacs26.2). macroexp-all-forms is able to not skip the first form, but calls macroexpand-all for nested forms.
Here a minimal example from the emacs doc:
(defmacro inc (var)
(list 'setq var (list '1+ var)))
This works as expected (one macro-call):
ELISP> (macroexpand-all '(inc r))
(setq r
(1+ r))
This works too (nested, but first form is not a macro-call):
ELISP> (macroexpand-all '(('foo)(inc r)))
(('foo)
(setq r
(1+ r)))
This does NOT work (nested and first form is a macro-call):
ELISP> (macroexpand-all '((inc r)(inc r)))
((inc r)
(setq r
(1+ r)))
This also does not work:
ELISP> (macroexpand-all '((inc r)))
((inc r))
In the last two examples, the first call to inc is not expanded. What am I missing here? How can i really expand all macros in this situation?