"Christopher M. Miles" <[email protected]> writes:
> From the backtrace, seems (buffer-file-name) returned nil, I guess you
> first created a new buffer and have not saved it to file. That caused it
> return nil. Not Org Mode problem. Not saving file is a common problem in
> young programmer as I experienced. No offence.
To clarify, the problem is in the user-defined hook:
(add-hook 'latex-mode-hook (lambda()
(set (make-local-variable 'compile-command)
(concat "lualatex " (shell-quote-argument
(buffer-file-name))))))
The hook does not work when (buffer-file-name) returns nil, which is
exactly what happens when Org mode tries to fontify the source block.
Org does it inside a temporary buffer not associated with any real file.
One way to fix the problem would be
(add-hook 'latex-mode-hook (lambda()
(when (buffer-file-name)
(set (make-local-variable 'compile-command)
(concat "lualatex " (shell-quote-argument
(buffer-file-name)))))))
Best,
Ihor