Ihor Radchenko <yanta...@posteo.net> writes:

> May you please convert the diff into a proper patch, so that I can
> install it under your name?

I gave it a try, please see the attachment.

Cheers,
Raffael

>From a94c25606164678b7887e9cc45c059b025f5140c Mon Sep 17 00:00:00 2001
From: Raffael Stocker <r.stoc...@mnet-mail.de>
Date: Mon, 17 Jun 2024 21:09:45 +0200
Subject: [PATCH] lisp/org-colview.el: Prevent repeated indentation of keyword
 lines

* org-colview.el (org-columns-dblock-write-default): left trim keyword
and TBLFM lines to prevent repeated indentation.
---
 lisp/org-colview.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lisp/org-colview.el b/lisp/org-colview.el
index 961ae0fbe..bc93941e4 100644
--- a/lisp/org-colview.el
+++ b/lisp/org-colview.el
@@ -1662,7 +1662,7 @@ defun org-columns-dblock-write-default
 	;; Insert affiliated keywords before the table.
 	(when content-lines
 	  (while (string-match-p "\\`[ \t]*#\\+" (car content-lines))
-	    (insert (pop content-lines) "\n")))
+	    (insert (string-trim-left (pop content-lines)) "\n")))
 	(save-excursion
 	  ;; Insert table at point.
 	  (insert
@@ -1675,7 +1675,7 @@ defun org-columns-dblock-write-default
 	  (let ((case-fold-search t))
 	    (dolist (line content-lines)
 	      (when (string-match-p "\\`[ \t]*#\\+TBLFM:" line)
-		(insert "\n" line)
+		(insert "\n" (string-trim-left line))
 		(unless recalc (setq recalc t))))))
 	(when recalc (org-table-recalculate 'all t))
 	(org-table-align)
-- 
2.45.2

Reply via email to