bastibe / org-static-blog

A static site generator using org-mode
BSD 3-Clause "New" or "Revised" License
341 stars 74 forks source link

Unknown "nil" back-end: Aborting export #107

Closed lucasemmoreira closed 2 years ago

lucasemmoreira commented 2 years ago

Hi there! very nice project!

I have used your lib some time ago and I tried to use on a recently install but I got this message

org-export-barf-if-invalid-backend: Unknown "nil" back-end: Aborting export

I tried to toy a little bit with the code but it seems to be a missing piece on my end. Any ideas what it could be?

emacs version: 27.2 org version: 9.4.6

Thx!

bastibe commented 2 years ago

Hi!

Could you run the function wrapped in (debug (your-code-here ...)), and post the full stack trace?

lucasemmoreira commented 2 years ago

not sure if this is what you meant (I do not have much xp in elisp... still climbing the learning curve =p)

I tried to run (org-static-blog-publish) in the scratch buffer. This is what I got:

Debugger entered--Lisp error: (error "Unknown \"nil\" back-end: Aborting export")
  signal(error ("Unknown \"nil\" back-end: Aborting export"))
  error("Unknown \"%s\" back-end: Aborting export" nil)
  org-export-barf-if-invalid-backend(nil)
  org-export-as(org-static-blog-post-bare nil nil nil nil)
  (setq result (org-export-as 'org-static-blog-post-bare nil nil nil nil))
  (progn (if buffer-exists (insert-buffer-substring buffer-exists) (insert-file-contents post-filename)) (org-mode) (goto-char (point-min)) (org-map-entries (lambda nil (setq org-map-continue-from (point)) (org-cut-subtree)) org-static-blog-no-post-tag) (setq result (org-export-as 'org-static-blog-post-bare nil nil nil nil)) (switch-to-buffer current-buffer) result)
  (unwind-protect (progn (if buffer-exists (insert-buffer-substring buffer-exists) (insert-file-contents post-filename)) (org-mode) (goto-char (point-min)) (org-map-entries (lambda nil (setq org-map-continue-from (point)) (org-cut-subtree)) org-static-blog-no-post-tag) (setq result (org-export-as 'org-static-blog-post-bare nil nil nil nil)) (switch-to-buffer current-buffer) result) (and (buffer-name temp-buffer) (kill-buffer temp-buffer)))
  (save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (if buffer-exists (insert-buffer-substring buffer-exists) (insert-file-contents post-filename)) (org-mode) (goto-char (point-min)) (org-map-entries (lambda nil (setq org-map-continue-from (point)) (org-cut-subtree)) org-static-blog-no-post-tag) (setq result (org-export-as 'org-static-blog-post-bare nil nil nil nil)) (switch-to-buffer current-buffer) result) (and (buffer-name temp-buffer) (kill-buffer temp-buffer))))
  (with-current-buffer temp-buffer (unwind-protect (progn (if buffer-exists (insert-buffer-substring buffer-exists) (insert-file-contents post-filename)) (org-mode) (goto-char (point-min)) (org-map-entries (lambda nil (setq org-map-continue-from (point)) (org-cut-subtree)) org-static-blog-no-post-tag) (setq result (org-export-as 'org-static-blog-post-bare nil nil nil nil)) (switch-to-buffer current-buffer) result) (and (buffer-name temp-buffer) (kill-buffer temp-buffer))))
  (let ((temp-buffer (generate-new-buffer " *temp*"))) (with-current-buffer temp-buffer (unwind-protect (progn (if buffer-exists (insert-buffer-substring buffer-exists) (insert-file-contents post-filename)) (org-mode) (goto-char (point-min)) (org-map-entries (lambda nil (setq org-map-continue-from (point)) (org-cut-subtree)) org-static-blog-no-post-tag) (setq result (org-export-as 'org-static-blog-post-bare nil nil nil nil)) (switch-to-buffer current-buffer) result) (and (buffer-name temp-buffer) (kill-buffer temp-buffer)))))
  (with-temp-buffer (if buffer-exists (insert-buffer-substring buffer-exists) (insert-file-contents post-filename)) (org-mode) (goto-char (point-min)) (org-map-entries (lambda nil (setq org-map-continue-from (point)) (org-cut-subtree)) org-static-blog-no-post-tag) (setq result (org-export-as 'org-static-blog-post-bare nil nil nil nil)) (switch-to-buffer current-buffer) result)
  (let ((current-buffer (current-buffer)) (buffer-exists (org-static-blog-file-buffer post-filename)) (result nil)) (with-temp-buffer (if buffer-exists (insert-buffer-substring buffer-exists) (insert-file-contents post-filename)) (org-mode) (goto-char (point-min)) (org-map-entries (lambda nil (setq org-map-continue-from (point)) (org-cut-subtree)) org-static-blog-no-post-tag) (setq result (org-export-as 'org-static-blog-post-bare nil nil nil nil)) (switch-to-buffer current-buffer) result))
  (save-excursion (let ((current-buffer (current-buffer)) (buffer-exists (org-static-blog-file-buffer post-filename)) (result nil)) (with-temp-buffer (if buffer-exists (insert-buffer-substring buffer-exists) (insert-file-contents post-filename)) (org-mode) (goto-char (point-min)) (org-map-entries (lambda nil (setq org-map-continue-from (point)) (org-cut-subtree)) org-static-blog-no-post-tag) (setq result (org-export-as 'org-static-blog-post-bare nil nil nil nil)) (switch-to-buffer current-buffer) result)))
  (let ((org-html-doctype "html5") (org-html-html5-fancy t)) (save-excursion (let ((current-buffer (current-buffer)) (buffer-exists (org-static-blog-file-buffer post-filename)) (result nil)) (with-temp-buffer (if buffer-exists (insert-buffer-substring buffer-exists) (insert-file-contents post-filename)) (org-mode) (goto-char (point-min)) (org-map-entries (lambda nil (setq org-map-continue-from (point)) (org-cut-subtree)) org-static-blog-no-post-tag) (setq result (org-export-as 'org-static-blog-post-bare nil nil nil nil)) (switch-to-buffer current-buffer) result))))
  org-static-blog-render-post-content("~/repos/blog/posts/2022-01-13-test.org")
  (concat (org-static-blog-post-preamble post-filename) (org-static-blog-render-post-content post-filename) (org-static-blog-post-postamble post-filename))
  (org-static-blog-template (org-static-blog-get-title post-filename) (concat (org-static-blog-post-preamble post-filename) (org-static-blog-render-post-content post-filename) (org-static-blog-post-postamble post-filename)) (org-static-blog-get-description post-filename))
  (let ((current-buffer (current-buffer)) (buffer-exists (org-static-blog-file-buffer (org-static-blog-matching-publish-filename post-filename))) (result nil) (contents (org-static-blog-template (org-static-blog-get-title post-filename) (concat (org-static-blog-post-preamble post-filename) (org-static-blog-render-post-content post-filename) (org-static-blog-post-postamble post-filename)) (org-static-blog-get-description post-filename)))) (if buffer-exists (switch-to-buffer buffer-exists) (find-file (org-static-blog-matching-publish-filename post-filename))) (erase-buffer) (insert contents) (setq result (progn)) (basic-save-buffer) (unless buffer-exists (kill-buffer)) (switch-to-buffer current-buffer) result)
  (save-excursion (let ((current-buffer (current-buffer)) (buffer-exists (org-static-blog-file-buffer (org-static-blog-matching-publish-filename post-filename))) (result nil) (contents (org-static-blog-template (org-static-blog-get-title post-filename) (concat (org-static-blog-post-preamble post-filename) (org-static-blog-render-post-content post-filename) (org-static-blog-post-postamble post-filename)) (org-static-blog-get-description post-filename)))) (if buffer-exists (switch-to-buffer buffer-exists) (find-file (org-static-blog-matching-publish-filename post-filename))) (erase-buffer) (insert contents) (setq result (progn)) (basic-save-buffer) (unless buffer-exists (kill-buffer)) (switch-to-buffer current-buffer) result))
  (org-static-blog-with-find-file (org-static-blog-matching-publish-filename post-filename) (org-static-blog-template (org-static-blog-get-title post-filename) (concat (org-static-blog-post-preamble post-filename) (org-static-blog-render-post-content post-filename) (org-static-blog-post-postamble post-filename)) (org-static-blog-get-description post-filename)))
  org-static-blog-publish-file("~/repos/blog/posts/2022-01-13-test.org")
  org-static-blog-publish()
  eval((org-static-blog-publish) nil)
  elisp--eval-last-sexp(nil)
  eval-last-sexp(nil)
  funcall-interactively(eval-last-sexp nil)
  call-interactively(eval-last-sexp nil nil)
  command-execute(eval-last-sexp)
lucasemmoreira commented 2 years ago

what it looks to me is that (org-export-define-derived-backend 'org-static-blog-post-bare 'html :translate-alist '((template . (lambda (contents info) contents)))) failed to create a working backend on my setup. Do you have any hint on why that may be?

lucasemmoreira commented 2 years ago

interesting enough I made it work by putting the (org-export-define-derived-backend 'org-static-blog-post-bare 'html :translate-alist '((template . (lambda (contents info) contents)))) above the call on the function org-static-blog-render-post-content

lucasemmoreira commented 2 years ago

interesting enough I made it work by putting the (org-export-define-derived-backend 'org-static-blog-post-bare 'html :translate-alist '((template . (lambda (contents info) contents)))) above the call on the function org-static-blog-render-post-content

actually this is wrong. it works when i go to the file and execute the back end with C-x C-e. Not sure why this is happening but must some miss setup on my end

bastibe commented 2 years ago

I suspect that something about the way you import org-static-blog is different from the way it is meant to be done. The line you mentioned is usually automatically executed when org-static-blog is required, triggered by the autoload on the org-static-blog-publish-* functions.

lucasemmoreira commented 2 years ago

that makes sense! I was using use-package to import the lib. It was fixed when I put the setup under :config instead of :init. thanks for the help!