I hadn't noticed that this function doesn't exist in Emacs 24.
(unless mdw-inhibit-rename-buffer
(let ((buffer (get-file-buffer from)))
(when buffer
(unless mdw-inhibit-rename-buffer
(let ((buffer (get-file-buffer from)))
(when buffer
- (let ((to (if (not (directory-name-p to)) to
+ (let ((to (if (not (string= (file-name-nondirectory to) "")) to
(concat to (file-name-nondirectory from)))))
(with-current-buffer buffer
(set-visited-file-name to nil t)))))))
(concat to (file-name-nondirectory from)))))
(with-current-buffer buffer
(set-visited-file-name to nil t)))))))