home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!olivea!apple!cambridge.apple.com!lynch@ils.nwu.edu
- From: lynch@ils.nwu.edu
- Newsgroups: comp.lang.lisp.mcl
- Subject: Re: Buffer bug?
- Message-ID: <9207211422.AA07301@aristotle.ils.nwu.edu>
- Date: 21 Jul 92 14:22:06 GMT
- Sender: info-mcl-request@cambridge.apple.com
- Lines: 54
- Approved: comp.lang.lisp.mcl@Cambridge.Apple.C0M
- Original-To: info-macl@cambridge.apple.com
-
- > ?
- > Buffer #<BUFFER-MARK 0/119> has 119 chars, which are:
- ^^^
- > 'This )) is (people person 1) bad too.
- > ;This (( is a ) bad ( string, no?
- > ;This is a nice string (people person 1), yes?
- > '.
- > ((IS A) (PEOPLE PERSON 1)) ;correct result
- > ?
- >|#
- >
- >
- >;;;
- >;;; Test2: Evaluate following form:
- >;;;
- >#|
- >(let ((buffer (make-buffer)))
- > (buffer-insert buffer "This )) is (people person 1) bad too.
- >;This (( is a ) bad ( string, no?
- >;This is a nice string (people person 1), yes?
- >")
- > (l-lists-in-buffer buffer))
- >|#
- >;;;
- >;;; The result this time was different and *wrong* IMHO:
- >;;;
- >#|
- >?
- > Buffer #<BUFFER-MARK 119/119> has 119 chars, which are:
- ^^^
- > 'This )) is (people person 1) bad too.
- > ;This (( is a ) bad ( string, no?
- > ;This is a nice string (people person 1), yes?
- > '.
- > NIL ;*wrong* result!
- > ?
- >|#
-
- buffer-insert apparently destructively modifies its buffer argument to be
- at the end of the insert. [Note the difference in the print-string of the
- buffer mark in the two tests.] While you explicitly use the number 0 and
- the buffer size to get all the text in your call to buffer-substring, you
- do not do so in your call to buffer-current-sexp.
-
- If you make a new buffer mark at 0 and use *that* in your iteration, you
- will almost certainly get the desired results.
-
- Whether buffer-insert *should* or should not modify its buffer argument is
- something you will have to take up with the MCL team. IMHO, it could be
- quite useful information to have returned in the modified buffer-mark.
-
- Disclaimer: I'm making this answer up based just on output and looking at
- your code and have little actual experience with buffers and buffer-insert.
- "TANSTAAFL" Rich lynch@ils.nwu.edu
-