+ (progn
+ ;; If we are displaying a single file (rather than the
+ ;; contents of a directory), change dired-directory if that
+ ;; file was renamed. (This ought to be generalized to
+ ;; handle the multiple files case, but that's less trivial).
+ (when (and (stringp dired-directory)
+ (not (file-directory-p dired-directory))
+ (null some-file-names-unchanged)
+ (= (length files-renamed) 1))
+ (setq dired-directory (cdr (car files-renamed))))
+ ;; Re-sort the buffer.
+ (revert-buffer))