ui/modeline: update buffer id when renaming files
And revert 247ce145b
, since I wasn't aware
after-set-visited-file-name-hook existed.
This commit is contained in:
parent
247ce145b4
commit
b3006ecabb
2 changed files with 6 additions and 2 deletions
|
@ -202,7 +202,10 @@ single file or nested compound statement of `and' and `or' statements."
|
||||||
(let (toplevels)
|
(let (toplevels)
|
||||||
(dolist (file files)
|
(dolist (file files)
|
||||||
(when (featurep 'vc)
|
(when (featurep 'vc)
|
||||||
(vc-file-clearprops file))
|
(vc-file-clearprops file)
|
||||||
|
(when-let (buffer (get-file-buffer file))
|
||||||
|
(with-current-buffer buffer
|
||||||
|
(vc-refresh-state))))
|
||||||
(when (featurep 'magit)
|
(when (featurep 'magit)
|
||||||
(when-let (default-directory (magit-toplevel (file-name-directory file)))
|
(when-let (default-directory (magit-toplevel (file-name-directory file)))
|
||||||
(cl-pushnew default-directory toplevels)))
|
(cl-pushnew default-directory toplevels)))
|
||||||
|
@ -283,7 +286,6 @@ If FORCE-P, overwrite the destination file if it exists, without confirmation."
|
||||||
(make-directory (file-name-directory new-path) 't)
|
(make-directory (file-name-directory new-path) 't)
|
||||||
(rename-file old-path new-path (or force-p 1))
|
(rename-file old-path new-path (or force-p 1))
|
||||||
(set-visited-file-name new-path t t)
|
(set-visited-file-name new-path t t)
|
||||||
(revert-buffer t t)
|
|
||||||
(doom--update-files old-path new-path)
|
(doom--update-files old-path new-path)
|
||||||
(message "File moved to %S" (abbreviate-file-name new-path))))
|
(message "File moved to %S" (abbreviate-file-name new-path))))
|
||||||
|
|
||||||
|
|
|
@ -366,6 +366,8 @@ Requires `anzu', also `evil-anzu' if using `evil-mode' for compatibility with
|
||||||
focus-in-hook
|
focus-in-hook
|
||||||
;; ...or when we change the current project!
|
;; ...or when we change the current project!
|
||||||
projectile-after-switch-project-hook
|
projectile-after-switch-project-hook
|
||||||
|
;; ...when the visited file changes (e.g. it's renamed)
|
||||||
|
after-set-visited-file-name-hook
|
||||||
;; ...when the underlying file changes
|
;; ...when the underlying file changes
|
||||||
after-revert-hook)
|
after-revert-hook)
|
||||||
(defun +modeline--generate-buffer-id-cache-h ()
|
(defun +modeline--generate-buffer-id-cache-h ()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue