Subject: bug#78866: [PATCH] (Finsert_file_contents): Refine commit d07af40d8826

From: Stefan Monnier <[email-masked]>
Date: Thu, 26 Jun 2025 09:38:14 -0400

> I agree that we should prompt, but I don't understand the logic behind
> the proposed solution.  Why is it OK not to prompt when VISIT is
> non-nil?  It is true that in that case we will be reading from
> FILENAME, but the contents after the insertion will not necessarily be
> identical to FILENAME, because not necessarily the entire contents of
> the buffer is erased.

If VISIT is non-nil, then REPLACE is also non-nil (or irrelevant
because the buffer is empty):

    if (!NILP (visit))
      {
        if (!NILP (beg) || !NILP (end))
          error ("Attempt to visit less than an entire file");
        if (BEG < Z && NILP (replace))
          error ("Cannot do file visiting in a non-empty buffer");
      }

- Stefan