2

I'm customizing mode line and i want to put a string "Unsaved" on it, if the file is modified. How to find out directly from elisp, whether the current buffer in Emacs is modified?

Mirzhan Irkegulov
  • 17,660
  • 12
  • 105
  • 166
  • 4
    Note that by default Emacs already shows you that the buffer has been modified by displaying two asterisks on the left end of the modeline. – Thomas May 17 '12 at 02:05

1 Answers1

7

Found out there is a function buffer-modified-p:

Function: buffer-modified-p &optional buffer

This function returns t if the buffer buffer has been modified since it was last read in from a file or saved, or nil otherwise. If buffer is not supplied, the current buffer is tested.

Source: Emacs Lisp Reference/Buffers

Community
  • 1
  • 1
Mirzhan Irkegulov
  • 17,660
  • 12
  • 105
  • 166