GNU bug report logs - #79127
30.1; Inaccurate description of find-file-noselect with NOWARN non-nil

Previous Next

Package: emacs;

Reported by: richard newton <richardn26 <at> gmail.com>

Date: Wed, 30 Jul 2025 11:03:02 UTC

Severity: normal

Found in version 30.1

Full log


Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: richard newton <richardn26 <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 30.1; Inaccurate description of find-file-noselect with NOWARN non-nil
Date: Wed, 30 Jul 2025 13:02:02 +0200
[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)]

This bug report was last modified 15 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.