Revert buffer after renaming file

This commit is contained in:
Henrik Lissner 2020-08-26 19:52:06 -04:00
parent e00560caf8
commit 247ce145b4
No known key found for this signature in database
GPG key ID: 5F6C0EA160557395

View file

@ -202,10 +202,7 @@ single file or nested compound statement of `and' and `or' statements."
(let (toplevels)
(dolist (file files)
(when (featurep 'vc)
(vc-file-clearprops file)
(when-let (buffer (get-file-buffer file))
(with-current-buffer buffer
(vc-refresh-state))))
(vc-file-clearprops file))
(when (featurep 'magit)
(when-let (default-directory (magit-toplevel (file-name-directory file)))
(cl-pushnew default-directory toplevels)))
@ -286,6 +283,7 @@ If FORCE-P, overwrite the destination file if it exists, without confirmation."
(make-directory (file-name-directory new-path) 't)
(rename-file old-path new-path (or force-p 1))
(set-visited-file-name new-path t t)
(revert-buffer t t)
(doom--update-files old-path new-path)
(message "File moved to %S" (abbreviate-file-name new-path))))