changeset 20547:07053199a368

(scan_newline): Always restore prev value of immediate_quit.
author Richard M. Stallman <rms@gnu.org>
date Thu, 01 Jan 1998 06:35:47 +0000
parents a475efff810e
children e9733cb049d9
files src/search.c
diffstat 1 files changed, 8 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/search.c	Thu Jan 01 06:31:54 1998 +0000
+++ b/src/search.c	Thu Jan 01 06:35:47 1998 +0000
@@ -670,7 +670,7 @@
    the limit we bumped up against.
 
    If ALLOW_QUIT is non-zero, set immediate_quit.  That's good to do
-   except when inside redisplay.  */
+   except in special cases.  */
 
 int
 scan_newline (start, start_byte, limit, limit_byte, count, allow_quit)
@@ -687,6 +687,8 @@
   register int ceiling;
   register unsigned char *ceiling_addr;
 
+  int old_immediate_quit = immediate_quit;
+
   /* If we are not in selective display mode,
      check only for newlines.  */
   int selective_display = (!NILP (current_buffer->selective_display)
@@ -695,7 +697,8 @@
   /* The code that follows is like scan_buffer
      but checks for either newline or carriage return.  */
 
-  immediate_quit = allow_quit;
+  if (allow_quit)
+    immediate_quit++;
 
   start_byte = CHAR_TO_BYTE (start);
 
@@ -716,7 +719,7 @@
 		{
 		  if (--count == 0)
 		    {
-		      immediate_quit = 0;
+		      immediate_quit = old_immediate_quit;
 		      start_byte = start_byte + cursor - base + 1;
 		      start = BYTE_TO_CHAR (start_byte);
 		      TEMP_SET_PT_BOTH (start, start_byte);
@@ -750,7 +753,7 @@
 		{
 		  if (++count == 0)
 		    {
-		      immediate_quit = 0;
+		      immediate_quit = old_immediate_quit;
 		      /* Return the position AFTER the match we found.  */
 		      start_byte = start_byte + cursor - base + 1;
 		      start = BYTE_TO_CHAR (start_byte);
@@ -768,6 +771,7 @@
     }
 
   TEMP_SET_PT_BOTH (limit, limit_byte);
+  immediate_quit = old_immediate_quit;
 
   return count * direction;
 }