C-h i, choose the Elisp manual.
You'll get to node Backquote, where you'll find a complete explanation of how backquotes are used in Emacs Lisp.
The first paragraph provides a summary description:
"Backquote constructs" allow you to quote a list, but selectively
evaluate elements of that list. In the simplest case, it is identical
to the special form ‘quote’ (described in the previous section; *note
You see there several examples, as well. Here is one:
`(1 2 (3 ,(+ 4 5)))
⇒ (1 2 (3 9))
That's equivalent to each of these, for example:
(cons 1 (cons 2 (list 3 (+ 4 5))))
(list 1 2 (list 3 (+ 4 5)))
Another possible summary: backquoting gives you a simple way to see, pictorially, what list structure you are creating. In other words, it is essentially syntactic sugar that most users typically find easier to read than the equivalent sexps that use lots of
A typical use case is thus for constructing Lisp code, especially complex code. And the most typical of such use cases is the code defining a Lisp macro, e.g., in the body of a
All of that said, the particular case that you cite is a case of using
pcase. If you choose to use backquoting in a typical
pcase expression (which is what most people do) then the overall appearance is similar to that of a
cond or a
cl-case (Common Lisp
case) expression. If you do not use backquoting then your
pcase expression (like a
defmacro body) is likely to be more difficult to read -- the
pcase patterns are not so obvious.