emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] Worg Tutorial error: using Emacs lisp as formulas


From: Ciaran Mulloy
Subject: Re: [O] Worg Tutorial error: using Emacs lisp as formulas
Date: Thu, 28 Aug 2014 00:29:38 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0

On 27/08/14 12:52, Nick Dokos wrote:
Ciaran Mulloy <address@hidden> writes:

Hi Nick,
Many thanks for your input.

The table I was trying was the example in the tutorial shown as follows
(not big) and no hint of a regex!:

| Col1 | Col2 | Col3 | Col4 | Col5 |
|------+------+------+------+------|
| a    | a    | :='(mapconcat 'identity (delete-dups (list @2$1..@>$1
@2$2..@>$2)) " ") | b    |      |
| b    | a    |      |      |      |
| c    | d    |      |      |      |

#+TBLFM: @2$3='(mapconcat 'identity (delete-dups (list @2$1..@>$1
@2$2..@>$2)) " ")


I'm not sure where you got this: the tutorial's table does not have a
field formula afaict. If you eliminate the field formula, the example
works - just do C-c C-c on the #+TBLFM: line:

--8<---------------cut here---------------start------------->8---
| Col1 | Col2 | Col3    | Col4 | Col5 |
|------+------+---------+------+------|
| a    | a    |         | b    |      |
| b    | a    |         |      |      |
| c    | d    |         |      |      |
#+TBLFM: @2$3='(mapconcat 'identity (delete-dups (list @2$1..@>$1 @2$2..@>$2)) " 
")
--8<---------------cut here---------------end--------------->8---

I don't know why the field formula fails.

The version of emacs is GNU Emacs 24.3.1 (x86_64-pc-linux-gnu, ) of
2013-07-27 on roseapple, modified by Debian
Org-mode version 7.9.3f (release_7.9.3f-17-g7524ef @
/usr/share/emacs/24.3/lisp/org/)

Hi Guys,
Some definite strangeness that I'd love to get to the bottom of, if only to preserve my sanity and understanding of how Org-Mode works!

The following is the example given in the excellent Worg tutorial on using Emacs Lisp in spreadsheet formulas: http://orgmode.org/worg/org-tutorials/org-spreadsheet-lisp-formulas.html


| Col1 | Col2 | Col3 | Col4 | Col5 |
|------+------+------+------+------|
| a    | a    |      | d    |      |
| a    | b    |      |      |      |
| b    | a    |      |      |      |
| c    | d    |      |      |      |


Inserting the following as a field formula in location @2$3: :='(mapconcat 'identity (delete-dups (list @2$1..@>$1 @2$2..@>$2)) " ") and doing a C-c or a C-u-C-c C-c generates an 'Invalid regexp: "Regular expression too big"' error.

