emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@gmail.com>
To: numbchild@gmail.com
Cc: "Marvin Gülker" <post+orgmodeml@guelker.eu>, emacs-orgmode@gnu.org
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	[thread overview]
Message-ID: <87czfye6ty.fsf@localhost> (raw)
In-Reply-To: <629180cb.1c69fb81.4263.8e2fSMTPIN_ADDED_BROKEN@mx.google.com>

"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)))))))


  parent reply	other threads:[~2022-05-28  2:20 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-27 11:02 [BUG] Setting compile command causes fontification error [9.5 (release_9.5-661-g5e0afb @ /home/quintus/.emacs.d/org-mode/lisp/)] Marvin Gülker
2022-05-28  1:52 ` Christopher M. Miles
     [not found] ` <629180cb.1c69fb81.4263.8e2fSMTPIN_ADDED_BROKEN@mx.google.com>
2022-05-28  2:20   ` Ihor Radchenko [this message]
2022-05-29  7:17     ` Christopher M. Miles

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87czfye6ty.fsf@localhost \
    --to=yantar92@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=numbchild@gmail.com \
    --cc=post+orgmodeml@guelker.eu \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).