From unknown Mon Aug 18 11:11:58 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#79127 <79127@debbugs.gnu.org> To: bug#79127 <79127@debbugs.gnu.org> Subject: Status: 30.1; Inaccurate description of find-file-noselect with NOWARN non-nil Reply-To: bug#79127 <79127@debbugs.gnu.org> Date: Mon, 18 Aug 2025 18:11:58 +0000 retitle 79127 30.1; Inaccurate description of find-file-noselect with NOWAR= N non-nil reassign 79127 emacs submitter 79127 richard newton severity 79127 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Wed Jul 30 07:02:36 2025 Received: (at submit) by debbugs.gnu.org; 30 Jul 2025 11:02:36 +0000 Received: from localhost ([127.0.0.1]:39781 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uh4Zw-0005ep-BL for submit@debbugs.gnu.org; Wed, 30 Jul 2025 07:02:36 -0400 Received: from lists.gnu.org ([2001:470:142::17]:37728) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uh4Zu-0005eU-CY for submit@debbugs.gnu.org; Wed, 30 Jul 2025 07:02:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uh4Ze-0002Vm-RG for bug-gnu-emacs@gnu.org; Wed, 30 Jul 2025 07:02:20 -0400 Received: from mail-pg1-x52f.google.com ([2607:f8b0:4864:20::52f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1uh4Zc-00016I-Lb for bug-gnu-emacs@gnu.org; Wed, 30 Jul 2025 07:02:18 -0400 Received: by mail-pg1-x52f.google.com with SMTP id 41be03b00d2f7-b34c068faf8so6732638a12.2 for ; Wed, 30 Jul 2025 04:02:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1753873334; x=1754478134; darn=gnu.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=42uwHsU5PRS7949oD8jM236dhJDU6wvGrxwDokezGh0=; b=co1GVTE6ucDRImFGmcJtAQ5kkiv6Ylp8MEK/QsLr6px57lA58F2RZbXU4lcvdKIPPd v0f3GXSPDouHEoVqlWItFmRICiZq9dQ1lMKphtddJmhQ4Zpt7nyk+jZqW0Lfc9+uvVUZ p/dF+37f4WLpydnf5PrJEJwJO1F0+oXJWeWHVDkbPk/FgyLU0QRtmZPIkUzkf02DCnYo rZ9t52uCAp4kzgocIff6ZHgM2Tzps+mUGiahIQPkGdQ65i1PDtt4Sdpvgb39sZK1U6cX lV2rNuITXlmUcZ9yaZMl0gFSokxlfTxnhGUljipoXdPokxsyGJ9wzupvpMaXa0+gWQT5 4nvg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1753873334; x=1754478134; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=42uwHsU5PRS7949oD8jM236dhJDU6wvGrxwDokezGh0=; b=TBdChd+86NiIOnH2uBsITBQpa4vci28BxpLAJRf9Yr94F0phRb7s83F/aP1nY/Tbs6 7HA47mFdCx0bHZJmWCN9EBeN5IimRYHtI/Pwx7ndXbtyGQB17IV52K9uVLdEEGZ/XZwY U4QNGRqtIdNfDMipOA8mZQ/34Jk5m8UrX+yR0h3u8OZlu7ODCzo5ern8ULJhQX9bpIxo c8jJNWKCA6hewgXjGPiJvLashFrYbsgYZLxcKl+Y9K5m5Td2+GZmUkru3x7n+VSjBFPz AoG+a89/MPQuQw8kEPlYxvM+FU7dqg8h/j8WPVND7gFfhVRVVeg0zF6C7hSB+px07bU8 dP8g== X-Gm-Message-State: AOJu0YwpS7SDYUuSkz8/g2TnjNUGObPGLFtPsuBRg5LUn70XDUNoxe+0 b/ohSVgQt6lUMqqmlvUd93dt1NY0a+GCojVb4KJSxx+ogp6tMTnUM8B77nnFTAsZGYSWayoZBDS zFoFG1nKn5YzSPuIuz8+BCGJvBOYkWsMixLLF X-Gm-Gg: ASbGnctK4VF80ke758zvRhDhoQiMcjd+1m8Ru0K9frGlGHEcvb3oDnaVnEf2YR/AkDM Sr50ZI4lSkwMo7LGl6EncMQvys1vW1JBbDnaovW2rKcAqnDO98YTY6n0tvlPE71n5OiZhu9hAO6 TX4S6iD/lelet9QWtltOiaOACAjYDghAw5Epdjdi8rDIYCtmRt6hPDVNTIPqGHotwGzfNfYfG0c 4yzGDTdEJYP+Q98ZNqh67QJvjc+Chi6tfRvy3l1dA/d1lyeT3E= X-Google-Smtp-Source: AGHT+IEAKc5GEtf8h5rPDfDIE8bokdp07HsxWDTHlUlzOSCLhOFtRrr+eIF5IyRHPtjwh2vlalLC6CxCwm8zPLvQuBM= X-Received: by 2002:a17:90b:17ca:b0:31e:ff94:3f9d with SMTP id 98e67ed59e1d1-31f5de7b947mr4215709a91.31.1753873334027; Wed, 30 Jul 2025 04:02:14 -0700 (PDT) MIME-Version: 1.0 From: richard newton Date: Wed, 30 Jul 2025 13:02:02 +0200 X-Gm-Features: Ac12FXzkpS62G8_zrmF8RsQsUMAyTivzClRF5oN7N94PA9FKfx7p6qWNCT2hx68 Message-ID: Subject: 30.1; Inaccurate description of find-file-noselect with NOWARN non-nil To: bug-gnu-emacs@gnu.org Content-Type: multipart/alternative; boundary="0000000000000e4a38063b2375c2" Received-SPF: pass client-ip=2607:f8b0:4864:20::52f; envelope-from=richardn26@gmail.com; helo=mail-pg1-x52f.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.2 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Description of find-file-noselect says "If a buffer exists visiting FILENAME, return that one, but verify that the file has not changed since visited or saved." The description for arg NOWARN only says "Optional second arg NOWARN non-nil means suppress any warning messages." Content analysis details: (1.2 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_HELO_PASS SPF: HELO matches SPF record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (richardn26[at]gmail.com) 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit (richardn26[at]gmail.com) 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2001:470:142:0:0:0:0:17 listed in] [list.dnswl.org] 0.0 HTML_MESSAGE BODY: HTML included in message X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.2 (/) --0000000000000e4a38063b2375c2 Content-Type: text/plain; charset="UTF-8" Description of find-file-noselect says "If a buffer exists visiting FILENAME, return that one, but verify that the file has not changed since visited or saved." The description for arg NOWARN only says "Optional second arg NOWARN non-nil means suppress any warning messages." But if NOWARN is non-nil then it also does not verify that the file has not changed Ideally, the code should be changed to match the description. If not, the description for NOWARN could be improved. Simple testcase - with NOWARN, buffer does not get updated with update 2 (defun testcase () (interactive) (get-buffer-create "testing") (switch-to-buffer "testing") (shell-command-to-string (concat "echo start > /tmp/test1")) (set-buffer (find-file-noselect "/tmp/test1")) (switch-to-buffer "testing") (shell-command-to-string (concat "echo update 1 > /tmp/test1")) ;; without NOWARN - will prompt to update file (set-buffer (find-file-noselect "/tmp/test1")) (goto-char (point-min)) (let ((beg (point))) (goto-char (point-max)) (message (buffer-substring-no-properties beg (point)))) (shell-command-to-string (concat "echo update 2 > /tmp/test1")) ;; with NOWARN (set-buffer (find-file-noselect "/tmp/test1" t)) (goto-char (point-min)) (let ((beg (point))) (goto-char (point-max)) (message (buffer-substring-no-properties beg (point))))) --0000000000000e4a38063b2375c2 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Description of find-file-noselect says "If a buffer e= xists visiting FILENAME, return that one, but verify that the file has not = changed since visited or saved."

