Emacs lisp evaluate variable in alist

倾然丶 夕夏残阳落幕 提交于 2019-12-05 01:55:57

问题


This is a follow-up question to Emacs Lisp: evaluate variable in alist.. I am trying to set default-frame-alist in my .emacs file. Consider, e.g.

(setq default-frame-alist
      '((auto-lower . nil)
        (auto-raise . nil)
        (height . 41)
        (width . 80)
        (top . 1)
        (left . 1)))

(I have omitted some values) This works fine.. Suppose now I want set the height according to another variable..Say, I stored the integer value 50 in the variable my-height.. How can I set height to the value of my-height ? I have tried

  • (height . my-height)
  • ``(height . ,my-height)`

but neither works.. What am I missing here?


回答1:


You need to backquote the whole form:

(setq default-frame-alist
      `((auto-lower . nil)
        (auto-raise . nil)
        (height . ,my-height)
        (width . 80)
        (top . 1)
        (left . 1)))


来源:https://stackoverflow.com/questions/15485833/emacs-lisp-evaluate-variable-in-alist

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