2015-11-07 43 views
4

在本宏定義中使用,例如:@字符在Emacs Lisp中的作用是什麼?

(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)))) 

this file

回答

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) 
+2

它也可以幫助說'',@'和',.'基本相同(你也可以使用它)。 – Drew

+2

@Drew,你的意思是',.'還是'。 ,如'(1 2。,(list 3 4))''?第一個在Emacs Lisp中不起作用(雖然在CL中有效),但第二個只在拼接結束時才起作用。 – danlei

+2

對你說的兩件事都一樣。我的意思是**'。 ,'**,當然只有一件事可以遵循'.'。感謝您的更正。 – Drew

3

詢問Emacs是總是明智的做法:

  • C-H我克(elisp)RET
  • @RET

這說明你@所有elisp手冊的索引項(其中一個是你真正要找的,@)。