The description for arg NOWARN= only says
"Optional second arg NOWARN non-nil means suppress any w= arning messages."

But if NOWARN is non-nil then it also does no= t verify that the file has not changed

Ideally, the code should be c= hanged to match the description. If not, the description for NOWARN could b= e improved.

Simple testcase - with NOWARN, buffer does not get updat= ed with update 2

(defun testcase ()
=C2=A0 (interactive)
=C2= =A0 (get-buffer-create "testing")
=C2=A0 (switch-to-buffer &qu= ot;testing")
=C2=A0 (shell-command-to-string (concat "echo sta= rt > /tmp/test1"))
=C2=A0 (set-buffer (find-file-noselect "= /tmp/test1"))
=C2=A0 (switch-to-buffer "testing")
=C2= =A0 (shell-command-to-string (concat "echo update 1 > /tmp/test1&qu= ot;))
=C2=A0 ;; without NOWARN - will prompt to update file
=C2=A0 (s= et-buffer (find-file-noselect "/tmp/test1"))
=C2=A0 (goto-char= (point-min))
=C2=A0 (let ((beg (point)))
=C2=A0 =C2=A0 (goto-char (p= oint-max))
=C2=A0 =C2=A0 (message (buffer-substring-no-properties beg (p= oint))))
=C2=A0 (shell-command-to-string (concat "echo update 2 >= ; /tmp/test1"))
=C2=A0 ;; with NOWARN
=C2=A0 (set-buffer (find-f= ile-noselect "/tmp/test1" t))
=C2=A0 (goto-char (point-min))=C2=A0 (let ((beg (point)))
=C2=A0 =C2=A0 (goto-char (point-max))
= =C2=A0 =C2=A0 (message (buffer-substring-no-properties beg (point)))))
<= /div> --0000000000000e4a38063b2375c2-- From debbugs-submit-bounces@debbugs.gnu.org Sat Aug 02 10:35:46 2025 Received: (at 79127) by debbugs.gnu.org; 2 Aug 2025 14:35:46 +0000 Received: from localhost ([127.0.0.1]:36946 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1uiDKs-0004fe-4F for submit@debbugs.gnu.org; Sat, 02 Aug 2025 10:35:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47694) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1uiDKp-0004fH-N2 for 79127@debbugs.gnu.org; Sat, 02 Aug 2025 10:35:44 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1uiDKk-0002wX-8U; Sat, 02 Aug 2025 10:35:38 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=UW2ELZ1Ck5zhaCI4GXoyuc7m7bW4Nf+bebqkFNTlJSk=; b=DhcbVnZ4sN8A knZ87NM5Ay1oUfgFinb/x3Xn2kAhqUP+BxOYubPAePGDfd2uE9IK/ojfdnG/ODggd/pGS2OjD2wJF QIyK/bf8jeYipPkEx1LBjPNeWKV40pfv6zm2QwC0nErAa+BlSFKRsFvivzMHtmIAIlNoBh6OsptEu iTdZj4N/csrh3qRodmvr5Dz4N62YBuSAaPGPdouEVOpIs4yZ9o2X9OBisiWKYu0vXBFKvCNZfjb7I kufpCu03R7uZtZsCVdYH1/dl3uojgz3DBalL3CZYPhQ4vElChH2QNIC8hAPW2314+2pSDAKduunHT vZqiGWsqmoJwxvUxVKqtvA==; Date: Sat, 02 Aug 2025 17:35:36 +0300 Message-Id: <86fre9rdtz.fsf@gnu.org> From: Eli Zaretskii To: richard newton In-Reply-To: (message from richard newton on Wed, 30 Jul 2025 13:02:02 +0200) Subject: Re: bug#79127: 30.1; Inaccurate description of find-file-noselect with NOWARN non-nil References: X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 79127 Cc: 79127@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: richard newton > Date: Wed, 30 Jul 2025 13:02:02 +0200 > > Description of find-file-noselect says "If a buffer exists visiting FILENAME, return that one, but verify that the > file has not changed since visited or saved." > > The description for arg NOWARN only says > "Optional second arg NOWARN non-nil means suppress any warning messages." > > But if NOWARN is non-nil then it also does not verify that the file has not changed > > Ideally, the code should be changed to match the description. If not, the description for NOWARN could be > improved. Thanks. I opted to change the documentation (on the emacs-30 branch), since NOWARN should not be used when there's a possibility that the file has been edited behind Emacs's back, and it's impossible to not warn if we discover that it has been.