Arne
Arne

Reputation: 41

org-export-hook does not trigger

When exporting an org file to Latex / HTML / etc. I want to replace every occurrence of "Hello" with "World"

(add-hook 'org-export-preprocess-final-hook
      (lambda () (replace-string "Hello" "World")))

Setting the hook doesn't seem to do anything, nothing gets replaced in the exported file. Do I use the wrong hook?

Upvotes: 0

Views: 372

Answers (1)

Bruce
Bruce

Reputation: 7132

I tried and it worked for me.

Typed your exact line and executed it (using C-x e in my scratch buffer)

Confirmation, using C-h v org-export-preprocess-final-hook

org-export-preprocess-final-hook's value is ((lambda nil
     (replace-string "Hello" "World")))

Tested from a buffer containing

* Task
Hello
Bouh
Hello

Using M-x org-export then H (temporary buffer), I got (snippet)

<p>World
Bouh
World
</p></div>

Are you sure you executed your registration ?

Upvotes: 2

Related Questions