diff options
| author | Stefan Monnier | 2016-10-03 09:47:46 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2016-10-03 09:47:46 -0400 |
| commit | e2913dc880b9843bf69cf885270551bafeb46120 (patch) | |
| tree | 99e8fcb0aa17f60ddb3e68d91043c6b9a4d113f7 /src/insdel.c | |
| parent | a7e9d1cce3f935dbe9f242f0bf2dbf34f5919952 (diff) | |
| download | emacs-e2913dc880b9843bf69cf885270551bafeb46120.tar.gz emacs-e2913dc880b9843bf69cf885270551bafeb46120.zip | |
* src/fileio.c (Finsert_file_contents): Fix hook handling (bug#24340)
* src/fileio.c (Finsert_file_contents): Run before-change-hooks before
deleting the old buffer content.
* src/lisp.h (del_range_byte):
* src/insdel.c (del_range_byte): Drop the last argument.
* src/fns.c (Fbase64_encode_region): Adjust accordingly.
Diffstat (limited to 'src/insdel.c')
| -rw-r--r-- | src/insdel.c | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/src/insdel.c b/src/insdel.c index 5d3884b4059..ed914ec6f75 100644 --- a/src/insdel.c +++ b/src/insdel.c | |||
| @@ -1690,7 +1690,7 @@ del_range_1 (ptrdiff_t from, ptrdiff_t to, bool prepare, bool ret_string) | |||
| 1690 | /* Like del_range_1 but args are byte positions, not char positions. */ | 1690 | /* Like del_range_1 but args are byte positions, not char positions. */ |
| 1691 | 1691 | ||
| 1692 | void | 1692 | void |
| 1693 | del_range_byte (ptrdiff_t from_byte, ptrdiff_t to_byte, bool prepare) | 1693 | del_range_byte (ptrdiff_t from_byte, ptrdiff_t to_byte) |
| 1694 | { | 1694 | { |
| 1695 | ptrdiff_t from, to; | 1695 | ptrdiff_t from, to; |
| 1696 | 1696 | ||
| @@ -1706,23 +1706,22 @@ del_range_byte (ptrdiff_t from_byte, ptrdiff_t to_byte, bool prepare) | |||
| 1706 | from = BYTE_TO_CHAR (from_byte); | 1706 | from = BYTE_TO_CHAR (from_byte); |
| 1707 | to = BYTE_TO_CHAR (to_byte); | 1707 | to = BYTE_TO_CHAR (to_byte); |
| 1708 | 1708 | ||
| 1709 | if (prepare) | 1709 | { |
| 1710 | { | 1710 | ptrdiff_t old_from = from, old_to = Z - to; |
| 1711 | ptrdiff_t old_from = from, old_to = Z - to; | 1711 | ptrdiff_t range_length = to - from; |
| 1712 | ptrdiff_t range_length = to - from; | 1712 | prepare_to_modify_buffer (from, to, &from); |
| 1713 | prepare_to_modify_buffer (from, to, &from); | 1713 | to = from + range_length; |
| 1714 | to = from + range_length; | 1714 | |
| 1715 | 1715 | if (old_from != from) | |
| 1716 | if (old_from != from) | 1716 | from_byte = CHAR_TO_BYTE (from); |
| 1717 | from_byte = CHAR_TO_BYTE (from); | 1717 | if (to > ZV) |
| 1718 | if (to > ZV) | 1718 | { |
| 1719 | { | 1719 | to = ZV; |
| 1720 | to = ZV; | 1720 | to_byte = ZV_BYTE; |
| 1721 | to_byte = ZV_BYTE; | 1721 | } |
| 1722 | } | 1722 | else if (old_to == Z - to) |
| 1723 | else if (old_to == Z - to) | 1723 | to_byte = CHAR_TO_BYTE (to); |
| 1724 | to_byte = CHAR_TO_BYTE (to); | 1724 | } |
| 1725 | } | ||
| 1726 | 1725 | ||
| 1727 | del_range_2 (from, from_byte, to, to_byte, 0); | 1726 | del_range_2 (from, from_byte, to, to_byte, 0); |
| 1728 | signal_after_change (from, to - from, 0); | 1727 | signal_after_change (from, to - from, 0); |