GNU bug report logs -
#78777
30.1; insert-file-contents should not set buffer-file-name to nil
Previous Next
Full log
View this message in rfc822 format
Hi,
In article <jwvtt4fag1z.fsf-monnier+emacs <at> gnu.org>, Stefan Monnier <monnier <at> iro.umontreal.ca> writes:
[...]
> (Finsert_file_contents): On replacing, temporarily bind
> buffer-file-name to Qnil before calling insert_from_buffer.
> diff --git a/src/fileio.c b/src/fileio.c
> --- a/src/fileio.c
> +++ b/src/fileio.c
> @@ -4359,8 +4359,12 @@
> inserted_chars
> = (buf_bytepos_to_charpos (XBUFFER (conversion_buffer),
> same_at_start + inserted)
> - same_at_start_charpos);
> + /* This binding is to avoid ask-user-about-supersession-threat
> + being called in insert_from_buffer (via in
> + prepare_to_modify_buffer). */
> + specbind (intern ("buffer-file-name"), Qnil);
> insert_from_buffer (XBUFFER (conversion_buffer),
> same_at_start_charpos, inserted_chars, 0);
> /* Set `inserted' to the number of inserted characters. */
> inserted = PT - temp;
> ```
> I'm not sure exactly what was the motivation for the change.
> I mean, the comment explains that the purpose is to silence a potential
> `ask-user-about-supersession-threat`, but I don't know why we should
> care about such a possibility and why it would be right to silence
> it here.
I don't remember, sorry.
> Nor do I understand why it was added to the code path where coding
> conversion was needed but not to the other one.
??? It seems that the code above is where coding conversion is not
needed.
---
K. Handa
handa <at> gnu.org
This bug report was last modified 56 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.