comparison src/fns.c @ 53681:206ba2723812

(Fmd5): If OBJECT is a buffer different from the current one, set buffer to OBJECT temporarily.
author Kenichi Handa <handa@m17n.org>
date Fri, 23 Jan 2004 00:11:43 +0000
parents 6658b72a5f99
children 2b23252ecc55
comparison
equal deleted inserted replaced
53680:6b1881ea9daf 53681:206ba2723812
5452 args_out_of_range_3 (object, make_number (start_char), 5452 args_out_of_range_3 (object, make_number (start_char),
5453 make_number (end_char)); 5453 make_number (end_char));
5454 } 5454 }
5455 else 5455 else
5456 { 5456 {
5457 struct buffer *prev = current_buffer;
5458
5459 record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
5460
5457 CHECK_BUFFER (object); 5461 CHECK_BUFFER (object);
5458 5462
5459 bp = XBUFFER (object); 5463 bp = XBUFFER (object);
5464 if (bp != current_buffer)
5465 set_buffer_internal (bp);
5460 5466
5461 if (NILP (start)) 5467 if (NILP (start))
5462 b = BUF_BEGV (bp); 5468 b = BEGV;
5463 else 5469 else
5464 { 5470 {
5465 CHECK_NUMBER_COERCE_MARKER (start); 5471 CHECK_NUMBER_COERCE_MARKER (start);
5466 b = XINT (start); 5472 b = XINT (start);
5467 } 5473 }
5468 5474
5469 if (NILP (end)) 5475 if (NILP (end))
5470 e = BUF_ZV (bp); 5476 e = ZV;
5471 else 5477 else
5472 { 5478 {
5473 CHECK_NUMBER_COERCE_MARKER (end); 5479 CHECK_NUMBER_COERCE_MARKER (end);
5474 e = XINT (end); 5480 e = XINT (end);
5475 } 5481 }
5476 5482
5477 if (b > e) 5483 if (b > e)
5478 temp = b, b = e, e = temp; 5484 temp = b, b = e, e = temp;
5479 5485
5480 if (!(BUF_BEGV (bp) <= b && e <= BUF_ZV (bp))) 5486 if (!(BEGV <= b && e <= ZV))
5481 args_out_of_range (start, end); 5487 args_out_of_range (start, end);
5482 5488
5483 if (NILP (coding_system)) 5489 if (NILP (coding_system))
5484 { 5490 {
5485 /* Decide the coding-system to encode the data with. 5491 /* Decide the coding-system to encode the data with.
5542 Fsignal (Qcoding_system_error, Fcons (coding_system, Qnil)); 5548 Fsignal (Qcoding_system_error, Fcons (coding_system, Qnil));
5543 } 5549 }
5544 } 5550 }
5545 5551
5546 object = make_buffer_string (b, e, 0); 5552 object = make_buffer_string (b, e, 0);
5553 if (prev != current_buffer)
5554 set_buffer_internal (prev);
5555 /* Discard the unwind protect for recovering the current
5556 buffer. */
5557 specpdl_ptr--;
5547 5558
5548 if (STRING_MULTIBYTE (object)) 5559 if (STRING_MULTIBYTE (object))
5549 object = code_convert_string1 (object, coding_system, Qnil, 1); 5560 object = code_convert_string1 (object, coding_system, Qnil, 1);
5550 } 5561 }
5551 5562