emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: thorne <ego111@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: Emacs lisp code export difference between `org-export-region-as-html' and `org-export-as-html'
Date: Wed, 26 Sep 2012 01:28:39 -0600	[thread overview]
Message-ID: <CALrBS=M+Ja-paMSLYmViUxO1npJ2ZoOhqTbAzkLfqxhq3nPWUQ@mail.gmail.com> (raw)
In-Reply-To: <87d31a5uu5.fsf@bzg.ath.cx>

In case anyone might be interested in this, here is what I think is a
minimal example.  As I said, I am fine with it for my purposes, but
since the behaviour seems inconsistent (from my possibly limited
perspective) I thought I ought to at least specify as clearly as
possible what is going on:

First, with emacs -Q, and with a file called ~/tmp/foo.org

It's contents are only this:

#+BEGIN_SRC emacs-lisp :exports results :results html
"<>"
#+END_SRC

Now, slightly reformatted for clarity, M-x ielm --

*** Welcome to IELM ***  Type (describe-mode) for help.
ELISP> (defun render-with-find-file (file)
                (save-excursion
                  (let ((buffer (set-buffer (find-file file))))
                    (setq rtn (org-export-as-html nil nil nil 'string t))
                    (kill-buffer buffer)
                    rtn)))

==> render-with-find-file

ELISP> (defun render-with-temp-buffer (file)
                (with-temp-buffer
                  (insert-file file)
                  (org-mode)   ; doesn't actually seem to have any effect
                  (org-export-as-html nil nil nil 'string t)))

==> render-with-temp-buffer

ELISP> (render-with-find-file "~/tmp/foo.org")

==> #("<>\n\n" 0 2
         (org-native-text t original-indentation 0 org-protected t
fontified nil)
         2 3
         (fontified nil)
         3 4
         (fontified nil))

ELISP> (render-with-temp-buffer "~/tmp/foo.org")

==> #("<pre class=\"example\">\n&lt;&gt;\n</pre>\n\n\n" 0 40
        (fontified nil))

      reply	other threads:[~2012-09-26  7:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-24  6:34 Emacs lisp code export difference between `org-export-region-as-html' and `org-export-as-html' thorne
2012-09-24 21:53 ` thorne
2012-09-25  1:24   ` Bastien
2012-09-25  6:05   ` thorne
2012-09-25  9:13     ` Bastien
2012-09-26  7:28       ` thorne [this message]

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

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CALrBS=M+Ja-paMSLYmViUxO1npJ2ZoOhqTbAzkLfqxhq3nPWUQ@mail.gmail.com' \
    --to=ego111@gmail.com \
    --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 public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).