520 |
/* Make the gap NBYTES_ADDED bytes longer. */ |
/* Make the gap NBYTES_ADDED bytes longer. */ |
521 |
|
|
522 |
void |
void |
523 |
make_gap (nbytes_added) |
make_gap_larger (nbytes_added) |
524 |
int nbytes_added; |
int nbytes_added; |
525 |
{ |
{ |
526 |
Lisp_Object tem; |
Lisp_Object tem; |
568 |
|
|
569 |
Vinhibit_quit = tem; |
Vinhibit_quit = tem; |
570 |
} |
} |
571 |
|
|
572 |
|
|
573 |
|
/* Make the gap NBYTES_REMOVED bytes shorted. */ |
574 |
|
|
575 |
|
void |
576 |
|
make_gap_smaller (nbytes_removed) |
577 |
|
int nbytes_removed; |
578 |
|
{ |
579 |
|
Lisp_Object tem; |
580 |
|
int real_gap_loc; |
581 |
|
int real_gap_loc_byte; |
582 |
|
int real_Z; |
583 |
|
int real_Z_byte; |
584 |
|
int old_gap_size; |
585 |
|
|
586 |
|
/* Make sure the gap is at least 20 bytes. */ |
587 |
|
if (GAP_SIZE - nbytes_removed < 20) |
588 |
|
nbytes_removed = GAP_SIZE - 20; |
589 |
|
|
590 |
|
/* Prevent quitting in move_gap. */ |
591 |
|
tem = Vinhibit_quit; |
592 |
|
Vinhibit_quit = Qt; |
593 |
|
|
594 |
|
real_gap_loc = GPT; |
595 |
|
real_gap_loc_byte = GPT_BYTE; |
596 |
|
old_gap_size = GAP_SIZE; |
597 |
|
real_Z = Z; |
598 |
|
real_Z_byte = Z_BYTE; |
599 |
|
|
600 |
|
/* Pretend that the last unwanted part of the gap is the entire gap, |
601 |
|
and that the first desired part of the gap is part of the buffer |
602 |
|
text. */ |
603 |
|
bzero (GPT_ADDR, GAP_SIZE - nbytes_removed); |
604 |
|
GPT += GAP_SIZE - nbytes_removed; |
605 |
|
GPT_BYTE += GAP_SIZE - nbytes_removed; |
606 |
|
Z += GAP_SIZE - nbytes_removed; |
607 |
|
Z_BYTE += GAP_SIZE - nbytes_removed; |
608 |
|
GAP_SIZE = nbytes_removed; |
609 |
|
|
610 |
|
/* Move the unwanted pretend gap to the end of the buffer. This |
611 |
|
adjusts the markers properly too. */ |
612 |
|
gap_right (Z, Z_BYTE); |
613 |
|
|
614 |
|
enlarge_buffer_text (current_buffer, -nbytes_removed); |
615 |
|
|
616 |
|
/* Now restore the desired gap. */ |
617 |
|
GAP_SIZE = old_gap_size - nbytes_removed; |
618 |
|
GPT = real_gap_loc; |
619 |
|
GPT_BYTE = real_gap_loc_byte; |
620 |
|
Z = real_Z; |
621 |
|
Z_BYTE = real_Z_byte; |
622 |
|
|
623 |
|
/* Put an anchor. */ |
624 |
|
*(Z_ADDR) = 0; |
625 |
|
|
626 |
|
Vinhibit_quit = tem; |
627 |
|
} |
628 |
|
|
629 |
|
void |
630 |
|
make_gap (nbytes_added) |
631 |
|
int nbytes_added; |
632 |
|
{ |
633 |
|
if (nbytes_added >= 0) |
634 |
|
make_gap_larger (nbytes_added); |
635 |
|
#if defined (USE_MMAP_FOR_BUFFERS) || defined (REL_ALLOC) |
636 |
|
else |
637 |
|
make_gap_smaller (-nbytes_added); |
638 |
|
#endif |
639 |
|
} |
640 |
|
|
641 |
/* Copy NBYTES bytes of text from FROM_ADDR to TO_ADDR. |
/* Copy NBYTES bytes of text from FROM_ADDR to TO_ADDR. |
642 |
FROM_MULTIBYTE says whether the incoming text is multibyte. |
FROM_MULTIBYTE says whether the incoming text is multibyte. |