Find from elisp if Emacs buffer is modified

855 views Asked by At

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?

1

There are 1 answers

0
Mirzhan Irkegulov On BEST ANSWER

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