Sometimes I use an alternative method (usually sed) to edit a file that's already being edited by Emacs. Later, if I try to edit the file in Emacs without reverting the changes first, I get an error message and a prompt asking me what to do.
That's all fine. The problem is that I tend to forget very often when I've made some parallel changes, so I'd like Emacs to remind me by showing a red "M" in the mode-line.
I know how to customize the mode-line (by adding strings to the
mode-line-format
variable), but I have no idea how to check if a
file has been modified outside of Emacs.
Is there a function to check whether an Emacs buffer is up to date with the file it corresponds?
Try
See Section 27.6 Buffer Modification Time.