Dear Maintainers,
I seem to have been able to solve this issue through some brute force debugging. The problem emanates from when copying over the local variables, especially the `buffer-file-name' variable The function definition `org-src--edit-element' contains a provision to make the said variable nil - but it is quickly reset during initialisation of the buffer just 1 line downstream. Moving the setq statement 4 lines below seems to solve the issue, Herein I give the patch, ``` --- org-src.el 2024-10-04 15:54:11.357117268 +0530 +++ org-src-patched.el 2024-10-04 15:55:24.041730163 +0530 @@ -609,7 +609,6 @@ (let ((lf (eq type 'latex-fragment))) (unless preserve-ind (org-do-remove-indentation (and lf block-ind) lf))) (set-buffer-modified-p nil) - (setq buffer-file-name nil) ;; Initialize buffer. (when (functionp initialize) (let ((org-inhibit-startup t)) @@ -617,6 +616,7 @@ (funcall initialize) (error (message "Initialization fails with: %S" (error-message-string e)))))) + (setq buffer-file-name nil) ;; Transmit buffer-local variables for exit function. It must ;; be done after initializing major mode, as this operation ;; may reset them otherwise. ``` The following in .init can also be done by users not willing to patch the source file `org-src.el' ;; HHHH--------------------------------------------------- (defun patch/org-src--edit-element (&rest args) (setq-local buffer-file-name nil)) (advice-add 'org-src--edit-element :after #'patch/org-src--edit-element) ;; HHHH--------------------------------------------------- Thank you, Akash P