[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Orgmode] Re: elisp code takes CPU too much
From: |
Štěpán Němec |
Subject: |
[Orgmode] Re: elisp code takes CPU too much |
Date: |
Wed, 29 Dec 2010 09:51:32 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
Jambunathan K <address@hidden> writes:
>> hi. I have wrote an elisp code for org-mode, which puts entries in a
>> table. It is a simple code in my opinion and it does the job I
>> intended. But when executed, the activation of CPU shoots up and it
>> will take a while to complete it. I do not believe that this little
>> code requires such a work-load for the computer. There must be my
>> wrong-doing.
>
> You have an infinite loop. The predicate of the while loop would always
> evaluate to 'true' and never become 'false'.
>
>> Could anyone help me for fixing it?
>
> Try the following snippet with suitable variations.
>
> (setq word-list (list "apple" "orange" "lemon" "baseball" "football"))
>
> (defun test-table (word-list)
> (let ((line 0) (column 3))
> (mapcar (lambda (word)
> (org-table-put i column word t))
> word-list)))
Unless you're going to do something with the list returned by this
function (seems unlikely given that `org-table-put' doesn't seem to
return anything useful), you should use `mapc' or `dolist' instead of
`mapcar'.
Štěpán