From mboxrd@z Thu Jan 1 00:00:00 1970 From: ishi soichi Subject: elisp code takes CPU too much Date: Mon, 27 Dec 2010 14:47:30 +0900 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1997169310==" Return-path: Received: from [140.186.70.92] (port=48188 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PX5vh-0000K6-3y for emacs-orgmode@gnu.org; Mon, 27 Dec 2010 00:47:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PX5vf-0003mn-Re for emacs-orgmode@gnu.org; Mon, 27 Dec 2010 00:47:32 -0500 Received: from mail-pw0-f41.google.com ([209.85.160.41]:53350) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PX5vf-0003mi-KI for emacs-orgmode@gnu.org; Mon, 27 Dec 2010 00:47:31 -0500 Received: by pwj8 with SMTP id 8so1192751pwj.0 for ; Sun, 26 Dec 2010 21:47:30 -0800 (PST) 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: emacs-orgmode@gnu.org --===============1997169310== Content-Type: multipart/alternative; boundary=001636e0b9612d2ae504985ddffb --001636e0b9612d2ae504985ddffb Content-Type: text/plain; charset=ISO-8859-1 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. Could anyone help me for fixing it? soichi P.S. the code follows, and there is "word" in the table so that "search" command looks for it. ;;--------------------------------------------- (require 'org-table) (setq alist (list "apple" "orange" "lemon" "baseball" "football")) (defun test-table (word-list) "test to see if org-table-put works well" (find-file-noselect (concat "~/Dropbox/language/word.org")) (set-buffer "word.org") (save-excursion (goto-char (point-min)) (search-forward "word") (goto-char (match-beginning 0)) (let ((i 1)) (while word-list (org-table-put i 3 (nth (- i 1) word-list) t) (setq i (1+ i)))))) (test-table alist) ;;execute it here --001636e0b9612d2ae504985ddffb Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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. =A0I do not believe that this little code requires such a work= -load for the computer. =A0There must be my wrong-doing.

Could anyone help me for fixing it?

soichi=A0

P.S. the code follows, and there i= s "word" in the table so that "search" command looks fo= r it.
;;---------------------------------------------
(requir= e 'org-table)
(setq alist (list "apple" "orang= e" "lemon" "baseball" "football"))
(defun test-table (word-list)
=A0=A0"test to see if org= -table-put works well"
=A0=A0(find-file-noselect (concat &qu= ot;~/Dropbox/language/word.org"))
=A0=A0(set-buffer "word.org")
=A0=A0(save-excursion
=A0=A0 =A0(goto-char (point-min))
=A0=A0 =A0(search-forward "word")
=A0=A0 =A0(go= to-char (match-beginning 0))
=A0=A0 =A0(let ((i 1))
=A0=A0 =A0 =A0(while word-list
<= div> (org-t= able-put i 3 (nth (- i 1) word-list) t)
(setq i (1+ i))))))
=A0=A0 =A0 =A0
(test-table alist) ;;execute it here

--001636e0b9612d2ae504985ddffb-- --===============1997169310== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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 --===============1997169310==--