Fix file rename target path when buffer name is uniquified
When the buffer's name is uniquified (because multiple buffers have the same short name), it is no longer equal to the basename of the buffer's file name, so it is incorrect to use the buffer name in the rename operation.
This commit is contained in:
parent
2f0f7a3fe7
commit
1a9ebf42df
1 changed files with 2 additions and 2 deletions
|
@ -415,8 +415,8 @@ projectile cache and updates recentf list."
|
||||||
|
|
||||||
;; originally from magnars
|
;; originally from magnars
|
||||||
(defun spacemacs/rename-buffer-visiting-a-file (&optional arg)
|
(defun spacemacs/rename-buffer-visiting-a-file (&optional arg)
|
||||||
(let* ((old-short-name (buffer-name))
|
(let* ((old-filename (buffer-file-name))
|
||||||
(old-filename (buffer-file-name))
|
(old-short-name (file-name-nondirectory (buffer-file-name)))
|
||||||
(old-dir (file-name-directory old-filename))
|
(old-dir (file-name-directory old-filename))
|
||||||
(new-name (let ((path (read-file-name "New name: " (if arg old-dir old-filename))))
|
(new-name (let ((path (read-file-name "New name: " (if arg old-dir old-filename))))
|
||||||
(if (string= (file-name-nondirectory path) "")
|
(if (string= (file-name-nondirectory path) "")
|
||||||
|
|
Reference in a new issue