aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlan Mackenzie2014-12-15 12:07:18 +0000
committerAlan Mackenzie2014-12-15 12:07:18 +0000
commit816c1dfc5dfc6d490c653b393ef6876b3f04b7fe (patch)
tree8a1e18c725f6cb07a97f85769322e6089af4580c /src
parent436b88bf9960c97f4588d8e3d9c0c353e7898792 (diff)
parente2815bfe2a1e4d5a21d6b6378ebc2108d4d104ab (diff)
downloademacs-816c1dfc5dfc6d490c653b393ef6876b3f04b7fe.tar.gz
emacs-816c1dfc5dfc6d490c653b393ef6876b3f04b7fe.zip
Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog8
-rw-r--r--src/fileio.c13
2 files changed, 17 insertions, 4 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 46bf2801849..5ce56f4df04 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,11 @@
12014-12-15 Paul Eggert <eggert@cs.ucla.edu>
2
3 Correct same_at_end when restoring window points
4 * fileio.c (Finsert_file_contents): Compute same_at_end character
5 position using the old buffer size, not the new one, since
6 restore_window_points wants the old size.
7 Fixes: debbugs:19161
8
12014-12-14 Alan Mackenzie <acm@muc.de> 92014-12-14 Alan Mackenzie <acm@muc.de>
2 10
3 New feature optionally to accelerate auto-repeated scrolling. 11 New feature optionally to accelerate auto-repeated scrolling.
diff --git a/src/fileio.c b/src/fileio.c
index 83b4954b745..39514ee18e6 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -3522,6 +3522,9 @@ by calling `format-decode', which see. */)
3522 bytes and BEG and END count bytes. */ 3522 bytes and BEG and END count bytes. */
3523 ptrdiff_t same_at_start = BEGV_BYTE; 3523 ptrdiff_t same_at_start = BEGV_BYTE;
3524 ptrdiff_t same_at_end = ZV_BYTE; 3524 ptrdiff_t same_at_end = ZV_BYTE;
3525 /* SAME_AT_END_CHARPOS counts characters, because
3526 restore_window_points needs the old character count. */
3527 ptrdiff_t same_at_end_charpos = ZV;
3525 3528
3526 if (current_buffer->base_buffer && ! NILP (visit)) 3529 if (current_buffer->base_buffer && ! NILP (visit))
3527 error ("Cannot do file visiting in an indirect buffer"); 3530 error ("Cannot do file visiting in an indirect buffer");
@@ -3943,6 +3946,7 @@ by calling `format-decode', which see. */)
3943 + (! NILP (end) ? end_offset : st.st_size) - ZV_BYTE)); 3946 + (! NILP (end) ? end_offset : st.st_size) - ZV_BYTE));
3944 if (overlap > 0) 3947 if (overlap > 0)
3945 same_at_end += overlap; 3948 same_at_end += overlap;
3949 same_at_end_charpos = BYTE_TO_CHAR (same_at_end);
3946 3950
3947 /* Arrange to read only the nonmatching middle part of the file. */ 3951 /* Arrange to read only the nonmatching middle part of the file. */
3948 beg_offset += same_at_start - BEGV_BYTE; 3952 beg_offset += same_at_start - BEGV_BYTE;
@@ -3950,7 +3954,7 @@ by calling `format-decode', which see. */)
3950 3954
3951 invalidate_buffer_caches (current_buffer, 3955 invalidate_buffer_caches (current_buffer,
3952 BYTE_TO_CHAR (same_at_start), 3956 BYTE_TO_CHAR (same_at_start),
3953 BYTE_TO_CHAR (same_at_end)); 3957 same_at_end_charpos);
3954 del_range_byte (same_at_start, same_at_end, 0); 3958 del_range_byte (same_at_start, same_at_end, 0);
3955 /* Insert from the file at the proper position. */ 3959 /* Insert from the file at the proper position. */
3956 temp = BYTE_TO_CHAR (same_at_start); 3960 temp = BYTE_TO_CHAR (same_at_start);
@@ -4099,6 +4103,7 @@ by calling `format-decode', which see. */)
4099 overlap = same_at_start - BEGV_BYTE - (same_at_end + inserted - ZV_BYTE); 4103 overlap = same_at_start - BEGV_BYTE - (same_at_end + inserted - ZV_BYTE);
4100 if (overlap > 0) 4104 if (overlap > 0)
4101 same_at_end += overlap; 4105 same_at_end += overlap;
4106 same_at_end_charpos = BYTE_TO_CHAR (same_at_end);
4102 4107
4103 /* If display currently starts at beginning of line, 4108 /* If display currently starts at beginning of line,
4104 keep it that way. */ 4109 keep it that way. */
@@ -4114,7 +4119,7 @@ by calling `format-decode', which see. */)
4114 { 4119 {
4115 invalidate_buffer_caches (current_buffer, 4120 invalidate_buffer_caches (current_buffer,
4116 BYTE_TO_CHAR (same_at_start), 4121 BYTE_TO_CHAR (same_at_start),
4117 BYTE_TO_CHAR (same_at_end)); 4122 same_at_end_charpos);
4118 del_range_byte (same_at_start, same_at_end, 0); 4123 del_range_byte (same_at_start, same_at_end, 0);
4119 temp = GPT; 4124 temp = GPT;
4120 eassert (same_at_start == GPT_BYTE); 4125 eassert (same_at_start == GPT_BYTE);
@@ -4122,7 +4127,7 @@ by calling `format-decode', which see. */)
4122 } 4127 }
4123 else 4128 else
4124 { 4129 {
4125 temp = BYTE_TO_CHAR (same_at_start); 4130 temp = same_at_end_charpos;
4126 } 4131 }
4127 /* Insert from the file at the proper position. */ 4132 /* Insert from the file at the proper position. */
4128 SET_PT_BOTH (temp, same_at_start); 4133 SET_PT_BOTH (temp, same_at_start);
@@ -4405,7 +4410,7 @@ by calling `format-decode', which see. */)
4405 if (inserted > 0) 4410 if (inserted > 0)
4406 restore_window_points (window_markers, inserted, 4411 restore_window_points (window_markers, inserted,
4407 BYTE_TO_CHAR (same_at_start), 4412 BYTE_TO_CHAR (same_at_start),
4408 BYTE_TO_CHAR (same_at_end)); 4413 same_at_end_charpos);
4409 4414
4410 if (!NILP (visit)) 4415 if (!NILP (visit))
4411 { 4416 {