emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: "Štěpán Němec" <stepnem@gmail.com>
To: Jambunathan K <kjambunathan@coextrix.com>
Cc: emacs-orgmode@gnu.org, ishi soichi <soichi777@gmail.com>
Subject: Re: elisp code takes CPU too much
Date: Wed, 29 Dec 2010 09:51:32 +0100	[thread overview]
Message-ID: <87aajpotbf.fsf@gmail.com> (raw)
In-Reply-To: <81vd2fzd1l.fsf@gmail.com> (Jambunathan K.'s message of "Mon, 27 Dec 2010 16:40:46 +0530")

Jambunathan K <kjambunathan@coextrix.com> 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

  reply	other threads:[~2010-12-29  8:53 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-12-27  5:47 elisp code takes CPU too much ishi soichi
2010-12-27 11:10 ` Jambunathan K
2010-12-29  8:51   ` Štěpán Němec [this message]
2010-12-27 14:17 ` Eric Schulte

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=87aajpotbf.fsf@gmail.com \
    --to=stepnem@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=kjambunathan@coextrix.com \
    --cc=soichi777@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).