[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[O] Bug: org-export-to-buffer throws error if buffer is empty or contain
From: |
Stefan-W. Hahn |
Subject: |
[O] Bug: org-export-to-buffer throws error if buffer is empty or contains empty lines only [9.0 (release_9.0-6-gf56456)] |
Date: |
Sat, 19 Nov 2016 13:33:16 +0100 |
User-agent: |
Mutt/1.5.24 (2015-08-30) |
Hello,
when exporting buffers containing nothing or just empty lines, like:
#+BEGIN_SRC emacs-lisp
(with-temp-buffer
(org-mode)
(insert "")
(org-export-to-buffer 'html "*Formatted Copy*" nil nil t t))
#+END_SRC
then org-export-to-buffer throws an error:
#+BEGIN_QUOTE
Debugger entered--Lisp error: (wrong-type-argument char-or-string-p nil)
org-export-to-buffer(html "*Formatted Copy*" nil nil t t)
(progn (org-mode) (insert "") (org-export-to-buffer (quote html) "*Formatted
Copy*" nil nil t t))
(unwind-protect (progn (org-mode) (insert "") (org-export-to-buffer (quote
html) "*Formatted Copy*" nil nil t t)) (and (buffer-name temp-buffer)
(kill-buffer temp-buffer)))
(save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn
(org-mode) (insert "") (org-export-to-buffer (quote html) "*Formatted Copy*"
nil nil t t)) (and (buffer-name temp-buffer) (kill-buffer temp-buffer))))
(let ((temp-buffer (generate-new-buffer " *temp*"))) (save-current-buffer
(set-buffer temp-buffer) (unwind-protect (progn (org-mode) (insert "")
(org-export-to-buffer (quote html) "*Formatted Copy*" nil nil t t)) (and
(buffer-name temp-buffer) (kill-buffer temp-buffer)))))
eval((let ((temp-buffer (generate-new-buffer " *temp*")))
(save-current-buffer (set-buffer temp-buffer) (unwind-protect (progn (org-mode)
(insert "") (org-export-to-buffer (quote html) "*Formatted Copy*" nil nil t t))
(and (buffer-name temp-buffer) (kill-buffer temp-buffer))))) 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)
#+END_QUOTE
Reason for this is located here:
#+BEGIN_SRC emacs-lisp
(defun org-export-to-buffer
(backend buffer
&optional async subtreep visible-only body-only ext-plist
post-process)
..
(let ((output
(org-export-as backend subtreep visible-only body-only ext-plist))
(buffer (get-buffer-create buffer))
(encoding buffer-file-coding-system))
(when (and (org-string-nw-p output) (org-export--copy-to-kill-ring-p))
(org-kill-new output))
(with-current-buffer buffer
(erase-buffer)
(setq buffer-file-coding-system encoding)
--> (insert output)
(goto-char (point-min))
(and (functionp post-process) (funcall post-process)))
(when org-export-show-temporary-export-buffer
(switch-to-buffer-other-window buffer))
buffer)))
#+END_SRC
In the explained case the output is nil. This gives the error.
With kind regards,
Stefan
Emacs : GNU Emacs 25.1.50.1 (x86_64-pc-linux-gnu, GTK+ Version 3.18.9)
of 2016-10-23
Package: Org mode version 9.0 (release_9.0-6-gf56456 @
/home/hs/.emacs.d/git/org-mode/lisp/)
--
Stefan-W. Hahn It is easy to make things.
It is hard to make things simple.
- [O] Bug: org-export-to-buffer throws error if buffer is empty or contains empty lines only [9.0 (release_9.0-6-gf56456)],
Stefan-W. Hahn <=