我在lisp中构建了这样的函数:
(defun set-web-hosting (hosting)
""" this function sets the hosting of web to specific tramp like target """
(setq org-publish-project-alist
'(
("belohrad.ch-notes"
:base-directory "~/SVN/fiweb/"
:base-extension "org"
:publishing-directory hosting
:recursive t
:publishing-function org-publish-org-to-html
:headline-levels 999
:table-of-contents nil
:section-numbers nil
:auto-preamble t
:auto-sitemap t
:auto-postamble nil
:style ""
:sitemap-filename "sitemap.org"
:sitemap-title "Sitemap"
:sub-superscript nil
:author "David Belohrad"
:email "david@belohrad.ch"
)
("belohrad.ch-static"
:base-directory "~/SVN/fiweb"
:base-extension "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg\\|swf\\|deb"
:publishing-directory hosting
:recursive t
:publishing-function org-publish-attachment
)
("web" :components ("belohrad.ch-static" "belohrad.ch-notes"))
)))
思考,我可以使用
(set-web-hosting "~/afs/www/org/")
将目标设置为上述测试目录,并
(set-web-hosting ".ssh:nlanla@nlsnls.org:/public_html/")
将其设置为生命网络。
这不起作用,因为'hosting'在函数中不被视为变量,而是'其他'。 调用发布时,它以
结束org-publish-file: Wrong type argument: arrayp, hosting
如何正确设置:publishing-directory
属性?
答案 0 :(得分:4)
使用lisp代码,反引号和逗号进行操作有一个特殊的习惯用法:
`(a ,b c)
见
(describe-function '\`)
您的设置是:
(defun set-web-hosting (hosting)
" this function sets the hosting of web to specific tramp like target "
(eval `(setq org-publish-project-alist
'(
("belohrad.ch-notes"
:base-directory "~/SVN/fiweb/"
:base-extension "org"
:publishing-directory ,hosting
:recursive t
:publishing-function org-publish-org-to-html
:headline-levels 999
:table-of-contents nil
:section-numbers nil
:auto-preamble t
:auto-sitemap t
:auto-postamble nil
:style ""
:sitemap-filename "sitemap.org"
:sitemap-title "Sitemap"
:sub-superscript nil
:author "David Belohrad"
:email "david@belohrad.ch"
)
("belohrad.ch-static"
:base-directory "~/SVN/fiweb"
:base-extension "css\\|js\\|png\\|jpg\\|gif\\|pdf\\|mp3\\|ogg\\|swf\\|deb"
:publishing-directory ,hosting
:recursive t
:publishing-function org-publish-attachment
)
("web" :components ("belohrad.ch-static" "belohrad.ch-notes"))
))))