Vojtěch Káně <[email protected]> writes:

I like org-mode tables and often use them with complex lisp formulas. Editing them is a bit of a PITA though despite the `*Edit Formulas* buffer. Both the top menu and the online docs suggest TAB (org-table-fedit-lisp-indent) to make it instantly more comfortable, but it does not work for most of my formulas. An example one looks like
    ....

Confirmed.

If I open up an Org buffer and execute this:

#+begin_src elisp
(progn
 (insert "||")
 (org-table-edit-formulas)
 (set-fill-column 30)
(insert "$2='(apply '+ (seq-mapn (lambda (foo) (if (equal foo \"bar\") 1 0)) '(@I..@II)));E"))
#+end_src

Then pressing tab a bunch will indent and un-indent the code.

Prepending "@>>" to the beginning of the buffer makes tab only jump to the beginning of line, no indenting happens anymore.

I believe the regexp in org-table-fedit-lisp-indent is too restrictive and does not allow for the `>` character in cell addressing. When I replace `@>>$2` with just `$2`, it suddenly works.

Am I right that the behavior is unexpected and the regexp should be fixed? Is so, can somebody do it?

Yes you are correct on every account. Taking a close look at the regex shows that this issue will also occur with ranges (ex. @1..5).

Someone really should go through org-table.el at some point and factor all these regex's. I have a feeling we have similar oversights in other parts of the code :/

Since I'm not going to refactor everything, I'll just quickly patch this specific issue we're having.

Fixed, as commit 597510452

Thank you very much for your bug report! You've help make Org a little bit better :)

Reply via email to