简体   繁体   English

从elisp查找是否已修改Emacs缓冲区

[英]Find from elisp if Emacs buffer is modified

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? 如何直接从elisp找出Emacs中的当前缓冲区是否被修改?

Found out there is a function buffer-modified-p : 发现有一个功能buffer-modified-p

Function: buffer-modified-p &optional buffer 函数:buffer-modified-p和可选缓冲区

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. 如果自从上次从文件中读取或保存缓冲区以来已修改缓冲区,则此函数返回t,否则返回nil。 If buffer is not supplied, the current buffer is tested. 如果未提供缓冲区,则测试当前缓冲区。

Source: Emacs Lisp Reference/Buffers 来源: Emacs Lisp参考/缓冲区

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM