I've been using org-mode everyday at work for 3 years and recommend that everyone to do the same.

But today, I unintentionally triggered a column function which replaced the cell value with an elisp statement.

  • Original Table

    | Column1 | Column2                                           |
    |---------+---------------------------------------------------|
    | Task1   | Map =LDAPGroupA= group to =ApplicationRoleA= role |
    
  • Removed Map + space from cell

    | Column1 | Column2                                           |
    |---------+---------------------------------------------------|
    | Task1   | =LDAPGroupA= group to =ApplicationRoleA= role     |
    

    Out of habit, did C-c C-c to reformat table.

  • Result

    | Column1 | Column2                                          |
    |---------+--------------------------------------------------|
    | Task1   | eq(LDAPGroupA, group to, ApplicationRoleA, role) |
    #+TBLFM: $2=LDAPGroupA= group to =ApplicationRoleA= role
    

Why did cell in org table turn into elisp statement and column TBLFM?


GNU Emacs 25.2.1 (x86_64-unknown-cygwin, GTK+ Version 3.22.10) of 2017-04-21
Org mode version 9.0.9 (9.0.9-elpa)

up vote 2 down vote accepted
  1. Why it turns into a TBLFM?:
    Because the first char in this field was a =, i.e. column formula.

  2. Why turns the field content into an elisp statement?:
    This does not look like a elisp statement, but like a calc statement. calc is the default mode of org-table formulas

  3. Why turns it into a equal statement?:
    Because calc can't resolve the symbols ("LDAPGroupA", "group to", "role") and there is exactly one = between every symbol. If you replace the symbols by numbers you get a boolean result (1 or 0).

As wished by comment: example to list item 3:

| Column1 | Column2    |
|---------+------------|
| Task1   | =3=3 =3= 3 |

| Column1 | Column2    |
|---------+------------|
| Task1   | =1=1 =2= 1 |

after C-c C-c in field (row=2, column=2) it gets:

| Column1 | Column2 |
|---------+---------|
| Task1   |       1 |
#+TBLFM: $2=3=3 =3= 3


| Column1 | Column2 |
|---------+---------|
| Task1   |       0 |
#+TBLFM: $2=1=1 =2= 1
  • Thanks you for your speedy answer! I think you're very close to the answer. I think you're correct about calc. Before I accept your answer, please add an example under 3. with example I can copy into buffer and test . This example will significantly improve your answer. You are correct that |= creates a column formula and likewise |:= creates a field formula. However there is an exception when applying a verbatim format, i.e. | =verbatim= |. Any ideas? Thanks again! – Melioratus Jul 13 '17 at 21:03
  • I think that = for the formula in a table has a higher priority than verbatim. The complete field string after the first =is replaced by the result. – jue Jul 13 '17 at 21:43

Your Answer

 
discard

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.