[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Tangling with cross-references coming from included files
From: |
Nick Dokos |
Subject: |
Re: [O] Tangling with cross-references coming from included files |
Date: |
Tue, 28 Mar 2017 10:06:59 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) |
"address@hidden" <address@hidden> 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