[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master e634130: Fix inconsistent behaviour in find-file-noselect when us
From: |
Lars Ingebrigtsen |
Subject: |
master e634130: Fix inconsistent behaviour in find-file-noselect when using nowarn |
Date: |
Tue, 4 May 2021 05:48:41 -0400 (EDT) |
branch: master
commit e634130607b844a0b428c826b205ede05edeedfc
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>
Fix inconsistent behaviour in find-file-noselect when using nowarn
* lisp/files.el (after-find-file): Behave the same in when
warning/not warning (bug#47850). This fixes this test case:
(switch-to-buffer (find-file-noselect "non-existing-dir/test.el" t))
which would leave the buffer read-only.
---
lisp/files.el | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/lisp/files.el b/lisp/files.el
index 2c5017a..16ebe74 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -2537,21 +2537,20 @@ unless NOMODES is non-nil."
(let* (not-serious
(msg
(cond
- ((not warn) nil)
((and error (file-exists-p buffer-file-name))
(setq buffer-read-only t)
"File exists, but cannot be read")
((and error (file-symlink-p buffer-file-name))
"Symbolic link that points to nonexistent file")
((not buffer-read-only)
- (if (and warn
- ;; No need to warn if buffer is auto-saved
- ;; under the name of the visited file.
- (not (and buffer-file-name
- auto-save-visited-file-name))
- (file-newer-than-file-p (or buffer-auto-save-file-name
- (make-auto-save-file-name))
- buffer-file-name))
+ (if (and
+ ;; No need to warn if buffer is auto-saved
+ ;; under the name of the visited file.
+ (not (and buffer-file-name
+ auto-save-visited-file-name))
+ (file-newer-than-file-p (or buffer-auto-save-file-name
+ (make-auto-save-file-name))
+ buffer-file-name))
(format "%s has auto save data; consider M-x
recover-this-file"
(file-name-nondirectory buffer-file-name))
(setq not-serious t)
@@ -2565,7 +2564,7 @@ unless NOMODES is non-nil."
(setq buffer-read-only nil)
(unless (file-directory-p default-directory)
"Use M-x make-directory RET RET to create the directory and its
parents")))))
- (when msg
+ (when (and warn msg)
(message "%s" msg)
(or not-serious (sit-for 1 t))))
(when (and auto-save-default (not noauto))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master e634130: Fix inconsistent behaviour in find-file-noselect when using nowarn,
Lars Ingebrigtsen <=