在Emacs Lisp中@字符的作用是什么?

时间:2015-11-07 18:29:51

标签: emacs elisp

例如在此宏定义中使用:

(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))))
<{3>}中的

2 个答案:

答案 0 :(得分:6)

它用于反引用表达式中的拼接。见C-h i g (elisp) Backquote RET。例如:

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)

答案 1 :(得分:3)

询问Emacs始终是一种明智的做法:

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

这会显示elisp手册中@的所有索引条目(其中一个是您实际查找的,@)。