Set revert-buffer-function in the right place