From 7b89d38e9a90b77178a3d378876c02fc84b4e8b7 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Fri, 1 Mar 1996 20:29:32 +0000 Subject: [PATCH] (set-visited-file-name): Query if there's already another buffer visiting this file. --- lisp/files.el | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lisp/files.el b/lisp/files.el index 309410ba992..b06e5a62f38 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -1422,6 +1422,11 @@ if you wish to pass an empty string as the argument." (setq truename (file-truename filename)) (if find-file-visit-truename (setq filename truename)))) + (let ((buffer (find-buffer-visiting filename))) + (and buffer (not (eq buffer (current-buffer))) + (not (y-or-n-p (message "A buffer is visiting %s; proceed? " + filename))) + (error "Aborted"))) (or (equal filename buffer-file-name) (progn (and filename (lock-buffer filename)) -- 2.39.2