* Using org-map-entries with org-export-before-processing-hook
@ 2013-03-06 3:28 Eric Abrahamsen
2013-03-06 10:13 ` Nicolas Goaziou
0 siblings, 1 reply; 5+ messages in thread
From: Eric Abrahamsen @ 2013-03-06 3:28 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 965 bytes --]
I've attached a minimum org file that shows what I'm trying to do:
essentially to attach a hook to the export process that ends up calling
org-map-entries to make alterations to the file just before it's
exported.
As I've got it now, the hook does change the org buffer, but those
changes are *not* reflected in the exported output. I can only guess
that somehow the export process is able to continue on before the
org-map-entries results are returned? Doesn't seem likely, but...
This is actually kind of the opposite of what I'd like: to have the
changes *only* reflected in the export, and leave the original buffer
unchanged. On the other hand, I can see what thought and care has gone
into setting up a clone buffer for export (and I do need to rely on
buffer-local variables), so maybe an (undo) is my best solution for
returning the buffer to its pre-export state.
But I would like the changes to show up in the exported file!
Thanks in advance,
Eric
[-- Attachment #2: test2.org --]
[-- Type: application/vnd.lotus-organizer, Size: 644 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Using org-map-entries with org-export-before-processing-hook
2013-03-06 3:28 Using org-map-entries with org-export-before-processing-hook Eric Abrahamsen
@ 2013-03-06 10:13 ` Nicolas Goaziou
2013-03-06 10:29 ` Eric Abrahamsen
0 siblings, 1 reply; 5+ messages in thread
From: Nicolas Goaziou @ 2013-03-06 10:13 UTC (permalink / raw)
To: Eric Abrahamsen; +Cc: emacs-orgmode
Hello,
Eric Abrahamsen <eric@ericabrahamsen.net> writes:
> I've attached a minimum org file that shows what I'm trying to do:
> essentially to attach a hook to the export process that ends up calling
> org-map-entries to make alterations to the file just before it's
> exported.
>
> As I've got it now, the hook does change the org buffer, but those
> changes are *not* reflected in the exported output. I can only guess
> that somehow the export process is able to continue on before the
> org-map-entries results are returned? Doesn't seem likely, but...
>
> This is actually kind of the opposite of what I'd like: to have the
> changes *only* reflected in the export, and leave the original buffer
> unchanged. On the other hand, I can see what thought and care has gone
> into setting up a clone buffer for export (and I do need to rely on
> buffer-local variables), so maybe an (undo) is my best solution for
> returning the buffer to its pre-export state.
>
> But I would like the changes to show up in the exported file!
The problem is not directly related to the export framework, but to its
relationship with `org-map-entries'.
If you use the following function:
(defun before-export-test (backend)
;; (org-map-entries 'test-map "TODO=\"TODO\"" 'file)
(while (re-search-forward "^\\*+ TODO" nil t)
(test-map)))
it should work.
I don't know why `org-map-entries' behaves badly with export. Meanwhile,
I suggest to not use this function for export hooks.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Using org-map-entries with org-export-before-processing-hook
2013-03-06 10:13 ` Nicolas Goaziou
@ 2013-03-06 10:29 ` Eric Abrahamsen
2013-03-06 13:29 ` Nicolas Goaziou
0 siblings, 1 reply; 5+ messages in thread
From: Eric Abrahamsen @ 2013-03-06 10:29 UTC (permalink / raw)
To: emacs-orgmode
Nicolas Goaziou <n.goaziou@gmail.com> writes:
> Hello,
>
> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>
>> I've attached a minimum org file that shows what I'm trying to do:
>> essentially to attach a hook to the export process that ends up calling
>> org-map-entries to make alterations to the file just before it's
>> exported.
>>
>> As I've got it now, the hook does change the org buffer, but those
>> changes are *not* reflected in the exported output. I can only guess
>> that somehow the export process is able to continue on before the
>> org-map-entries results are returned? Doesn't seem likely, but...
>>
>> This is actually kind of the opposite of what I'd like: to have the
>> changes *only* reflected in the export, and leave the original buffer
>> unchanged. On the other hand, I can see what thought and care has gone
>> into setting up a clone buffer for export (and I do need to rely on
>> buffer-local variables), so maybe an (undo) is my best solution for
>> returning the buffer to its pre-export state.
>>
>> But I would like the changes to show up in the exported file!
>
> The problem is not directly related to the export framework, but to its
> relationship with `org-map-entries'.
>
> If you use the following function:
>
> (defun before-export-test (backend)
> ;; (org-map-entries 'test-map "TODO=\"TODO\"" 'file)
> (while (re-search-forward "^\\*+ TODO" nil t)
> (test-map)))
>
> it should work.
>
> I don't know why `org-map-entries' behaves badly with export. Meanwhile,
> I suggest to not use this function for export hooks.
That'll work! Thanks for looking at this.
E
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Using org-map-entries with org-export-before-processing-hook
2013-03-06 10:29 ` Eric Abrahamsen
@ 2013-03-06 13:29 ` Nicolas Goaziou
2013-03-07 0:44 ` Eric Abrahamsen
0 siblings, 1 reply; 5+ messages in thread
From: Nicolas Goaziou @ 2013-03-06 13:29 UTC (permalink / raw)
To: Eric Abrahamsen; +Cc: emacs-orgmode
Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>> The problem is not directly related to the export framework, but to its
>> relationship with `org-map-entries'.
>>
>> If you use the following function:
>>
>> (defun before-export-test (backend)
>> ;; (org-map-entries 'test-map "TODO=\"TODO\"" 'file)
>> (while (re-search-forward "^\\*+ TODO" nil t)
>> (test-map)))
>>
>> it should work.
>>
>> I don't know why `org-map-entries' behaves badly with export. Meanwhile,
>> I suggest to not use this function for export hooks.
>
> That'll work! Thanks for looking at this.
I think I fixed the problem wrt `org-map-entries' and export.
You cannot use `file' scope, since it refers to the base buffer
associated to the current buffer file name, which never is the buffer
where the export process takes place.
OTHO, a nil scope (or tree, region for that matter) should be fine with
a very recent Org.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Using org-map-entries with org-export-before-processing-hook
2013-03-06 13:29 ` Nicolas Goaziou
@ 2013-03-07 0:44 ` Eric Abrahamsen
0 siblings, 0 replies; 5+ messages in thread
From: Eric Abrahamsen @ 2013-03-07 0:44 UTC (permalink / raw)
To: emacs-orgmode
Nicolas Goaziou <n.goaziou@gmail.com> writes:
> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>
>>> The problem is not directly related to the export framework, but to its
>>> relationship with `org-map-entries'.
>>>
>>> If you use the following function:
>>>
>>> (defun before-export-test (backend)
>>> ;; (org-map-entries 'test-map "TODO=\"TODO\"" 'file)
>>> (while (re-search-forward "^\\*+ TODO" nil t)
>>> (test-map)))
>>>
>>> it should work.
>>>
>>> I don't know why `org-map-entries' behaves badly with export. Meanwhile,
>>> I suggest to not use this function for export hooks.
>>
>> That'll work! Thanks for looking at this.
>
> I think I fixed the problem wrt `org-map-entries' and export.
>
> You cannot use `file' scope, since it refers to the base buffer
> associated to the current buffer file name, which never is the buffer
> where the export process takes place.
Whoa, not only does it work, it leaves the original buffer unmodified,
as per my wishlist. Many thanks! I don't know when you find the time to
sleep.
E
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-03-07 0:39 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-06 3:28 Using org-map-entries with org-export-before-processing-hook Eric Abrahamsen
2013-03-06 10:13 ` Nicolas Goaziou
2013-03-06 10:29 ` Eric Abrahamsen
2013-03-06 13:29 ` Nicolas Goaziou
2013-03-07 0:44 ` Eric Abrahamsen
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).