1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-13 16:38:14 +00:00

Minor fix in 'find-alternate-file'

This fixes the use case when, for example, 'find-file-hooks'
fails.
* lisp/files.el (find-alternate-file): If buffer 'oname' exists,
kill it before renaming the new one.  (Bug#41359)
This commit is contained in:
immerrr 2020-05-17 13:47:23 +02:00 committed by Eli Zaretskii
parent 360d7c716d
commit 3dbe6530b1

View File

@ -1921,6 +1921,8 @@ killed."
(setq buffer-file-truename otrue)
(setq dired-directory odir)
(lock-buffer)
(if (get-buffer oname)
(kill-buffer oname))
(rename-buffer oname)))
(unless (eq (current-buffer) obuf)
(with-current-buffer obuf