fix rename-current-buffer-file for OS X

`read-file-name` expects directory and not filename.
Fix #4383 #6547
This commit is contained in:
Muneeb Shaikh 2016-07-12 11:34:13 +05:30 committed by d12frosted
parent 98499a0cb1
commit 304e338738
No known key found for this signature in database
GPG Key ID: 8D33A3B1A4AF7D30
1 changed files with 4 additions and 3 deletions

View File

@ -321,11 +321,12 @@ projectile cache when it's possible and update recentf list."
(defun spacemacs/rename-current-buffer-file ()
"Renames current buffer and file it is visiting."
(interactive)
(let ((name (buffer-name))
(filename (buffer-file-name)))
(let* ((name (buffer-name))
(filename (buffer-file-name))
(dir (file-name-directory filename)))
(if (not (and filename (file-exists-p filename)))
(error "Buffer '%s' is not visiting a file!" name)
(let ((new-name (read-file-name "New name: " filename)))
(let ((new-name (read-file-name "New name: " dir)))
(cond ((get-buffer new-name)
(error "A buffer named '%s' already exists!" new-name))
(t