Questions tagged [buffer-modified]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
21
votes
2answers
5k views

How can I see the changes made to a modified buffer since the last save?

Given a modified buffer, how can I diff it with the file backing it on disk to see what I've changed?
11
votes
3answers
671 views

How to modify a buffer without undo noticing?

Q: How do I insert/modify text in a buffer without undo noticing? Here's the use case. I have a comment block at the start of every file that, among other things, updates a timestamp for the most ...
8
votes
1answer
153 views

How to perform a modifying action without modifying buffer?

I want to add properties to text (make it read-only temporarily) and I don't want “modification-status” change. In general, how do I perform some modifying action without Emacs noticing it?
8
votes
1answer
798 views

How to hook into buffer modified state?

Such as in the built-in variable mode-line-modified which displays an asterisk in the mode line if the buffer is modified. Specifically, I want to turn hl-line-mode off when the buffer is modified ...
4
votes
1answer
2k views

automatically update buffers when focusing if file changed

When programming, I often switch from emacs to Xcode and viceversa. When I switch to Xcode, it automatically updates the current file when I focus Xcode window, if it detects that there are some ...
4
votes
1answer
56 views

Prevent specific parts of buffer from being editable

I wonder if it is possible to prevent specific parts of a buffer from being editable. For example, when I have outlined my document in an org-mode file, I would like to prevent any accidental changes ...
3
votes
2answers
116 views

After (set-buffer-modified-p nil), the first undo command doesn't set the buffer modified flag to true

If I modify a buffer and then save it, the buffer modified flag resets and the subsequent undo commands set the buffer modified flag to true. However if I use (set-buffer-modified-p nil), the flag ...
2
votes
1answer
345 views

How to chain after-change-hook functions?

I am trying to convert markdown to html and then use impatient-mode to display it live on browser on the fly. Impatient mode uses after-change-hook to detect changes in html. I am using after-change-...
1
vote
2answers
100 views

Resolving the conflict when the file on disk has been changed

When a file changes on disk while you're editing in Emacs, how to merge both sets of changes into the file?
1
vote
1answer
64 views

preventing save prompt for temp files

I often open temp files and I don't care about saving the contents when I modify the buffer. How can I tell Emacs to ignore buffer changes when the filename matches a pattern, so that I don't get ...
1
vote
1answer
40 views

CSharp files modified on open

When I open files that default to csharp-mode, they always start modified. This is only occurring for csharp-mode. save-buffers-kill-emacs with the d option (view changes in this buffer) shows ...
0
votes
1answer
76 views

Using `with-silent-modifications` when modifying the buffer and undoing those modifications without using `undo`

I wrote a wrapper for the existing export function. My wrapper adds an appropriate bibliography: link, calls the original export function and then removes the bibliography: link. In summary, the ...
0
votes
0answers
18 views

How to detect modified buffer in the mode-line, skipping special buffers?

I'm trying to have my mode-line to display a "(modified)" string instead of the * mark. To do that, I make a test with buffer-modified-p but this seems to be always true for "special" buffers as well (...