emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] Bug: Preserve text-properties of cells when moving column in org-tab


From: Stefan-W. Hahn
Subject: [O] Bug: Preserve text-properties of cells when moving column in org-table
Date: Sun, 12 Feb 2017 12:41:19 +0100
User-agent: Mutt/1.5.24 (2015-08-30)

Hello,

moving org-table rows is implemented with delete-region and insert which
preserve text-properties. Moving org-table columns is implemented
with replace-string, which removes text-properties.

My proposal is to use transpose-regions in org-table-move-column which
will preserve text-properties when moving columns in org-tables.

The patch is as follows (based on)

commit 1aeb958e5660879ccd865e8147117db50251eda7
Commit:     Marco Wahl <address@hidden>
CommitDate: Sun Feb 12 09:19:06 2017 +0100


From 0a60d9857cede915d9c025ab2bab7e7d95d583b4 Mon Sep 17 00:00:00 2001
From: "Stefan-W. Hahn" <address@hidden>
Date: Wed, 14 Dec 2016 21:47:48 +0100
Subject: [PATCH] + org-table: move table column with leaving text-properties
 untouched.

 MINOR-PATCH
---
 lisp/org-table.el | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lisp/org-table.el b/lisp/org-table.el
index b7a49f3..d94e42e 100644
--- a/lisp/org-table.el
+++ b/lisp/org-table.el
@@ -1486,7 +1486,9 @@ org-table-move-column
        (unless (org-at-table-hline-p)
         (org-table-goto-column col1 t)
         (when (looking-at "|\\([^|\n]+\\)|\\([^|\n]+\\)|")
-          (replace-match "|\\2|\\1|")))
+           (transpose-regions
+            (match-beginning 1) (match-end 1)
+            (match-beginning 2) (match-end 2))))
        (forward-line)))
     (set-marker end nil)
     (org-table-goto-column colpos)
-- 
2.9.0.137.gcf4c2cf

With kind regards,
Stefan

-- 
Stefan-W. Hahn                          It is easy to make things.
                                        It is hard to make things simple.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]