From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?utf-8?B?xaB0xJtww6FuIE7Em21lYw==?= Subject: Re: elisp code takes CPU too much Date: Wed, 29 Dec 2010 09:51:32 +0100 Message-ID: <87aajpotbf.fsf@gmail.com> References: <81vd2fzd1l.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from [140.186.70.92] (port=39070 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PXrn6-0006sq-H5 for emacs-orgmode@gnu.org; Wed, 29 Dec 2010 03:53:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PXrn5-0000T9-EH for emacs-orgmode@gnu.org; Wed, 29 Dec 2010 03:53:52 -0500 Received: from mail-fx0-f41.google.com ([209.85.161.41]:43275) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PXrn5-0000T0-95 for emacs-orgmode@gnu.org; Wed, 29 Dec 2010 03:53:51 -0500 Received: by fxm12 with SMTP id 12so3677783fxm.0 for ; Wed, 29 Dec 2010 00:53:49 -0800 (PST) In-Reply-To: <81vd2fzd1l.fsf@gmail.com> (Jambunathan K.'s message of "Mon, 27 Dec 2010 16:40:46 +0530") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Jambunathan K Cc: emacs-orgmode@gnu.org, ishi soichi Jambunathan K 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. =C2=A0I do not believe that this little >> code requires such a work-load for the computer. =C2=A0There 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)=20 > (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'. =C5=A0t=C4=9Bp=C3=A1n