diff options
author | Stefan Monnier <monnier@iro.umontreal.ca> | 2016-10-03 09:47:46 -0400 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2016-10-03 09:47:46 -0400 |
commit | e2913dc880b9843bf69cf885270551bafeb46120 (patch) | |
tree | 99e8fcb0aa17f60ddb3e68d91043c6b9a4d113f7 /src/insdel.c | |
parent | a7e9d1cce3f935dbe9f242f0bf2dbf34f5919952 (diff) | |
download | emacs-e2913dc880b9843bf69cf885270551bafeb46120.tar.gz |
* 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) /* Like del_range_1 but args are byte positions, not char positions. */ void -del_range_byte (ptrdiff_t from_byte, ptrdiff_t to_byte, bool prepare) +del_range_byte (ptrdiff_t from_byte, ptrdiff_t to_byte) { ptrdiff_t from, to; @@ -1706,23 +1706,22 @@ del_range_byte (ptrdiff_t from_byte, ptrdiff_t to_byte, bool prepare) from = BYTE_TO_CHAR (from_byte); to = BYTE_TO_CHAR (to_byte); - if (prepare) - { - ptrdiff_t old_from = from, old_to = Z - to; - ptrdiff_t range_length = to - from; - prepare_to_modify_buffer (from, to, &from); - to = from + range_length; - - if (old_from != from) - from_byte = CHAR_TO_BYTE (from); - if (to > ZV) - { - to = ZV; - to_byte = ZV_BYTE; - } - else if (old_to == Z - to) - to_byte = CHAR_TO_BYTE (to); - } + { + ptrdiff_t old_from = from, old_to = Z - to; + ptrdiff_t range_length = to - from; + prepare_to_modify_buffer (from, to, &from); + to = from + range_length; + + if (old_from != from) + from_byte = CHAR_TO_BYTE (from); + if (to > ZV) + { + to = ZV; + to_byte = ZV_BYTE; + } + else if (old_to == Z - to) + to_byte = CHAR_TO_BYTE (to); + } del_range_2 (from, from_byte, to, to_byte, 0); signal_after_change (from, to - from, 0); |