This is a rather small change in org.el. Since I didn't get a response
(even rejected) I suspect this is because I didn't attached a proper patch
so that the patchwork server can get it.

The patch is attached now.

--
Darlan

diff --git a/lisp/org.el b/lisp/org.el
index acbb261..eb95efa 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -16151,6 +16151,11 @@ Revert to the normal definition outside of these 
fragments."
   (mapc 'delete-overlay org-latex-fragment-image-overlays)
   (setq org-latex-fragment-image-overlays nil))
 
+(defun org-buffer-file-name ()
+  "Similar to buffer-file-name, but also works on indirect buffers."
+  (buffer-file-name (buffer-base-buffer))
+  )
+
 (defun org-preview-latex-fragment (&optional subtree)
   "Preview the LaTeX fragment at point, or all locally or globally.
 If the cursor is in a LaTeX fragment, create the image and overlay
@@ -16189,7 +16194,7 @@ The images can be removed again with 
\\[org-ctrl-c-ctrl-c]."
        (org-format-latex
         (concat "ltxpng/" (file-name-sans-extension
                            (file-name-nondirectory
-                            buffer-file-name)))
+                            (org-buffer-file-name))))
         default-directory 'overlays msg at 'forbuffer 'dvipng)
       (message msg "done.  Use `C-c C-c' to remove images.")))))
 

Reply via email to