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

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

looping through re-seach-forward gives error


From: jenia.ivlev
Subject: looping through re-seach-forward gives error
Date: Sun, 20 Mar 2016 17:48:58 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

This program aims to restore the guile REPL session dump (see input file).

When I added the while loop, ELISP stated giving me this error when the
end of the file is reacher:

`Scan error: "Containg expression end prematurely", 715, 716`

Can someone please tell me what the problem is?

This is the program:

PROGRAM
=======
    (defun retore-guile-session()
      (interactive)
      (save-excursion 
      (while (progn (re-search-forward "scheme@(guile-user)" (point-max) t))
         (append-to-buffer "scratch" (find-start-of-sexp)
                                     (find-end-of-sexp)))))
    
    
    
    (defun find-start-of-sexp ()
    
       (re-search-forward "(" (point-max) t)
       (backward-char) 
       (point-marker))
    
    
    (defun find-end-of-sexp ()
      (forward-sexp)
      (point-marker))

And this is the input file?

INPUT FILE (to use it just visit it and run the program)
==========

    GNU Guile 2.0.11
    Copyright (C) 1995-2014 Free Software Foundation, Inc.
    
    Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
    This program is free software, and you are welcome to redistribute it
    under certain conditions; type `,show c' for details.
    
    Enter `,help' for help.
    scheme@(guile-user)> 
    scheme@(guile-user)> 
    scheme@(guile-user)> 
    scheme@(guile-user)> (+ 1 2)
    $2 = 3
    scheme@(guile-user)> 
    scheme@(guile-user)> 
    scheme@(guile-user)> (+1 2)
    ERROR: In procedure 1:
    ERROR: Wrong type to apply: 1
    
    Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.
    scheme@(guile-user) [1]> 
    scheme@(guile-user) [1]> 
    scheme@(guile-user) [1]> (+ 1 2 (*
                                 2 3))
    $3 = 9
    scheme@(guile-user) [1]> 


Can someone please tell me, why is ELSIP giving me error `Scan error:
"Containg expression end prematurely", 715, 716` when the while loop
reaches the end of the file?

Thanks in advance




reply via email to

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