diff options
| author | Martin Rudalics | 2007-08-24 05:36:39 +0000 |
|---|---|---|
| committer | Martin Rudalics | 2007-08-24 05:36:39 +0000 |
| commit | cac4219c9121a00f22eeb8716be0453f2d848228 (patch) | |
| tree | fd0f47c7addc396bcd63a33388f8632c0bb89291 /src | |
| parent | 0f205eeefa5af8c4a61fd26c58ff3c4af9106728 (diff) | |
| download | emacs-cac4219c9121a00f22eeb8716be0453f2d848228.tar.gz emacs-cac4219c9121a00f22eeb8716be0453f2d848228.zip | |
(Finsert_file_contents): Consult CHARS_MODIFF to tell
whether decoding has modified buffer contents.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 5 | ||||
| -rw-r--r-- | src/fileio.c | 26 |
2 files changed, 26 insertions, 5 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index fca37df9e8d..164a6c19d60 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2007-08-24 Martin Rudalics <rudalics@gmx.at> | ||
| 2 | |||
| 3 | * fileio.c (Finsert_file_contents): Consult CHARS_MODIFF to tell | ||
| 4 | whether decoding has modified buffer contents. | ||
| 5 | |||
| 1 | 2007-08-24 Jason Rumney <jasonr@gnu.org> | 6 | 2007-08-24 Jason Rumney <jasonr@gnu.org> |
| 2 | 7 | ||
| 3 | * image.c [HAVE_NTGUI]: Define dynamic loaded functions for SVG. | 8 | * image.c [HAVE_NTGUI]: Define dynamic loaded functions for SVG. |
diff --git a/src/fileio.c b/src/fileio.c index 45eb7d29f91..62331122a24 100644 --- a/src/fileio.c +++ b/src/fileio.c | |||
| @@ -4733,14 +4733,21 @@ variable `last-coding-system-used' to the coding system actually used. */) | |||
| 4733 | int opoint = PT; | 4733 | int opoint = PT; |
| 4734 | int opoint_byte = PT_BYTE; | 4734 | int opoint_byte = PT_BYTE; |
| 4735 | int oinserted = ZV - BEGV; | 4735 | int oinserted = ZV - BEGV; |
| 4736 | int ochars_modiff = CHARS_MODIFF; | ||
| 4736 | 4737 | ||
| 4737 | TEMP_SET_PT_BOTH (BEGV, BEGV_BYTE); | 4738 | TEMP_SET_PT_BOTH (BEGV, BEGV_BYTE); |
| 4738 | insval = call3 (Qformat_decode, | 4739 | insval = call3 (Qformat_decode, |
| 4739 | Qnil, make_number (oinserted), visit); | 4740 | Qnil, make_number (oinserted), visit); |
| 4740 | CHECK_NUMBER (insval); | 4741 | CHECK_NUMBER (insval); |
| 4741 | if (XINT (insval) == oinserted) | 4742 | if (ochars_modiff == CHARS_MODIFF) |
| 4743 | /* format_decode didn't modify buffer's characters => move | ||
| 4744 | point back to position before inserted text and leave | ||
| 4745 | value of inserted alone. */ | ||
| 4742 | SET_PT_BOTH (opoint, opoint_byte); | 4746 | SET_PT_BOTH (opoint, opoint_byte); |
| 4743 | inserted = XFASTINT (insval); | 4747 | else |
| 4748 | /* format_decode modified buffer's characters => consider | ||
| 4749 | entire buffer changed and leave point at point-min. */ | ||
| 4750 | inserted = XFASTINT (insval); | ||
| 4744 | } | 4751 | } |
| 4745 | 4752 | ||
| 4746 | /* For consistency with format-decode call these now iff inserted > 0 | 4753 | /* For consistency with format-decode call these now iff inserted > 0 |
| @@ -4763,15 +4770,24 @@ variable `last-coding-system-used' to the coding system actually used. */) | |||
| 4763 | int opoint = PT; | 4770 | int opoint = PT; |
| 4764 | int opoint_byte = PT_BYTE; | 4771 | int opoint_byte = PT_BYTE; |
| 4765 | int oinserted = ZV - BEGV; | 4772 | int oinserted = ZV - BEGV; |
| 4766 | 4773 | int ochars_modiff = CHARS_MODIFF; | |
| 4774 | |||
| 4767 | TEMP_SET_PT_BOTH (BEGV, BEGV_BYTE); | 4775 | TEMP_SET_PT_BOTH (BEGV, BEGV_BYTE); |
| 4768 | insval = call1 (XCAR (p), make_number (oinserted)); | 4776 | insval = call1 (XCAR (p), make_number (oinserted)); |
| 4769 | if (!NILP (insval)) | 4777 | if (!NILP (insval)) |
| 4770 | { | 4778 | { |
| 4771 | CHECK_NUMBER (insval); | 4779 | CHECK_NUMBER (insval); |
| 4772 | if (XINT (insval) == oinserted) | 4780 | if (ochars_modiff == CHARS_MODIFF) |
| 4781 | /* after_insert_file_functions didn't modify | ||
| 4782 | buffer's characters => move point back to | ||
| 4783 | position before inserted text and leave value of | ||
| 4784 | inserted alone. */ | ||
| 4773 | SET_PT_BOTH (opoint, opoint_byte); | 4785 | SET_PT_BOTH (opoint, opoint_byte); |
| 4774 | inserted = XFASTINT (insval); | 4786 | else |
| 4787 | /* after_insert_file_functions did modify buffer's | ||
| 4788 | characters => consider entire buffer changed and | ||
| 4789 | leave point at point-min. */ | ||
| 4790 | inserted = XFASTINT (insval); | ||
| 4775 | } | 4791 | } |
| 4776 | } | 4792 | } |
| 4777 | 4793 | ||