This question is a derivative of Export to multiple files according to tags. I wish to export to different files, according to tags.

To achieve this goal, I wrote some lines of code :

(defun export (tagname)
   "Export to a file named tagname.pdf all the headlines tagged with tagname"
          (let ((org-export-select-tags (list tagname)) (async nil) (subtreep nil) (visible-only nil) (body-only nil) (ext-plist '())) 
               (org-export-to-file 'beamer (concat tagname ".tex") async subtreep visible-only body-only ext-plist (lambda (file) (org-latex-compile file))))

(export "s1")
(export "s2")

where s1 and s2 are the tags to generate files from.

This is working as expected and generates files "s1.pdf" and "s2.pdf" correctly.

However, when I change (async nil) to (async t), the tag selection is not used anymore and two identical pdf files are generated, containing all headlines.

I would like to know if in async export, the variable org-export-select-tags is used and, if not, if it is possible to reduce the async export scope.

  • What is your emacs and org-mode version number? – Niclas Börlin Oct 27 '17 at 5:21
  • @NiclasBörlin I use emacs 24.5.1 and org-mode 9.1.1 (my OS is Ubuntu 16.04) – Lgen Oct 27 '17 at 12:27
  • I don't have a direct answer to your question, but if you debug <code>org-export-to-file</code> (I used <code>edebug</code>) with <code>async</code> set to <code>t</code> or <code>nil</code>, respectively, you might see what <code>org-export-to-file</code> does differently. – Niclas Börlin Oct 29 '17 at 9:25
  • I did the following in emacs to invoke edebug: 1. <code>C-h f org-export-to-file</code> to bring up the help for the function. 2. Click on the <code>ox.el</code> link in the help window to bring up the source code. 3. <code>M-x edebug-defun</code> to set a breakpoint at the beginning of the function. 4. Run code that invokes <code>org-export-to-file</code>. – Niclas Börlin Oct 29 '17 at 9:29
  • @NiclasBörlin Thanks really for your detailled help and for the hints to understand how things work in org-export-to-file. I tried to understand the source code but it is very difficult for me since I learned lisp years ago. I will try the debug method you suggest, thanks again for all the details that will be very useful. – Lgen Oct 29 '17 at 9:35

Your Answer

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

Browse other questions tagged or ask your own question.