GNU bug report logs -
#61281
“`(a \, b)” equals to “`(a . ,b)”
Previous Next
Full log
Message #92 received at 61281 <at> debbugs.gnu.org (full text, mbox):
Ihor Radchenko <yantar92 <at> posteo.net> writes:
> I recall one user had a need to macro-expand something that indented to
> be passed to another macro-expand. We did not find a way to retain ","
> in the macro-expanded sexp.
I guess you are describing the common difficulties related to multiple
levels of backquotes (nested backquotes). These are tricky (for human
brains) and you need to know little "tricks" to get what you want (took
me a while to discover how to deal with nested backquotes, maybe we
should have examples in the manual?).
Anyway, you (only) need to use trivial quoting, it is not necessary and
probably not good style to use the symbol "," instead of the reader
construct in human written code.
Compare:
#+begin_src emacs-lisp
;; Substitution at the same place at multiple levels:
(let ((f 'my-function))
``(when (funcall ,,f) (do-something)))
==>
`(when (funcall ,my-function)
(do-something))
;; Substitution once, by outside level backquote:
(let ((f 'my-function))
``(when (funcall ,',f) (do-something)))
==>
`(when (funcall ,'my-function)
(do-something))
;; Substitution once, by the inside backquote
``(when (funcall ,,'f) (do-something))
==>
`(when (funcall ,f)
(do-something))
or simpler:
``(when (funcall ,f) (do-something))
==>
`(when (funcall ,f)
(do-something))
#+end_src
You probably tried to get some of these cases work, and it's not trivial
to get to a solution the first time one encounters this problem.
But this has not directly a relation to what we discuss here. If you
rewrite ,X as (\, X) you have additional ways to express the above
things, looking like (,'\, X) etc (though these are less readable).
But, unless I guessed wrong what you were originally trying to achieve,
you just have to solve the nested-backquotes problems like in other
Lisps, Elisp is not preventing you to use any of these syntaxes. It's
just that trying the (\, X) rewrite doesn't bring you closer to the
solution of the original problem.
Michael.
This bug report was last modified 2 years and 127 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.