emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Carsten Dominik <carsten.dominik@gmail.com>
To: maxco.tr@gmail.com
Cc: emacs-orgmode@gnu.org
Subject: Re: Iterate many tables
Date: Fri, 7 May 2010 09:36:57 +0200	[thread overview]
Message-ID: <B7A0FD63-FC6B-43A9-9271-076836173A6B@gmail.com> (raw)
In-Reply-To: <4BE2A954.7010401@gmail.com>

Hi,

both functions work without any problem for me, so I do not know what  
you are doing differently.  maybe you ned to describe exactly how you  
are calling the functions.

- Carsten

On May 6, 2010, at 1:34 PM, T Helms wrote:

> Thanks for bringing this up, it would be a useful tool.
>
> I get an error using the functions as well
>
> org-recalculate-all-tables:
> org-recalculate-all-tables: Wrong number of arguments: (lambda  
> (function) "Apply FUNCTION to the start of all tables in the  
> buffer." (save-excursion (save-restriction (widen) (goto-char (point- 
> min)) (while (re-search-forward org-table-any-line-regexp nil t)  
> (message "Mapping tables: %d%%" (/ (* 100.0 (point)) (buffer-size)))  
> (beginning-of-line 1) (when (looking-at org-table-line-regexp) (save- 
> excursion (funcall function)) (or (looking-at org-table-line-regexp)  
> (forward-char 1))) (re-search-forward org-table-any-border-regexp  
> nil 1)))) (message "Mapping tables: done")), 2
>
> org-iterate-all-tables:
> while: Wrong number of arguments: (lambda (function) "Apply FUNCTION  
> to the start of all tables in the buffer." (save-excursion (save- 
> restriction (widen) (goto-char (point-min)) (while (re-search- 
> forward org-table-any-line-regexp nil t) (message "Mapping tables: %d 
> %%" (/ (* 100.0 (point)) (buffer-size))) (beginning-of-line 1) (when  
> (looking-at org-table-line-regexp) (save-excursion (funcall  
> function)) (or (looking-at org-table-line-regexp) (forward-char 1)))  
> (re-search-forward org-table-any-border-regexp nil 1)))) (message  
> "Mapping tables: done")), 2
>
>
> On 05/05/2010 03:37 PM, Johan Ekh wrote:
>>
>>
>>
>> Any idea what could be wrong?
>>
>>
>>
>> Error meassage:
>>
>> org-recalculate-all-tables: Wrong number of arguments: #[(function)  
>> "ŠŒ~ˆebˆÄ\bÅÆ#ƒ:
>>
>>
>> Best regards,
>> Johan
>>
>>
>>
>>
>>
>>
>> On Fri, Apr 30, 2010 at 5:03 PM, Carsten Dominik <carsten.dominik@gmail.com 
>> > wrote:
>>
>> On Apr 30, 2010, at 4:07 PM, Johan Ekh wrote:
>>
>> Hi all,
>> I have a series of tables in a single file. Each table have some  
>> fields that depends on fields
>> in the previous table. Thus, if I change something in the first  
>> table, I must go down manually
>> and recalculate (or iterate) each table. Is there a way to  
>> recalculate all tables in a file simultaneously?
>>
>>
>> Hi Johan,
>>
>> This should work if the dependence is only backwards.
>>
>> (defun org-recalculate-all-tables ()
>>   (interactive)
>>   (org-table-map-tables (lambda () (org-table-recalculate t)) t))
>>
>> If you have dependencies in both directions, this might work  
>> (untested):
>>
>> (defun org-iterate-all-tables ()
>>  (interactive)
>>  (let* ((imax 10)
>>         (checksum (md5 (buffer-string)))
>>         c1
>>         (i imax))
>>    (catch 'exit
>>      (while (> i 0)
>>        (setq i (1- i))
>>        (org-table-map-tables (lambda () (org-table-recalculate t)) t)
>>        (if (equal checksum (setq c1 (md5 (buffer-string))))
>>            (progn
>>              (message "Convergence after %d iterations" (- imax i))
>>              (throw 'exit t))
>>          (setq checksum c1)))
>>      (error "No convergence after %d iterations" imax))))
>>
>> If it does, this could be added to org-hacks on Worg.
>>
>> HTH
>>
>> - Carsten
>>
>>
>>
>> _______________________________________________
>> Emacs-orgmode mailing list
>> Please use `Reply All' to send replies to the list.
>> Emacs-orgmode@gnu.org
>> http://lists.gnu.org/mailman/listinfo/emacs-orgmode
>>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

- Carsten

  reply	other threads:[~2010-05-07 13:50 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-30 14:07 Iterate many tables Johan Ekh
2010-04-30 15:03 ` Carsten Dominik
2010-05-03 20:14   ` Johan Ekh
2010-05-05 19:37   ` Johan Ekh
2010-05-06 11:34     ` T Helms
2010-05-07  7:36       ` Carsten Dominik [this message]
2010-05-14 10:07         ` Johan Ekh
2010-05-14 12:32           ` Carsten Dominik
2010-05-14 13:05             ` Johan Ekh
2010-05-14 13:43               ` Johan Ekh
2010-05-14 13:57                 ` Carsten Dominik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=B7A0FD63-FC6B-43A9-9271-076836173A6B@gmail.com \
    --to=carsten.dominik@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=maxco.tr@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).