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?
Asked
Active
Viewed 802 times
2
-
4Note 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 Answers
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