Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In Emacs, how do I inspect what has been modified in a buffer (before saving and overwriting the file)?

(In a sense, the requested action is an analog of git status and git add -i showing what has been modified, only the comparison should be done between the buffer contents (in Emacs's memory) and the file on disk.)

Sometime, I forget what has been modified in a buffer, and would like to call a command to remind me.

share|improve this question
Some people might even like to "bind" this behavior with the saving or killing-the-buffer command: so that the diff is demonstrated before one decides whether to save or kill the buffer (that's similar to the interactive way of how darcs record works). – imz -- Ivan Zakharyaschev Jun 17 '14 at 22:44
The same question at Emacs.SE has more interesting answers. – imz -- Ivan Zakharyaschev Jan 24 '15 at 10:01
up vote 8 down vote accepted


I've just found it by looking through files.el where I felt there is such a command:

View the differences between BUFFER and its associated file.

share|improve this answer
The same question at Emacs.SE has more interesting answers: ediff-current-file and highlight-changes-mode. – imz -- Ivan Zakharyaschev Jan 24 '15 at 10:02

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.