Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the role of the @ character in Emacs Lisp?

Tags:

emacs

elisp

As used for instance in this macro definition:

(defmacro with-eval-after-load-feature (feature &rest body)
  (declare (indent 1) (debug t))
  (let* ((feature (if (and (listp feature) (eq (car-safe feature) 'quote))
                      (cdr feature) feature))
         (fs (if (listp feature) feature (list feature)))
         (form (or (and (eval '(eval-when (compile)
                                 (with-eval-after-load-feature-preload fs)))
                        'with-no-warnings)
                   'progn)))
    `(,form ,@(with-eval-after-load-feature-transform fs body))))

in this file.

like image 997
Andrzej Pronobis Avatar asked Jan 07 '23 05:01

Andrzej Pronobis


1 Answers

It's used for splicing in backquoted expressions. See C-h i g (elisp) Backquote RET. For example:

elisp> `(1 2 ,(list 3 4))  ; no splicing => nested list
(1 2
   (3 4))

elisp> `(1 2 ,@(list 3 4)) ; splicing => flat list
(1 2 3 4)
like image 164
danlei Avatar answered Jan 15 '23 12:01

danlei