GNU bug report logs -
#79127
30.1; Inaccurate description of find-file-noselect with NOWARN non-nil
Previous Next
To reply to this bug, email your comments to 79127 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#79127
; Package
emacs
.
(Wed, 30 Jul 2025 11:03:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
richard newton <richardn26 <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Wed, 30 Jul 2025 11:03:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
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)))))
[Message part 2 (text/html, inline)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#79127
; Package
emacs
.
(Sat, 02 Aug 2025 14:36:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 79127 <at> debbugs.gnu.org (full text, mbox):
> From: richard newton <richardn26 <at> gmail.com>
> 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.
This bug report was last modified 14 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.