help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: elisp errors


From: synhedionn
Subject: Re: elisp errors
Date: Fri, 23 Jan 2009 12:27:18 -0800 (PST)
User-agent: G2/1.0

On Jan 23, 4:48 am, Barry Margolin <address@hidden> wrote:
> In article
> <address@hidden>,
>
>
>
> address@hidden wrote:
> > hi,
> > I try to evaluate, for doing indentation of poub.y(so C-mode):
> > (defun indentTabs()
> >  (interactive)
> >   (   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
> >     (   message "coucou"   )
> >     (goto-char (point-min))
> > (let  ((cpt 100))    ;double parenthese obligee
> >     (while (> cpt 0)
> >       (
> >     ((c-indent-command));   widget-forward                 ;TAB
> >       ( move-beginning-of-line 0)
> >      (  next-line 1)
>
> >    (setq cpt   (1- cpt)) ;  (1- cpt))
> > ; ( message "cpt=%d"( 3 )  );!! parentheses autour cpt
> >       (   message "fin partielle"   )
> >          )) )  ) )
>
> > 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));   widget-forward                        ;TAB    )
> > 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.  It should
> be:
>
> (while (> cpt 0)
>   (c-indent-command)
>   (move-beginning-of-line 0)
>   (next-line 1)
>   (setq cpt (1- cpt))
>   (message "fin partielle"))
>
> This can also be simplified as:
>
> (dotimes (i 100)
>   (c-indent-command)
>   (move-beginning-of-line 0)
>   (next-line 1)
>   (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, address@hidden
> 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?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]