fix: doom/move-this-file when directory is the target
* doom/move-this-file now supports moving directly into a directory * applied requested changes Close #4861
This commit is contained in:
parent
65950f3e91
commit
a6f365bb3f
1 changed files with 2 additions and 0 deletions
|
@ -282,6 +282,8 @@ If FORCE-P, overwrite the destination file if it exists, without confirmation."
|
||||||
(user-error "Buffer is not visiting any file"))
|
(user-error "Buffer is not visiting any file"))
|
||||||
(let ((old-path (buffer-file-name (buffer-base-buffer)))
|
(let ((old-path (buffer-file-name (buffer-base-buffer)))
|
||||||
(new-path (expand-file-name new-path)))
|
(new-path (expand-file-name new-path)))
|
||||||
|
(when (directory-name-p new-path)
|
||||||
|
(setq new-path (concat new-path (file-name-nondirectory old-path))))
|
||||||
(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)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue