From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrea Rossetti Subject: Re: Worg Tutorial error: using Emacs lisp as formulas Date: Thu, 28 Aug 2014 02:05:08 +0200 Message-ID: <84zjepiimj.fsf@gmail.com> References: <53FCDD83.40206@gmail.com> <87a96qhcfb.fsf@alphaville.dokosmarshall.org> <53FD8701.4060707@gmail.com> <8761hegnez.fsf@alphaville.dokosmarshall.org> <53FE69E2.8000509@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:47045) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XMnDN-0003D8-Sk for emacs-orgmode@gnu.org; Wed, 27 Aug 2014 20:05:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XMnDE-0004S5-QP for emacs-orgmode@gnu.org; Wed, 27 Aug 2014 20:05:21 -0400 Received: from mail-we0-x233.google.com ([2a00:1450:400c:c03::233]:40365) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XMnDE-0004RY-IH for emacs-orgmode@gnu.org; Wed, 27 Aug 2014 20:05:12 -0400 Received: by mail-we0-f179.google.com with SMTP id t60so23807wes.38 for ; Wed, 27 Aug 2014 17:05:11 -0700 (PDT) In-Reply-To: <53FE69E2.8000509@gmail.com> (Ciaran Mulloy's message of "Thu, 28 Aug 2014 00:29:38 +0100") 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: Ciaran Mulloy Cc: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain Ciaran Mulloy writes: > 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. > .... > 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? Hello Ciaran, long story short: digging in org-table.el I noticed that functions f1=`org-table-formula-handle-first/last-rc' and f2=`org-table-formula-substitute-names' were used sometimes like this: (f2 (f1 x)), and sometimes like this: (f2 x). I conjecture it should always be (f2 (f1 x)), so I applied to my org-table.el, reloaded its definitions with `eval-buffer' and... it worked! File formula.diff attached here shows the exact changes that I applied on my org-table.el. (if you try formula.diff and it works for you, beware that you need to remove or recompile the old org-table.elc file). --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=formula.diff diff -c "-L" "c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140804/org-table.el" "-L" "#" "c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140804/org-table.el" "c:/Users/andrea/AppData/Local/Temp/buffer-content-3236IUh" *** c:/Users/andrea/AppData/Roaming/.emacs.d/elpa/org-20140804/org-table.el --- # *************** *** 2600,2606 **** (unless (string-match "\\S-" fmt) (setq fmt nil)))) (if (and (not suppress-const) org-table-formula-use-constants) ! (setq formula (org-table-formula-substitute-names formula))) (setq orig (or (get-text-property 1 :orig-formula formula) "?")) (while (> ndown 0) (setq fields (org-split-string --- 2600,2606 ---- (unless (string-match "\\S-" fmt) (setq fmt nil)))) (if (and (not suppress-const) org-table-formula-use-constants) ! (setq formula (org-table-formula-substitute-names (org-table-formula-handle-first/last-rc formula)))) (setq orig (or (get-text-property 1 :orig-formula formula) "?")) (while (> ndown 0) (setq fields (org-split-string *************** *** 3767,3773 **** (if (eq what 'name) (setq var (substring match 1))) (when (eq what 'range) (or (equal (string-to-char match) ?@) (setq match (concat "@" match))) ! (setq match (org-table-formula-substitute-names match))) (unless local (save-excursion (end-of-line 1) --- 3767,3773 ---- (if (eq what 'name) (setq var (substring match 1))) (when (eq what 'range) (or (equal (string-to-char match) ?@) (setq match (concat "@" match))) ! (setq match (org-table-formula-substitute-names (org-table-formula-handle-first/last-rc match)))) (unless local (save-excursion (end-of-line 1) Diff finished. Thu Aug 28 01:17:44 2014 --=-=-= Content-Type: text/plain Hope it may be of some help, kindest regards. Andrea --=-=-=--