unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: jenia.ivlev@gmail.com (jenia.ivlev)
To: help-gnu-emacs@gnu.org
Subject: looping through re-seach-forward gives error
Date: Sun, 20 Mar 2016 17:48:58 -0400	[thread overview]
Message-ID: <87pouoom5x.fsf@gmail.com> (raw)

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	other threads:[~2016-03-20 21:48 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-20 21:48 jenia.ivlev [this message]
2016-03-20 22:13 ` looping through re-seach-forward gives error Drew Adams
2016-03-20 22:21   ` Michael Heerdegen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87pouoom5x.fsf@gmail.com \
    --to=jenia.ivlev@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).