也许这很愚蠢,但我对Elisp的了解不足,无法理解引用和求值方面发生的情况。
假设我有以下Elisp代码:
(add-to-list 'default-frame-alist '(width . 100))
(add-to-list 'default-frame-alist '(height . 50))
这将产生期望的 default-frame-alist 值:
((height 50)
(width 100))
但是现在,如果我有这样的代码:
(setq my-frame-width 100)
(setq my-frame-height 50)
(add-to-list 'default-frame-alist '(width . my-frame-width))
(add-to-list 'default-frame-alist '(height . my-frame-height))
这将导致 -
((height my-frame-height)
(width my-frame-width))
从框架几何角度来看,它从不评估那些变量。我如何使my-frame-width和height的实际值出现在这个alist中?我是否有太多引号?但我不能从add-to-list评估中删除任何引号...