how to specify a property value of a variable in emacs lisp

和自甴很熟 提交于 2019-12-06 02:26:25

One way to do it will be using ` (backquote) and , (comma). From GNU Emacs Lisp Reference Manual,

Backquote constructs allow you to quote a list, but selectively evaluate elements of that list. In the simplest case, it is identical to the special form quote. (...) The special marker ',' inside of the argument to backquote indicates a value that isn't constant. The Emacs Lisp evaluator evaluates the argument of ',', and puts the value in the list structure.

So you can write your program as follows:

(require 'org-publish)
(setq org-publish-project-alist
      `(                              ; XXX: backquote
        ("org-notes"
         :base-directory ,org-dir     ; XXX: comma
         :base-extension "org"
         :publishing-directory "~/tmp/"
         :recursive t
         :publishing-function org-publish-org-to-html
         :headline-levels 4
         :auto-preamble t

         :auto-sitemap t          
         :sitemap-filename "sitemap.org" 
         :sitemap-title "Sitemap"
         )
        ("org-static"
         :base-directory ,org-dir     ; XXX: comma
         :base-extension "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg\\|swf"
         :publishing-directory "~/tmp/"
         :recursive t
         :publishing-function org-publish-attachment
         )
        ("org" :components ("org-notes" "org-static"))
        ))
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!