emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Nick Dokos <ndokos@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: Tangling with cross-references coming from included files
Date: Tue, 28 Mar 2017 10:06:59 -0400	[thread overview]
Message-ID: <87tw6dze9o.fsf@alphaville.usersys.redhat.com> (raw)
In-Reply-To: B2BDA194-943D-47A4-A852-697308054F8B@1042.ch

"s@1042.ch" <s@1042.ch> writes:

> ...
> Instead there is org-before-parsing-hook [3], wich does essentially the same (as far as I understood).
> But instead using a string for copying the buffer for exporting, the exporter uses a temporary buffer,
> “buf-copy”.
>
> I tried to get the contents of that buffer within the hook like so:
>
> #+begin_src emacs-lisp
>  (defun ded/org-export-as-org-to-buffer ()
>    (interactive)
>    (let* ((tmp-file (make-temp-file "org-tangle-with-include"))
>           (org-before-parsing-hook
>            `((lambda () (setq ((b (get-buffer ,buf-copy)))
>                           (with-temp-file ,tmp-file (insert b)))))))
>      (save-window-excursion (org-export-as-html-to-buffer nil))
>      (switch-to-buffer
>       (get-buffer-create "*Org Org Export*"))
>      (insert-file-contents tmp-file))
>    (org-mode))
>
>  (defun ded/tangle-with-include-files ()
>    (interactive)
>    (save-window-excursion
>      (ded/org-export-as-org-to-buffer)
>      (org-babel-tangle)))
> #+end_src
>
> But it does not work as buf-copy is void. What am I doing wrong? How do I get the buffer “buf-copy”?
> I am assuming that it is “buf-copy” as the call of the hook happens
> within the context of “org-export-with-buffer-copy”.
> Is my assumption wrong?
>

The hook is called 'org-export-before-parsing-hook', but whether that solves your problem or not,
I don't know.

-- 
Nick

  reply	other threads:[~2017-03-28 14:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-28  7:20 Tangling with cross-references coming from included files s
2017-03-28 14:06 ` Nick Dokos [this message]
2017-03-28 15:15   ` Sven Osterwalder
2017-03-29 14:41 ` 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

  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=87tw6dze9o.fsf@alphaville.usersys.redhat.com \
    --to=ndokos@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).