Hello,

I frequently use indirect buffers with org but org-preview-latex-fragment
does not work when in an indirect buffer. The reason is that
org-preview-latex-fragment uses "buffer-file-name" to get the name of the
file associated with the current buffer, but this is nil for indirect
buffers.

To solve this, all its necessary is to define the function below

--8<---------------cut here---------------start------------->8---
(defun org-buffer-file-name ()
  "Similar to buffer-file-name, but also work on indirect buffers."
  (buffer-file-name (buffer-base-buffer))
  )
--8<---------------cut here---------------end--------------->8---

and replace "buffer-file-name" in the org-preview-latex-fragment by
"(org-buffer-file-name)". This works in both: "normal" buffers and indirect
buffers.

--
Darlan

Reply via email to