0

I can run org-html-export-to-html on emacs successfully. but when I try to call it in script as below:

#!/usr/bin/emacs --script 
(require 'org)

(defun dired-org-to-html ()
  (let* ((org-root ".")
    (files
         (append
          (let ((default-directory org-root))
            (mapcar #'expand-file-name
                    (file-expand-wildcards "**/*.org")))
          (let ((default-directory org-root))
            (mapcar #'expand-file-name
                    (file-expand-wildcards "*.org")))
         )
         ))
    (mapc
     (lambda (f)
       (print f)
       (with-current-buffer
           (find-file-noselect f)
         (org-html-export-to-html)))
     files))
  )

(dired-org-to-html)

It always say Symbol's function definition is void: org-html-export-to-html.

1 Answer 1

2

It works fine for me, still, you can try to include the ox-html in the top:

#!/usr/bin/emacs --script 
(require 'org)
(require 'ox-html)


(defun dired-org-to-html ()
  (let* ((org-root ".")
    (files
         (append
          (let ((default-directory org-root))
            (mapcar #'expand-file-name
                    (file-expand-wildcards "**/*.org")))
          (let ((default-directory org-root))
            (mapcar #'expand-file-name
                    (file-expand-wildcards "*.org")))
         )
         ))
    (mapc
     (lambda (f)
       (print f)
       (with-current-buffer
           (find-file-noselect f)
         (org-html-export-to-html)))
     files))
  )

(dired-org-to-html)

It is the package where the function came from.

1
  • It's wired, it works on emacs, but when I run your version, I got below error: Cannot open load file: ox-html
    – lucky1928
    Commented Apr 29, 2020 at 0:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.