繁体   English   中英

Emacs Org-mode - 动态导出到另一个目录?

[英]Emacs Org-mode - Export dynamically to another directory?

我在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属性?

使用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"))
         ))))

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM