This was written by Steve Yegge (at least I found it on his blog). It lets you change the name of the currently open file in emacs. Would it be possible to make the current name of the file the default name in the new name dialog? I often have one little typo in the filename and would rather just edit it than writing the entire name over again.
;; Never understood why Emacs doesn't have this function.
(defun rename-file-and-buffer (new-name)
"Renames both current buffer and file it's visiting to NEW-NAME."
(interactive "sNew name: ")
(let ((name (buffer-name))
(filename (buffer-file-name)))
(if (not filename)
(message "Buffer '%s' is not visiting a file!" name)
(if (get-buffer new-name)
(message "A buffer named '%s' already exists!" new-name)
(rename-file name new-name 1)
(rename-buffer new-name)
(set-visited-file-name new-name)
(set-buffer-modified-p nil))))))