Subject: Re: bug#65156: 29.1; Reading from pipe with --insert or insert-file-contents no longer supported

From: Paul Eggert <[email-masked]>
Date: Fri, 11 Aug 2023 10:18:16 -0700

On 2023-08-10 01:15, Eli Zaretskii wrote:
> I think it should be changed to say this instead:
> 
>    If REPLACE is the symbol ‘if-regular’, then eschew preserving marker
>    positions or the undo list when FILENAME is not a regular file.
>    Otherwise, signal an error if REPLACE is non-nil and FILENAME is not
>    a regular file.
> 
> AFAICT, this is what the code does.

It does more than that, no? If REPLACE is 'if-regular' and the file is 
not a regular file, the function replaces the entire buffer not the 
accessible region.

How about something like the attached instead?

diff --git a/src/fileio.c b/src/fileio.c
index 52bbaa61fc2..40c870331b8 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -4031,10 +4031,9 @@ because (1) it preserves some marker positions (in unchanged portions
 undo list.  When REPLACE is non-nil, the second return value is the
 number of characters that replace previous buffer contents.
 
-If REPLACE is the symbol `if-regular', then eschew preserving marker
-positions or the undo list if REPLACE is nil if FILENAME is not a
-regular file.  Otherwise, signal an error if REPLACE is non-nil and
-FILENAME is not a regular file.
+If REPLACE is non-nil and FILENAME is not a regular file, act as if
+REPLACE were nil if REPLACE is the symbol `if-regular' and signal an
+error otherwise.
 
 This function does code conversion according to the value of
 `coding-system-for-read' or `file-coding-system-alist', and sets the