From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: synhedionn@gmail.com Newsgroups: gmane.emacs.help Subject: Re: elisp errors Date: Fri, 23 Jan 2009 12:27:18 -0800 (PST) Organization: http://groups.google.com Message-ID: <67a737d1-49d1-4e2e-8475-bf8109ea1f8f@r10g2000prf.googlegroups.com> References: <26488aad-8ff8-4dda-bda5-ce5036de3617@w39g2000prb.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1232743272 9378 80.91.229.12 (23 Jan 2009 20:41:12 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 23 Jan 2009 20:41:12 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Jan 23 21:42:23 2009 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LQSqs-0001wk-8T for geh-help-gnu-emacs@m.gmane.org; Fri, 23 Jan 2009 21:42:07 +0100 Original-Received: from localhost ([127.0.0.1]:37457 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LQSpa-00045q-D6 for geh-help-gnu-emacs@m.gmane.org; Fri, 23 Jan 2009 15:40:46 -0500 Original-Path: news.stanford.edu!newsfeed.stanford.edu!postnews.google.com!r10g2000prf.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 101 Original-NNTP-Posting-Host: 88.165.17.74 Original-X-Trace: posting.google.com 1232742438 3239 127.0.0.1 (23 Jan 2009 20:27:18 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Fri, 23 Jan 2009 20:27:18 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: r10g2000prf.googlegroups.com; posting-host=88.165.17.74; posting-account=Sx1YUQoAAAAuXI-_9m2ZZabE5DOwGMzv User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.5) Gecko/2008121622 Fedora/3.0.5-1.fc10 Firefox/3.0.5, gzip(gfe), gzip(gfe) Original-Xref: news.stanford.edu gnu.emacs.help:166270 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:61592 Archived-At: On Jan 23, 4:48=A0am, Barry Margolin wrote: > In article > <26488aad-8ff8-4dda-bda5-ce5036de3...@w39g2000prb.googlegroups.com>, > > > > =A0synhedi...@gmail.com wrote: > > hi, > > I try to evaluate, for doing indentation of poub.y(so C-mode): > > (defun indentTabs() > > =A0(interactive) > > =A0 ( =A0 save-excursion ; cf > >http://www.cs.tut.fi/lintula/manual/elisp/emacs-lisp-intro-1.05/emacs... > > ro_13.html#SEC145 > > restores point to its original position > > =A0 =A0 ( =A0 message "coucou" =A0 ) > > =A0 =A0 (goto-char (point-min)) > > (let =A0((cpt 100)) =A0 =A0;double parenthese obligee > > =A0 =A0 (while (> cpt 0) > > =A0 =A0 =A0 ( > > =A0 =A0 ((c-indent-command)); =A0 widget-forward =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 ;TAB > > =A0 =A0 =A0 ( move-beginning-of-line 0) > > =A0 =A0 =A0( =A0next-line 1) > > > =A0 =A0(setq cpt =A0 (1- cpt)) ; =A0(1- cpt)) > > ; ( message "cpt=3D%d"( 3 ) =A0);!! parentheses autour cpt > > =A0 =A0 =A0 ( =A0 message "fin partielle" =A0 ) > > =A0 =A0 =A0 =A0 =A0)) ) =A0) ) > > > I do C-x C-e at end of command > > Then , in my poub.y : M-x indentTabs > > But error: Invalid read syntax: expected lambda expression (((c-indent- > > command)); =A0 widget-forward =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0;TAB =A0 =A0) > > What does it mean(evaluate by own your correction suggestion, please)? > > You have too many parentheses around the body of your while loop, and > then another extra set around the call to c-indent-command. =A0It should > be: > > (while (> cpt 0) > =A0 (c-indent-command) > =A0 (move-beginning-of-line 0) > =A0 (next-line 1) > =A0 (setq cpt (1- cpt)) > =A0 (message "fin partielle")) > > This can also be simplified as: > > (dotimes (i 100) > =A0 (c-indent-command) > =A0 (move-beginning-of-line 0) > =A0 (next-line 1) > =A0 (message "fin partielle")) > > Also, do you really want to write that message every time through the > loop instead of at the very end? > > -- > Barry Margolin, bar...@alum.mit.edu > Arlington, MA > *** PLEASE post questions in newsgroups, not directly to me *** > *** PLEASE don't copy me on replies, I'll read them in the group *** Yes , only 1 message is enough. Cool tourdotimes, I didn't know. So accordingly to your advice: (defun indentTabs() (interactive) ( save-excursion ; cf http://www.cs.tut.fi/lintula/manual/elisp/emacs-lisp-intro-1.05/emacs-lisp-= intro_13.html#SEC145 restores point to its original position ( message "coucou" ) (goto-char (point-min)) (dotimes (i 100) (c-indent-command) (move-beginning-of-line 0) (next-line 1) )(message "fin partielle") )) But debbuger displays still an error on c-indent-command: Debugger entered--Lisp error: (void-function c-indent-command) (c-indent-command) (while (< i --dotimes-limit--) (c-indent-command) (move-beginning-of- line 0) (next-line 1) (message "fin partielle") (setq i (1+ i))) (let ((--dotimes-limit-- 100) (i 0)) (while (< i --dotimes-limit--) (c-indent-command) (move-beginning-of-line 0) (next-line 1) (message "fin partielle") (setq i ...))) (dotimes (i 100) (c-indent-command) (move-beginning-of-line 0) (next- line 1) (message "fin partielle")) eval((dotimes (i 100) (c-indent-command) (move-beginning-of-line 0) (next-line 1) (message "fin partielle"))) eval-last-sexp-1(nil) eval-last-sexp(nil) call-interactively(eval-last-sexp) : What is false with this command?