Search code examples
elisporg-mode

Why does `assoc' return nil in this case?


I am trying to write a Export Backend for Emacs org-mode. This mode is derived from the ox-latex.el Exporter. I want the Exporter to embed all *.css and *.js files into the resulting .html file.

The Exporter runs but does'nt give any output in my functions, because this

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

call (it's from the debugger) returns nil.

What am I missing here ?

Any help appreciated :) Full Code can be found here https://pastebin.com/N475Uk9Z

EDIT:

(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"))))))

This function is supposed to get all css files associated with the corresponding theme and return then concatenated and wrapped inside style tags.

I should say that I'm using Emacs version 27.0.50.


Solution

  • Your association list contains just one association: between "readthedocs" and (("css" "htmlize.css" "readtheorg.css") ("js" "readtheorg.js" "jquery.js" "bootstrap.js")). Since nothing is associated with t, (assoc t ...) returns nil.