diff --git a/lisp/org-src.el b/lisp/org-src.el index 20e0b598c..e1f7d50dc 100644 --- a/lisp/org-src.el +++ b/lisp/org-src.el @@ -479,6 +479,8 @@ (defun org-src--contents-for-write-back (write-back-buf) (buffer-substring eol (point-max)))))) (write-back org-src--allow-write-back) marker indent-str) + ;; Compute the exact sequence of tabs and spaces used to indent up + ;; to `indentation-offset' in the Org buffer. (setq indent-str (with-temp-buffer ;; Reproduce indentation parameters from org buffer. @@ -500,6 +502,9 @@ (defun org-src--contents-for-write-back (write-back-buf) ;; first line. (when preserve-fl (forward-line)) (while (not (eobp)) + ;; Keep empty src lines empty, even when src block is + ;; indented on Org side. + ;; See https://list.orgmode.org/725763.1632663635@apollo2.minshall.org/T/ (when (not (eolp)) (insert indent-str)) ; not an empty line (forward-line))) (set-marker marker nil))))