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

老子叫甜甜 提交于 2019-12-04 03:56:22

问题


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.


回答1:


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)



回答2:


Asking Emacs is always a sensible approach:

  • C-hig (elisp) RET
  • I @ RET

This shows you all the elisp manual's index entries for @ (one of which is the ,@ you were actually looking for).



来源:https://stackoverflow.com/questions/33586276/what-is-the-role-of-the-character-in-emacs-lisp

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!