From: "Stefan-W. Hahn" <stefan.hahn@s-hahn.de>
To: emacs-orgmode@gnu.org
Subject: 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 [thread overview]
Message-ID: <20161119123316.GG9272@seven> (raw)
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.
next reply other threads:[~2016-11-19 12:33 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-19 12:33 Stefan-W. Hahn [this message]
2016-11-19 22:10 ` Bug: org-export-to-buffer throws error if buffer is empty or contains empty lines only [9.0 (release_9.0-6-gf56456)] Nicolas Goaziou
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161119123316.GG9272@seven \
--to=stefan.hahn@s-hahn.de \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.