Questions tagged [buffer-modified]
13 questions
35
votes
2 answers
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?

nosefrog
- 795
- 6
- 9
12
votes
3 answers
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 recent change to a file. I'd like to be able to…

Dan
- 32,584
- 6
- 98
- 168
9
votes
1 answer
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 and on when it's not.
I've read the documentation…

nanny
- 5,704
- 18
- 38
8
votes
1 answer
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 external changes.
In emacs I have to press C-x C-v…

Nisba
- 895
- 8
- 19
8
votes
1 answer
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?

Mark Karpov
- 4,893
- 1
- 24
- 53
4
votes
1 answer
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 to the headlines, and only being able to edit…

Singulaere Entitaet
- 598
- 5
- 14
3
votes
2 answers
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 resets but then the first undo command doesn't set…

elvengadoribazar
- 31
- 1
2
votes
2 answers
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?

Nova
- 1,059
- 9
- 21
2
votes
1 answer
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-hook to detect changes in markdown buffer.
Buffer…

Chillar Anand
- 4,042
- 1
- 23
- 52
1
vote
1 answer
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 prompted to save the buffer when I kill it?
Edit: I…

jdigital
- 125
- 5
1
vote
1 answer
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
Diff finished (no differences).
How can I stop .cs…

Stewart Smith
- 141
- 8
0
votes
0 answers
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 (such as for example completion list or org…

Nicolas Rougier
- 487
- 3
- 15
0
votes
1 answer
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 function modifies the buffer, but undoes those…

AlwaysLearning
- 749
- 4
- 14