I would like to export my Org documents to a PDF and have bibulous.py format the bibliography. For this I use the command C-c C-e l p aka org-latex-pdf-process. Here is how I have adapted the command to my needs
(setq org-latex-pdf-process
(list "lualatex -shell-escape -interaction nonstopmode %f"
(concat "python C:/pythonpath/bibulous.py " "my_document_name" ".aux")
"lualatex -shell-escape -interaction nonstopmode %f"
"lualatex -shell-escape -interaction nonstopmode %f"))
This works so far, but only for my test document with the name my_document_name. To keep things general, there should be a function here that uses the current buffer name. I tried
python C:/pythonpath/bibulous.py %f.aux
but it does not work. I suspect that the variable %f contains the extension .tex (is there a way to see what exactly was called? the *Messages* buffer does not show this).
I have also tried the following
(concat "python C:/pythonpath/bibulous.py " (file-name-sans-extension buffer-file-name) ".aux")
however, it seems that this variable is set when Emacs is launched, and does not access the actual buffer name during runtime.