From fe97948e89b17a430d993cb732c240b3b7785ae7 Mon Sep 17 00:00:00 2001 From: "Stefan-W. Hahn" Date: Sun, 12 Feb 2017 12:41:19 +0100 Subject: [PATCH] org-table: Move table column with leaving text-properties untouched * lisp/org-table.el (org-table-move-column): Use `transpose-regions'. 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. --- 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 f6d43d39a..c055fb7c8 100644 --- a/lisp/org-table.el +++ b/lisp/org-table.el @@ -1494,7 +1494,9 @@ non-nil, the one above is used." (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)