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


(defun refresh-file ()

(interactive)

(revert-buffer t t t)

)


(global-set-key [f5]

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

(interactive)

(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.)