Mercurial > emacs
comparison src/search.c @ 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 | c20c92ff4055 |
children | 138c95482e6b |
comparison
equal
deleted
inserted
replaced
20546:a475efff810e | 20547:07053199a368 |
---|---|
668 buffer (or the beginning, if scanning backwards), we return | 668 buffer (or the beginning, if scanning backwards), we return |
669 the number of line boundaries left unfound, and position at | 669 the number of line boundaries left unfound, and position at |
670 the limit we bumped up against. | 670 the limit we bumped up against. |
671 | 671 |
672 If ALLOW_QUIT is non-zero, set immediate_quit. That's good to do | 672 If ALLOW_QUIT is non-zero, set immediate_quit. That's good to do |
673 except when inside redisplay. */ | 673 except in special cases. */ |
674 | 674 |
675 int | 675 int |
676 scan_newline (start, start_byte, limit, limit_byte, count, allow_quit) | 676 scan_newline (start, start_byte, limit, limit_byte, count, allow_quit) |
677 int start, start_byte; | 677 int start, start_byte; |
678 int limit, limit_byte; | 678 int limit, limit_byte; |
685 unsigned char *base; | 685 unsigned char *base; |
686 | 686 |
687 register int ceiling; | 687 register int ceiling; |
688 register unsigned char *ceiling_addr; | 688 register unsigned char *ceiling_addr; |
689 | 689 |
690 int old_immediate_quit = immediate_quit; | |
691 | |
690 /* If we are not in selective display mode, | 692 /* If we are not in selective display mode, |
691 check only for newlines. */ | 693 check only for newlines. */ |
692 int selective_display = (!NILP (current_buffer->selective_display) | 694 int selective_display = (!NILP (current_buffer->selective_display) |
693 && !INTEGERP (current_buffer->selective_display)); | 695 && !INTEGERP (current_buffer->selective_display)); |
694 | 696 |
695 /* The code that follows is like scan_buffer | 697 /* The code that follows is like scan_buffer |
696 but checks for either newline or carriage return. */ | 698 but checks for either newline or carriage return. */ |
697 | 699 |
698 immediate_quit = allow_quit; | 700 if (allow_quit) |
701 immediate_quit++; | |
699 | 702 |
700 start_byte = CHAR_TO_BYTE (start); | 703 start_byte = CHAR_TO_BYTE (start); |
701 | 704 |
702 if (count > 0) | 705 if (count > 0) |
703 { | 706 { |
714 | 717 |
715 if (cursor != ceiling_addr) | 718 if (cursor != ceiling_addr) |
716 { | 719 { |
717 if (--count == 0) | 720 if (--count == 0) |
718 { | 721 { |
719 immediate_quit = 0; | 722 immediate_quit = old_immediate_quit; |
720 start_byte = start_byte + cursor - base + 1; | 723 start_byte = start_byte + cursor - base + 1; |
721 start = BYTE_TO_CHAR (start_byte); | 724 start = BYTE_TO_CHAR (start_byte); |
722 TEMP_SET_PT_BOTH (start, start_byte); | 725 TEMP_SET_PT_BOTH (start, start_byte); |
723 return 0; | 726 return 0; |
724 } | 727 } |
748 | 751 |
749 if (cursor != ceiling_addr) | 752 if (cursor != ceiling_addr) |
750 { | 753 { |
751 if (++count == 0) | 754 if (++count == 0) |
752 { | 755 { |
753 immediate_quit = 0; | 756 immediate_quit = old_immediate_quit; |
754 /* Return the position AFTER the match we found. */ | 757 /* Return the position AFTER the match we found. */ |
755 start_byte = start_byte + cursor - base + 1; | 758 start_byte = start_byte + cursor - base + 1; |
756 start = BYTE_TO_CHAR (start_byte); | 759 start = BYTE_TO_CHAR (start_byte); |
757 TEMP_SET_PT_BOTH (start, start_byte); | 760 TEMP_SET_PT_BOTH (start, start_byte); |
758 return 0; | 761 return 0; |
766 start_byte += cursor - base + 1; | 769 start_byte += cursor - base + 1; |
767 } | 770 } |
768 } | 771 } |
769 | 772 |
770 TEMP_SET_PT_BOTH (limit, limit_byte); | 773 TEMP_SET_PT_BOTH (limit, limit_byte); |
774 immediate_quit = old_immediate_quit; | |
771 | 775 |
772 return count * direction; | 776 return count * direction; |
773 } | 777 } |
774 | 778 |
775 int | 779 int |