I've been writing some convenience macros, and at times I want to pass a symbol to the macro, and other times the value of that symbol. Think of `mode-line-format`'s `:eval` keyword, etc.
I've come up with this macro-helper function, but I feel like it's probably .... cursed. Let me know what you think!
(defun +marg (arg)
"Return ARG, unless comma-quoted. Then return ARG's value.
This function really only makes sense in macros, e.g.
(defmacro foo (bar)
(let ((bar (+marg bar)))
(do-something-with bar)))
This will allow a call like (foo thing) to work with the symbol
`thing', but (foo ,thing) to work with the value of `thing'.
This functionality is probably cursed and probably shouldn't be
used."
(if (eq (car-safe arg) '\,)
`,(cadr arg)
`',arg))
The docstring should be fairly descriptive, imo, but I can further explain if need be.