[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: local variables and export processing in hooks
From: |
M . ‘quintus’ Gülker |
Subject: |
Re: local variables and export processing in hooks |
Date: |
Wed, 10 Feb 2021 21:56:10 +0100 |
Am 09. Februar 2021 um 14:21 Uhr +0100 schrieb Sébastien Miquel:
> Eric S Fraga writes:
> > I tried but this doesn't seem to be propagated to the export as the
> > export works on a copy of the buffer, not the buffer itself. That's
> > what #+BIND is for, supposedly...
>
> I think this buffer copy preserves local variables. I know I use a such a
> local variable and its value can be read during macro expansion.
>
> It seems the org-export-before-parsing-hook functions are run before the
> #+BIND values are collected (see org-export-as in ox.el).
Interesting. I did not know about #+BIND, but just today I came about
the issue where I needed file-local variables to be available both in
the org-export-before-parsing-hook and in macro expansion. I
circumvented the problem by picking the original buffer out of
`buffer-list' and temporaryly switching to that buffer with
`with-current-buffer'.
Now I wonder whether #+BIND is more elegant. But my macro expansion
function modifies a buffer-local variable. Does #+BIND allow for that,
so that the changed value is available in the original org buffer?
-quintus
--
Dipl.-Jur. M. Gülker | https://mg.guelker.eu | For security:
Passau, Germany | kontakt@guelker.eu | () Avoid HTML e-mail
European Union | PGP: see homepage | /\ http://asciiribbon.org