[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 3dbe653: Minor fix in 'find-alternate-file'

From: Eli Zaretskii
Subject: master 3dbe653: Minor fix in 'find-alternate-file'
Date: Sat, 30 May 2020 08:27:01 -0400 (EDT)

branch: master
commit 3dbe6530b124436550dae4db6cd4b7b380e95377
Author: immerrr <immerrr@gmail.com>
Commit: Eli Zaretskii <eliz@gnu.org>

    Minor fix in 'find-alternate-file'
    This fixes the use case when, for example, 'find-file-hooks'
    * lisp/files.el (find-alternate-file): If buffer 'oname' exists,
    kill it before renaming the new one.  (Bug#41359)
 lisp/files.el | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lisp/files.el b/lisp/files.el
index cefae20..742fd78 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -1921,6 +1921,8 @@ killed."
        (setq buffer-file-truename otrue)
        (setq dired-directory odir)
+        (if (get-buffer oname)
+            (kill-buffer oname))
        (rename-buffer oname)))
     (unless (eq (current-buffer) obuf)
       (with-current-buffer obuf

reply via email to

[Prev in Thread] Current Thread [Next in Thread]