为什么在这种情况下'assoc'返回nil?

时间:2019-04-03 22:12:08

标签: elisp org-mode

我正在尝试为Emacs组织模式编写导出后端。此模式源自 ox-latex.el 导出程序。我希望导出器将所有* .css和* .js文件嵌入到生成的.html文件中。

Exporter运行,但是在我的函数中没有给出任何输出,因为

assoc(t (("readthedocs" ("css" "htmlize.css" "readtheorg.css") ("js" "readtheorg.js" "jquery.js" "bootstrap.js"))))

调用(来自调试器)返回nil。

我在这里想念什么?

感谢任何帮助:)完整代码可在此处https://pastebin.com/N475Uk9Z

编辑:

(defconst org-static-html-themes
  '(("readthedocs" . (("css" . ("htmlize.css"
                                "readtheorg.css"))
                      ("js" . ("readtheorg.js"
                               "jquery.js"
                               "bootstrap.js"))))))

(defun org-static-html--build-head (info)
  "Return information for the <head>..</head> of the HTML output.
INFO is a plist used as a communication channel."
  (progn
    (debug)

    (org-element-normalize-string
     (concat
      (org-element-normalize-string (plist-get info :html-head))
      (org-element-normalize-string (plist-get info :html-head-extra))
      (org-element-normalize-string
       (mapconcat (lambda (css)
                    (org-static-html-inline-css
                     (concat org-static-html-resource-path "/css/" css)))
                  (cdr (assoc "css"
                              (assoc
                               (plist-get info :static-html-theme)
                               org-static-html-themes))) "\n"))))))

该函数应该获取与相应主题关联的所有css文件,然后返回,然后将其串联并包装在样式标签中。

我应该说我正在使用Emacs 27.0.50版。

1 个答案:

答案 0 :(得分:1)

您的关联列表仅包含一个关联:"readthedocs"(("css" "htmlize.css" "readtheorg.css") ("js" "readtheorg.js" "jquery.js" "bootstrap.js"))之间。 由于t没有任何关联,因此(assoc t ...)返回nil

相关问题