aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/fileio.c31
1 files changed, 19 insertions, 12 deletions
diff --git a/src/fileio.c b/src/fileio.c
index 7e1ac3fc383..9f04a5928bb 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -4550,14 +4550,19 @@ by calling `format-decode', which see. */)
4550 beg_offset += same_at_start - BEGV_BYTE; 4550 beg_offset += same_at_start - BEGV_BYTE;
4551 end_offset -= ZV_BYTE - same_at_end; 4551 end_offset -= ZV_BYTE - same_at_end;
4552 4552
4553 /* This binding is to avoid ask-user-about-supersession-threat 4553 if (!NILP (visit) && BEG == BEGV && Z == ZV)
4554 being called in insert_from_buffer or del_range_bytes (via 4554 /* This binding is to avoid ask-user-about-supersession-threat
4555 prepare_to_modify_buffer). 4555 being called in insert_from_buffer or del_range_bytes (via
4556 AFAICT we could avoid ask-user-about-supersession-threat by setting 4556 prepare_to_modify_buffer).
4557 current_buffer->modtime earlier, but we could still end up calling 4557 Such a prompt makes no sense if we're VISITing the file,
4558 ask-user-about-supersession-threat if the file is modified while 4558 since the insertion makes the buffer *more* like the file
4559 we read it, so we bind buffer-file-name instead. */ 4559 rather than the reverse.
4560 specbind (Qbuffer_file_name, Qnil); 4560 AFAICT we could avoid ask-user-about-supersession-threat by
4561 setting current_buffer->modtime earlier, but we could still
4562 end up calling ask-user-about-supersession-threat if the file
4563 is modified while we read it, so we bind buffer-file-name
4564 instead. */
4565 specbind (Qbuffer_file_name, Qnil);
4561 del_range_byte (same_at_start, same_at_end); 4566 del_range_byte (same_at_start, same_at_end);
4562 /* Insert from the file at the proper position. */ 4567 /* Insert from the file at the proper position. */
4563 temp = BYTE_TO_CHAR (same_at_start); 4568 temp = BYTE_TO_CHAR (same_at_start);
@@ -4666,8 +4671,9 @@ by calling `format-decode', which see. */)
4666 /* Truncate the buffer to the size of the file. */ 4671 /* Truncate the buffer to the size of the file. */
4667 if (same_at_start != same_at_end) 4672 if (same_at_start != same_at_end)
4668 { 4673 {
4669 /* See previous specbind for the reason behind this. */ 4674 if (!NILP (visit) && BEG == BEGV && Z == ZV)
4670 specbind (Qbuffer_file_name, Qnil); 4675 /* See previous specbind for the reason behind this. */
4676 specbind (Qbuffer_file_name, Qnil);
4671 del_range_byte (same_at_start, same_at_end); 4677 del_range_byte (same_at_start, same_at_end);
4672 } 4678 }
4673 inserted = 0; 4679 inserted = 0;
@@ -4716,8 +4722,9 @@ by calling `format-decode', which see. */)
4716 we are taking from the decoded string. */ 4722 we are taking from the decoded string. */
4717 inserted -= (ZV_BYTE - same_at_end) + (same_at_start - BEGV_BYTE); 4723 inserted -= (ZV_BYTE - same_at_end) + (same_at_start - BEGV_BYTE);
4718 4724
4719 /* See previous specbind for the reason behind this. */ 4725 if (!NILP (visit) && BEG == BEGV && Z == ZV)
4720 specbind (Qbuffer_file_name, Qnil); 4726 /* See previous specbind for the reason behind this. */
4727 specbind (Qbuffer_file_name, Qnil);
4721 if (same_at_end != same_at_start) 4728 if (same_at_end != same_at_start)
4722 { 4729 {
4723 del_range_byte (same_at_start, same_at_end); 4730 del_range_byte (same_at_start, same_at_end);