emacs-orgmode
[Top][All Lists]
Advanced

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

[O] [RFC] Preserving text-properties when moving columns in org-table


From: Stefan-W. Hahn
Subject: [O] [RFC] Preserving text-properties when moving columns in org-table
Date: Tue, 6 Dec 2016 21:05:57 +0100
User-agent: Mutt/1.5.24 (2015-08-30)

Hello,

I'm using text-properties to mark special entries on org-tables.

When moving columns around in such a propertized table, the text-properties
got lost because moving around is realized with "replace-match", which does
not save the text-properties.

If replacing "replace-match" with "transpose-regions" the text-properties
of the text will be preserved.

The only thing I'm not sure about is if leaving markers, parameter
"leave-markers" of transpose-regions should be set.

#+BEGIN_SRC
modified   lisp/org-table.el
@@ -1494,7 +1494,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)
#+END_SRC

Moving rows with org-table-move-row preserves the text-properties and is
therefore ok.

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]