home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #16 / NN_1992_16.iso / spool / comp / lang / lisp / mcl / 1053 < prev    next >
Encoding:
Internet Message Format  |  1992-07-21  |  2.2 KB

  1. Path: sparky!uunet!olivea!apple!cambridge.apple.com!lynch@ils.nwu.edu
  2. From: lynch@ils.nwu.edu
  3. Newsgroups: comp.lang.lisp.mcl
  4. Subject: Re: Buffer bug?
  5. Message-ID: <9207211422.AA07301@aristotle.ils.nwu.edu>
  6. Date: 21 Jul 92 14:22:06 GMT
  7. Sender: info-mcl-request@cambridge.apple.com
  8. Lines: 54
  9. Approved: comp.lang.lisp.mcl@Cambridge.Apple.C0M
  10. Original-To: info-macl@cambridge.apple.com
  11.  
  12. >    ? 
  13. >    Buffer #<BUFFER-MARK 0/119> has 119 chars, which are: 
  14.                          ^^^
  15. >    'This )) is (people person 1) bad too.
  16. >    ;This (( is a ) bad ( string, no?
  17. >    ;This is a nice string (people person 1), yes?
  18. >    '.
  19. >    ((IS A) (PEOPLE PERSON 1))          ;correct result
  20. >    ? 
  21. >|#
  22. >
  23. >
  24. >;;;
  25. >;;; Test2: Evaluate following form:
  26. >;;;
  27. >#|
  28. >(let ((buffer (make-buffer)))
  29. >  (buffer-insert buffer "This )) is (people person 1) bad too.
  30. >;This (( is a ) bad ( string, no?
  31. >;This is a nice string (people person 1), yes?
  32. >")
  33. >  (l-lists-in-buffer buffer))
  34. >|#
  35. >;;;
  36. >;;; The result this time was different and *wrong* IMHO:
  37. >;;;
  38. >#|
  39. >? 
  40. >    Buffer #<BUFFER-MARK 119/119> has 119 chars, which are: 
  41.                           ^^^
  42. >    'This )) is (people person 1) bad too.
  43. >    ;This (( is a ) bad ( string, no?
  44. >    ;This is a nice string (people person 1), yes?
  45. >    '.
  46. >    NIL                                 ;*wrong* result!
  47. >    ? 
  48. >|#
  49.  
  50. buffer-insert apparently destructively modifies its buffer argument to be
  51. at the end of the insert.  [Note the difference in the print-string of the
  52. buffer mark in the two tests.]  While you explicitly use the number 0 and
  53. the buffer size to get all the text in your call to buffer-substring, you
  54. do not do so in your call to buffer-current-sexp.
  55.  
  56. If you make a new buffer mark at 0 and use *that* in your iteration, you
  57. will almost certainly get the desired results.
  58.  
  59. Whether buffer-insert *should* or should not modify its buffer argument is
  60. something you will have to take up with the MCL team.  IMHO, it could be
  61. quite useful information to have returned in the modified buffer-mark.
  62.  
  63. Disclaimer:  I'm making this answer up based just on output and looking at
  64. your code and have little actual experience with buffers and buffer-insert.
  65. "TANSTAAFL" Rich lynch@ils.nwu.edu
  66.