emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [BUG] Setting compile command causes fontification error [9.5 (relea


From: Ihor Radchenko
Subject: Re: [BUG] Setting compile command causes fontification error [9.5 (release_9.5-661-g5e0afb @ /home/quintus/.emacs.d/org-mode/lisp/)]
Date: Sat, 28 May 2022 10:20:25 +0800

"Christopher M. Miles" <numbchild@gmail.com> 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]