From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: Tangling with cross-references coming from included files Date: Tue, 28 Mar 2017 10:06:59 -0400 Message-ID: <87tw6dze9o.fsf@alphaville.usersys.redhat.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:42221) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1csrmX-0000aM-Dt for emacs-orgmode@gnu.org; Tue, 28 Mar 2017 10:07:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1csrmU-0008Oy-6z for emacs-orgmode@gnu.org; Tue, 28 Mar 2017 10:07:33 -0400 Received: from [195.159.176.226] (port=33244 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1csrmU-0008Ol-0y for emacs-orgmode@gnu.org; Tue, 28 Mar 2017 10:07:30 -0400 Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1csrmJ-0004FO-Oo for emacs-orgmode@gnu.org; Tue, 28 Mar 2017 16:07:19 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org "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