From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Stefan-W. Hahn" Subject: [RFC] Preserving text-properties when moving columns in org-table Date: Tue, 6 Dec 2016 21:05:57 +0100 Message-ID: <20161206200557.GA6980@seven> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:49262) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cEM06-00016o-2S for emacs-orgmode@gnu.org; Tue, 06 Dec 2016 15:06:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cEM02-0005zk-Uj for emacs-orgmode@gnu.org; Tue, 06 Dec 2016 15:06:06 -0500 Received: from mout.kundenserver.de ([212.227.17.13]:55464) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cEM02-0005z2-Jb for emacs-orgmode@gnu.org; Tue, 06 Dec 2016 15:06:02 -0500 Content-Disposition: inline List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-orgmode@gnu.org 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.