When programming, I often switch from emacs to Xcode and viceversa. When I switch to Xcode, it automatically updates the current file when I focus Xcode window, if it detects that there are some external changes.
In emacs I have to press C-x C-v (but I lose the cursor position) or I have to press something and then insert r (reload?) in the minibuffer when emacs asks me what to do.
How to make emacs automatically reload the file (without losing the cursor position), it when I select back a buffer it corresponds to a modified file?