I used the formula debug option C-{ to enable formula debugging and got the following result:


With the debugging formula on, when the debugger asks whether to continue on the newly entered formula I get the following output and the error is resolved and formula properly calculated as shown below.

This is the output provided by the formula debugger:

Substitution history of formula
Orig: '(mapconcat 'identity (delete-dups (list @address@hidden @address@hidden)) " ") $xyz-> '(mapconcat 'identity (delete-dups (list @address@hidden @address@hidden)) " ") @r$c-> '(mapconcat 'identity (delete-dups (list #("a" 0 1 (fontified nil org-category "spreadsheets" face org-table)) #("a" 0 1 (fontified t org-category "spreadsheets" face org-table)) #("b" 0 1 (fontified t org-category "spreadsheets" face org-table)) #("c" 0 1 (fontified t org-category "spreadsheets" face org-table)) #("a" 0 1 (fontified nil org-category "spreadsheets" face org-table)) #("b" 0 1 (fontified t org-category "spreadsheets" face org-table)) #("a" 0 1 (fontified t org-category "spreadsheets" face org-table)) #("d" 0 1 (fontified t org-category "spreadsheets" face org-table)))) " ") $1-> '(mapconcat 'identity (delete-dups (list #("a" 0 1 (fontified nil org-category "spreadsheets" face org-table)) #("a" 0 1 (fontified t org-category "spreadsheets" face org-table)) #("b" 0 1 (fontified t org-category "spreadsheets" face org-table)) #("c" 0 1 (fontified t org-category "spreadsheets" face org-table)) #("a" 0 1 (fontified nil org-category "spreadsheets" face org-table)) #("b" 0 1 (fontified t org-category "spreadsheets" face org-table)) #("a" 0 1 (fontified t org-category "spreadsheets" face org-table)) #("d" 0 1 (fontified t org-category "spreadsheets" face org-table)))) " ")
Result: a b c d
Format: NONE
Final:  a b c d



After The formula was correctly resolved and shows the following result correctly:
| Col1 | Col2 | Col3    | Col4 | Col5 |
|------+------+---------+------+------|
| a    | a    | a b c d | d    |      |
| a    | b    |         |      |      |
| b    | a    |         |      |      |
| c    | d    |         |      |      |
#+TBLFM: @2$3='(mapconcat 'identity (delete-dups (list @2$1..@>$1 @2$2..@>$2)) " ")


The output in the messages file is as follows:
Loading 00debian-vars...done
Loading /etc/emacs/site-start.d/50dictionaries-common.el (source)...
Loading debian-ispell...
Loading /var/cache/dictionaries-common/emacsen-ispell-default.el (source)...done
Loading debian-ispell...done
Loading /var/cache/dictionaries-common/emacsen-ispell-dicts.el (source)...done
Loading /etc/emacs/site-start.d/50dictionaries-common.el (source)...done
For information about GNU Emacs and the GNU system, type C-h C-a.
Loading vc-git...done
Formula debugging has been turned on
Re-applying formulas to full table...
Re-applying formula to field: @2$3
Re-applying formulas to full table...(line 3)
Re-applying formula to field: @2$3
Debugging Formula.  Continue to next? (y or n)  n
user-error: Abort
byte-code: Beginning of buffer [10 times]
Auto-saving...done
Mark set
org-table-eval-formula: Invalid regexp: "Regular expression too big" [2 times]
Re-applying formulas to full table...
Re-applying formula to field: @2$3
Re-applying formula to field: @3$3
Re-applying formulas to full table...(line 3)
Re-applying formula to field: @2$3
Debugging Formula.  Continue to next? (y or n)  y
Re-applying formula to field: @3$3
Debugging Formula.  Continue to next? (y or n)  y
Re-applying formulas to 3 lines...done
Re-applying formulas...done [2 times]
Mark set
org-table-eval-formula: Invalid regexp: "Regular expression too big" [2 times]
byte-code: End of buffer
Re-applying formulas to full table...
Re-applying formula to field: @2$3
Re-applying formula to field: @3$3
Re-applying formula to field: @4$3
Re-applying formulas to full table...(line 3)
Re-applying formula to field: @2$3
Debugging Formula.  Continue to next? (y or n)  y
Re-applying formula to field: @3$3
Debugging Formula.  Continue to next? (y or n)  y
Re-applying formula to field: @4$3
Debugging Formula.  Continue to next? (y or n)  y
Re-applying formulas to 3 lines...done
Re-applying formulas...done [2 times]
Auto-saving...done
Mark set
org-table-eval-formula: Invalid regexp: "Regular expression too big"
Auto-saving...
byte-code: End of buffer
Re-applying formulas to full table...
Re-applying formula to field: @2$3
Re-applying formula to field: @2$5
Re-applying formula to field: @3$3
Re-applying formula to field: @4$3
Re-applying formulas to full table...(line 3)
Re-applying formula to field: @2$3
Debugging Formula.  Continue to next? (y or n)  y
Re-applying formula to field: @2$5
Debugging Formula.  Continue to next? (y or n)  y
Re-applying formula to field: @3$3
Debugging Formula.  Continue to next? (y or n)  y
Re-applying formula to field: @4$3
Debugging Formula.  Continue to next? (y or n)  y
Re-applying formulas to 3 lines...done
Re-applying formulas...done [2 times]
Mark set
org-table-eval-formula: Invalid regexp: "Regular expression too big" [2 times]
Formula debugging has been turned off
Formula debugging has been turned on
Formula debugging has been turned off
Formula debugging has been turned on
Mark set [2 times]
org-table-eval-formula: Invalid regexp: "Regular expression too big"
Formula debugging has been turned off
Formula debugging has been turned on
Re-applying formulas to full table...
Re-applying formula to field: @2$3
Re-applying formulas to full table...(line 4)
Re-applying formula to field: @2$3
Debugging Formula.  Continue to next? (y or n)  n
user-error: Abort
Mark set [4 times]
Auto-saving...
Mark set
Visual-Line mode enabled
Re-applying formulas to full table...
Re-applying formula to field: @2$3
Re-applying formulas to full table...(line 4)
Re-applying formula to field: @2$3
Debugging Formula.  Continue to next? (y or n)  y
Re-applying formulas to 4 lines...done
Re-applying formulas...done [2 times]
Auto-saving...
Mark set
org-table-eval-formula: Invalid regexp: "Regular expression too big" [2 times]
call-interactively: No recursive edit is in progress
Formula debugging has been turned off
Formula debugging has been turned on
Saving file /home/crmulloy/.emacs.d/init.el...
Wrote /home/crmulloy/.emacs.d/init.el [2 times]
File added to front of agenda file list
Formula debugging has been turned off
Formula debugging has been turned on
Re-applying formulas to full table...
Re-applying formula to field: @2$3
Re-applying formula to field: @3$3
Re-applying formulas to full table...(line 4)
Re-applying formula to field: @2$3
Debugging Formula.  Continue to next? (y or n)  y
Re-applying formula to field: @3$3
Debugging Formula.  Continue to next? (y or n)  y
Re-applying formulas to 4 lines...done
Re-applying formulas...done [2 times]
byte-code: Beginning of buffer [5 times]
Auto-saving...done
Mark set
Auto-saving...done
Tables Row/Column numbers display turned on
Auto-saving...done
byte-code: End of buffer
Mark set
org-table-eval-formula: Invalid regexp: "Regular expression too big"
Re-applying formulas to full table...
Re-applying formula to field: @2$3
Re-applying formulas to full table...(line 4)
Re-applying formula to field: @2$3
Debugging Formula.  Continue to next? (y or n)  y
Re-applying formulas to 4 lines...done
Re-applying formulas...done [2 times]
Auto-saving...done
Mark set [2 times]
org-table-eval-formula: Invalid regexp: "Regular expression too big" [2 times]
Re-applying formulas to full table...
Re-applying formula to field: @2$3
Re-applying formulas to full table...(line 4)
Re-applying formula to field: @2$3
Debugging Formula.  Continue to next? (y or n)  y
Re-applying formulas to 4 lines...done
Re-applying formulas...done [2 times]
Auto-saving...
byte-code: End of buffer [3 times]
byte-code: Beginning of buffer [8 times]
byte-code: Beginning of buffer


It seems that I can reliably reproduce a bug that I haven't been able to find on forums and that most other people have difficulty replicating. If I've done something to my installation of emacs I'd love to find out what has caused the problem.

Is there a way of determining what could be my issue?

Many thanks for your help!
Ciaran



reply via email to

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