comparison src/fileio.c @ 18679:554594d88cd3

(Finsert_file_contents): Give up match-end only if coding requires conversion. Adjust end of non-matching text area to multibyte character boundary if enable_multibyte_character is non-nil.
author Richard M. Stallman <rms@gnu.org>
date Tue, 08 Jul 1997 11:37:32 +0000
parents 72b27986e71d
children 1718bdf566fd
comparison
equal deleted inserted replaced
18678:d26f9720e55f 18679:554594d88cd3
3289 { 3289 {
3290 /* If this discrepancy is because of code conversion, 3290 /* If this discrepancy is because of code conversion,
3291 we cannot use this method; giveup and try the other. */ 3291 we cannot use this method; giveup and try the other. */
3292 if (same_at_end > same_at_start 3292 if (same_at_end > same_at_start
3293 && FETCH_BYTE (same_at_end - 1) >= 0200 3293 && FETCH_BYTE (same_at_end - 1) >= 0200
3294 && ! NILP (current_buffer->enable_multibyte_characters)) 3294 && ! NILP (current_buffer->enable_multibyte_characters)
3295 && CODING_REQUIRE_CONVERSION (&coding))
3295 giveup_match_end = 1; 3296 giveup_match_end = 1;
3296 break; 3297 break;
3297 } 3298 }
3298 } 3299 }
3299 immediate_quit = 0; 3300 immediate_quit = 0;
3300 3301
3301 if (! giveup_match_end) 3302 if (! giveup_match_end)
3302 { 3303 {
3303 /* We win! We can handle REPLACE the optimized way. */ 3304 /* We win! We can handle REPLACE the optimized way. */
3305
3306 /* Extends the end of non-matching text area to multibyte
3307 character boundary. */
3308 if (! NILP (current_buffer->enable_multibyte_characters))
3309 while (same_at_end < ZV && ! CHAR_HEAD_P (POS_ADDR (same_at_end)))
3310 same_at_end++;
3304 3311
3305 /* Don't try to reuse the same piece of text twice. */ 3312 /* Don't try to reuse the same piece of text twice. */
3306 overlap = same_at_start - BEGV - (same_at_end + st.st_size - ZV); 3313 overlap = same_at_start - BEGV - (same_at_end + st.st_size - ZV);
3307 if (overlap > 0) 3314 if (overlap > 0)
3308 same_at_end += overlap; 3315 same_at_end += overlap;