1

The org mode export utilities in ox-extra are very useful. However because these utilities are enabled in my init.el file, I do not know how to enable or disable the utilities and a per document basis.

Specifically, my init.el contains:

(require 'ox-extra)
(ox-extras-activate '(notignore-headlines))

This activates notignore-headlines globally. Can this instead be activated on a per document basis?

1

It looks like that support is on the org-extra to-do list (from org-extra.el):

;; TODO:
;; - add a function to org-mode-hook that looks for a ox-extras local
;;   variable and activates the specified extras buffer-locally

In the meantime you can circumvent ox-extras-activate by adding something like this to the top of the file you want it active for:

# -*- eval: (progn (require 'ox-extra) (add-hook 'org-export-filter-parse-tree-functions 'org-export-notignore-headlines nil t)); -*-

(judging from this commit: https://github.com/boykov/org-mode/compare/ox-extra-notignore)

Note that you need to pass the LOCAL t argument to add-hook.

  • @ ebpa Can you help me with the syntax for the suggested workaround? Placing the add-hook code at the start of the buffer seems to have no effect on the exported pdf. – Snelephant Jan 25 '17 at 4:18
  • @Snelephant If you save that at the top of the file and re-open / revert the buffer it should take effect. Emacs will likely ask you if you want to apply eval entry the first time you open it. If it's still not working I might have a typo. Could you check whether it works manually / whether the org-export-* symbols are accurate? – ebpa Jan 25 '17 at 4:26
  • @ ebpa Saving and reloading the relevant buffer triggered the eval. However, upon confirming I receive: byte-code: Symbol’s function definition is void: t – Snelephant Jan 25 '17 at 20:19
  • @Snelephant Hmm. Maybe add-hook has a different signature on your system? I think there was a add-local-hook function for a while. The arguments I provided were for the add-hook signature (add-hook HOOK FUNCTION &optional APPEND LOCAL). What version of emacs are you running? – ebpa Jan 26 '17 at 2:27
  • @ ebpa Emacs 25.1. Several add-hook entries in my init.el seem work. To clarify, the error above occurs during export. – Snelephant Jan 30 '17 at 3:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.