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

As used, for example, 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))))

to this file .

+4
source share
2 answers

It is used for splicing in countdown 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)
+6
source

Asking Emacs is always a smart approach:

  • C-h i g (elisp) RET
  • i @ RET

This shows all the manual index entries elispfor @(one of which is the ,@one you were really looking for).

+3
source

Source: https://habr.com/ru/post/1614881/


All Articles