From a6f365bb3f82ca90a0f4bc9a2a53cc525efac10c Mon Sep 17 00:00:00 2001 From: NightMachinary <36224762+NightMachinary@users.noreply.github.com> Date: Sun, 1 Aug 2021 23:43:52 +0430 Subject: [PATCH] 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 --- core/autoload/files.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/autoload/files.el b/core/autoload/files.el index 8881d40e3..44b492c04 100644 --- a/core/autoload/files.el +++ b/core/autoload/files.el @@ -282,6 +282,8 @@ If FORCE-P, overwrite the destination file if it exists, without confirmation." (user-error "Buffer is not visiting any file")) (let ((old-path (buffer-file-name (buffer-base-buffer))) (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) (rename-file old-path new-path (or force-p 1)) (set-visited-file-name new-path t t)