all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Bug: Preserve text-properties of cells when moving column in org-table
@ 2017-02-12 11:41 Stefan-W. Hahn
  2017-02-13 14:39 ` Nicolas Goaziou
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan-W. Hahn @ 2017-02-12 11:41 UTC (permalink / raw)
  To: emacs-orgmode

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 <marcowahlsoft@gmail.com>
CommitDate: Sun Feb 12 09:19:06 2017 +0100


From 0a60d9857cede915d9c025ab2bab7e7d95d583b4 Mon Sep 17 00:00:00 2001
From: "Stefan-W. Hahn" <stefan.hahn@s-hahn.de>
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.

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: Bug: Preserve text-properties of cells when moving column in org-table
  2017-02-12 11:41 Bug: Preserve text-properties of cells when moving column in org-table Stefan-W. Hahn
@ 2017-02-13 14:39 ` Nicolas Goaziou
  0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Goaziou @ 2017-02-13 14:39 UTC (permalink / raw)
  To: Stefan-W. Hahn; +Cc: emacs-orgmode

Hello,

"Stefan-W. Hahn" <stefan.hahn@s-hahn.de> writes:

> 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.

Applied. Thank you.

Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-02-13 14:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-12 11:41 Bug: Preserve text-properties of cells when moving column in org-table Stefan-W. Hahn
2017-02-13 14:39 ` Nicolas Goaziou

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.