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.
This commit is contained in:
Stefan-W. Hahn 2017-02-12 12:41:19 +01:00 committed by Nicolas Goaziou
parent b5b44f918d
commit fe97948e89
1 changed files with 3 additions and 1 deletions

View File

@ -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)