[gnu.emacs.bug] sort-build-lists misbehaving on multi-line records

ROBERTS%UORNSRL.BITNET@MITVMA.MIT.EDU (12/03/88)

I'm having some trouble with getting sort-build-lists to work.  I want
to sort a buffer where the "records" span several lines, so I wrote a
couple of functions to use for sort-subr.  However, it never comes out
of the "Finding sort keys..." message.  Since sort-build-lists is the
next procedure called, I decided to see if it was working.  It would
seem that the problem comes up as soon as I try to do anything with a
record spanning more than one line (I haven't tested this thoroughly).

The lisp code below brings out the problem when used on the buffer (a
very contrived buffer) contents just below it.  The first one hangs,
the second runs quickly. They are *not* doing the same:  the first one
is closer to what I want since it has to find the end of the record
via a pattern matching, while the second is a simple sort-columns
equivalent.

Can someone please tell me what's going wrong?

Roland Roberts                        BITNET: roberts@uornsrl.bitnet
  Nuclear Structure Research Lab    INTERNET: rbr4@db2.cc.rochester.edu
  271 East River Road                   UUCP: rochester!ur-cc!rbr4
  Rochester, NY  14267                  AT&T: (716) 275-8962

-*-*- lisp code follows -*-*-
(setq sbl-fail
      (sort-build-lists
       (function (lambda nil (search-forward "----" nil t)
                             (beginning-of-line)))
       (function (lambda nil (search-forward "****" nil t)
                             (end-of-line)))
       (function (lambda nil (move-to-column 5) nil))
       (function (lambda nil (move-to-column 6) nil))))))

(setq sbl-okay
      (sort-build-lists 'forward-line
                        'end-of-line
                        (function (lambda nil (move-to-column 5) nil))
                        (function (lambda nil (move-to-column 6) nil))))))
-*-*- buffer starts on next line -*-*-
----
  1  Filthy Street Urchin               (p)
****
----
  2  Blubbering Idiot                   (p)
****
-*-*- buffer ends on previous line -*-*-