The following code sets up the f5 key for refreshing an active buffer in emacs:

(defun refresh-file ()


(revert-buffer t t t)


(global-set-key [f5]

'(lambda () "Refresh the buffer from the disk (prompt of modified)."


(revert-buffer t (not (buffer-modified-p)) t)))

The code snippet should be placed in your .emacs file. (If you don't have a .emacs file, you just create an empty file named .emacs in your home directory and place the code snippet in that file.)