comparison src/fileio.c @ 82357:70180028ad92

(Finsert_file_contents): Yet Another Int/Lisp_Object Mixup.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Mon, 13 Aug 2007 04:06:31 +0000
parents b9c61edbe743
children e5a68f18fcb9
comparison
equal deleted inserted replaced
82356:5efb11ce173c 82357:70180028ad92
4736 4736
4737 TEMP_SET_PT_BOTH (BEGV, BEGV_BYTE); 4737 TEMP_SET_PT_BOTH (BEGV, BEGV_BYTE);
4738 insval = call3 (Qformat_decode, 4738 insval = call3 (Qformat_decode,
4739 Qnil, make_number (oinserted), visit); 4739 Qnil, make_number (oinserted), visit);
4740 CHECK_NUMBER (insval); 4740 CHECK_NUMBER (insval);
4741 if (insval = oinserted) 4741 if (XINT (insval) == oinserted)
4742 SET_PT_BOTH (opoint, opoint_byte); 4742 SET_PT_BOTH (opoint, opoint_byte);
4743 inserted = XFASTINT (insval); 4743 inserted = XFASTINT (insval);
4744 } 4744 }
4745 4745
4746 /* For consistency with format-decode call these now iff inserted > 0 4746 /* For consistency with format-decode call these now iff inserted > 0
4767 TEMP_SET_PT_BOTH (BEGV, BEGV_BYTE); 4767 TEMP_SET_PT_BOTH (BEGV, BEGV_BYTE);
4768 insval = call1 (XCAR (p), make_number (oinserted)); 4768 insval = call1 (XCAR (p), make_number (oinserted));
4769 if (!NILP (insval)) 4769 if (!NILP (insval))
4770 { 4770 {
4771 CHECK_NUMBER (insval); 4771 CHECK_NUMBER (insval);
4772 if (insval = oinserted) 4772 if (XINT (insval) == oinserted)
4773 SET_PT_BOTH (opoint, opoint_byte); 4773 SET_PT_BOTH (opoint, opoint_byte);
4774 inserted = XFASTINT (insval); 4774 inserted = XFASTINT (insval);
4775 } 4775 }
4776 } 4776 }
4777 4777
4786 XSETINT (lend, PT + inserted); 4786 XSETINT (lend, PT + inserted);
4787 if (CONSP (old_undo)) 4787 if (CONSP (old_undo))
4788 { 4788 {
4789 Lisp_Object tem = XCAR (old_undo); 4789 Lisp_Object tem = XCAR (old_undo);
4790 if (CONSP (tem) && INTEGERP (XCAR (tem)) && 4790 if (CONSP (tem) && INTEGERP (XCAR (tem)) &&
4791 INTEGERP (XCDR (tem)) && (XCAR (tem)) == lbeg) 4791 INTEGERP (XCDR (tem)) && EQ (XCAR (tem), lbeg))
4792 /* In the non-visiting case record only the final insertion. */ 4792 /* In the non-visiting case record only the final insertion. */
4793 current_buffer->undo_list = 4793 current_buffer->undo_list =
4794 Fcons (Fcons (lbeg, lend), Fcdr (old_undo)); 4794 Fcons (Fcons (lbeg, lend), Fcdr (old_undo));
4795 } 4795 }
4796 } 4796 }
4797 else if (old_undo == Qt)
4798 /* If undo_list was Qt before, keep it that way. */
4799 current_buffer->undo_list = Qt;
4800 else 4797 else
4801 /* Otherwise start with an empty undo_list. */ 4798 /* If undo_list was Qt before, keep it that way.
4802 current_buffer->undo_list = Qnil; 4799 Otherwise start with an empty undo_list. */
4800 current_buffer->undo_list = EQ (old_undo, Qt) ? Qt : Qnil;
4803 4801
4804 unbind_to (count, Qnil); 4802 unbind_to (count, Qnil);
4805 } 4803 }
4806 4804
4807 /* Call after-change hooks for the inserted text, aside from the case 4805 /* Call after-change hooks for the inserted text, aside from the case