Elisp: What does backquote ` do?
Published on Jan 5, 2022, by Junji Zhi
Backquote allows you to:
- quote a list, and
- selectively evaluate elements of the list (with comma
,
), or: splice
(eval & spread) the element with,@
Examples
Eval:
`(a list of ,(+ 2 3) elements)
;; ⇒ (a list of 5 elements)
Spread:
(setq some-list '(2 3))
;; ⇒ (2 3)
`(1 ,@some-list 4 ,@some-list)
;; ⇒ (1 2 3 4 2 3)