emacs-orgmode
[Top][All Lists]
Advanced

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

[O] changing cells in an org-mode table with Emacs lisp


From: Tamas Papp
Subject: [O] changing cells in an org-mode table with Emacs lisp
Date: Sat, 27 Dec 2014 17:37:22 +0100

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]