From: David Kastrup Date: Tue, 29 Jun 2004 02:37:52 +0000 (+0000) Subject: (Fset_match_data): Allow buffer before end of list X-Git-Tag: ttn-vms-21-2-B4~5608 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=c3762cbd4b8d9569291a20465315a024881eb17c;p=emacs.git (Fset_match_data): Allow buffer before end of list which can happen if set-match-data is using a pre-consed list. --- diff --git a/src/ChangeLog b/src/ChangeLog index 144e4890e8e..7de0eb69cd3 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2004-06-29 David Kastrup + + * search.c (Fset_match_data): Allow buffer before end of list + which can happen if set-match-data is using a pre-consed list. + 2004-06-28 Steven Tamm * macterm.c (XTread_socket): Correctly set the frame position diff --git a/src/search.c b/src/search.c index dc1ca91e38f..bd187181ecf 100644 --- a/src/search.c +++ b/src/search.c @@ -2808,9 +2808,16 @@ LIST should have been created by calling `match-data' previously. */) search_regs.num_regs = length; } - for (i = 0; i < length; i++) + for (i = 0;; i++) { marker = Fcar (list); + if (BUFFERP(marker)) + { + XSETBUFFER(last_thing_searched, marker); + break; + } + if (i >= length) + break; if (NILP (marker)) { search_regs.start[i] = -1; @@ -2847,10 +2854,6 @@ LIST should have been created by calling `match-data' previously. */) search_regs.start[i] = -1; } - if (CONSP(list) && BUFFERP(XCAR(list))) { - XSETBUFFER(last_thing_searched, XCAR(list)); - } - return Qnil; }