[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
using text properties in a buffer that is older than its file
From: |
Drew Adams |
Subject: |
using text properties in a buffer that is older than its file |
Date: |
Fri, 31 Jul 2015 11:20:40 -0700 (PDT) |
Suppose some code just modifies some text properties. This is
considered by Emacs to be a buffer modification, and if the
file has been changed externally since it was last visited in
the Emacs session, then trying to modify the text properties
prompts the user with:
... changed on disk; really edit the buffer?
(This is done by `ask-user-about-supersession-threat'.)
Saving, resetting, and restoring `buffer-modified-p' is not
sufficient to inhibit this user prompting. And if the code
is called multiple times then the user gets prompted multiple
times (assuming a response that keeps the buffer unsynced).
What is a good way to inhibit this prompting? Binding
`buffer-file-name' to nil works, but is there a better way?
Is there now (shouldn't there be?) a way to tell Emacs that
within some scope it should not consider text-property changes
to be buffer modifications - at least for purposes of
consideration by `ask-user-about-supersession-threat'?
That would be much better than binding `buffer-file-name', as
it could be done around code that might let a user modify the
buffer (text changes, not just property changes), and the user
would still get prompted for any real text change.
I'm hoping that there is already a feature for handling this
kind of use case, which I'm just unaware of.
- using text properties in a buffer that is older than its file,
Drew Adams <=