From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tamas Papp Subject: changing cells in an org-mode table with Emacs lisp Date: Sat, 27 Dec 2014 17:37:22 +0100 Message-ID: <87vbkxgibh.fsf@tamas.ihs.ac.at> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:48545) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y4uMs-0005XU-EV for emacs-orgmode@gnu.org; Sat, 27 Dec 2014 11:37:31 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y4uMn-0004Pu-Ui for emacs-orgmode@gnu.org; Sat, 27 Dec 2014 11:37:30 -0500 Received: from mail-wg0-x22b.google.com ([2a00:1450:400c:c00::22b]:40810) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y4uMn-0004Pe-O3 for emacs-orgmode@gnu.org; Sat, 27 Dec 2014 11:37:25 -0500 Received: by mail-wg0-f43.google.com with SMTP id l18so16046530wgh.30 for ; Sat, 27 Dec 2014 08:37:24 -0800 (PST) Received: from tamas.ihs.ac.at (catv-176-63-236-49.catv.broadband.hu. [176.63.236.49]) by mx.google.com with ESMTPSA id jp3sm32350688wid.9.2014.12.27.08.37.23 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 27 Dec 2014 08:37:23 -0800 (PST) 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Hi, I would like to manipulate cells in an org-mode table using Emacs lisp code. Suppose I have a function (FORMAT-CELL CELL ROW COL) that takes a cell (string), row and column numbers, and returns a new string if I want to replace content in a cell, and NIL otherwise. I need help with writing code that makes Emacs walk the table (all cells), and then the new row when I insert a row (eg after capture). For example, if my formatting function is (defun format-cell (cell row col) ;; toy example, actual code would be more complicated (when (<= (length cell) col) (concat "*" cell "*"))) then the table | a | a | | aa | aa | | aaa | aaa | would be replaced by | *a* | *a* | | aa | *aa* | | aaa | aaa | I need the replacement in place, I don't want to make a new table. I would like to re-align the table when done. Any help with this would be appreciated, in particular, the names of the functions that would help me get started, I could not figure this out. Best, Tamas