Sébastien Miquel <sebastien.miq...@posteo.eu> writes: > From 9d31a71bc0ab7cfd466ecad60037d00c62bdd9f6 Mon Sep 17 00:00:00 2001 > From: =?UTF-8?q?S=C3=A9bastien=20Miquel?= <sebastien.miq...@posteo.eu> > Date: Tue, 27 Jun 2023 09:23:01 +0200 > Subject: [PATCH] org-src.el: Use native value of `indent-tabs-mode' for > indentation
Thanks! This looks good and also fixes the original issue raised in this thread. May you now rebase the patch onto the latest main, add a Link: to this discussion to the commit message, and apply the attached extra comments?
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.1632663...@apollo2.minshall.org/T/ (when (not (eolp)) (insert indent-str)) ; not an empty line (forward-line))) (set-marker marker nil))))
-- Ihor Radchenko // yantar92, Org mode contributor, Learn more about Org mode at <https://orgmode.org/>. Support Org development at <https://liberapay.com/org-mode>, or support my work at <https://liberapay.com/yantar92>