Просмотр исходного кода

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.
Stefan-W. Hahn 8 лет назад
Родитель
Сommit
fe97948e89
1 измененных файлов с 3 добавлено и 1 удалено
  1. 3 1
      lisp/org-table.el

+ 3 - 1
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)