* using text properties in a buffer that is older than its file
@ 2015-07-31 18:20 Drew Adams
2015-07-31 20:17 ` João Távora
2015-07-31 22:02 ` Stefan Monnier
0 siblings, 2 replies; 6+ messages in thread
From: Drew Adams @ 2015-07-31 18:20 UTC (permalink / raw)
To: emacs-devel
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.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: using text properties in a buffer that is older than its file
2015-07-31 18:20 using text properties in a buffer that is older than its file Drew Adams
@ 2015-07-31 20:17 ` João Távora
2015-07-31 20:49 ` Drew Adams
2015-07-31 22:02 ` Stefan Monnier
1 sibling, 1 reply; 6+ messages in thread
From: João Távora @ 2015-07-31 20:17 UTC (permalink / raw)
To: Drew Adams; +Cc: emacs-devel
On Fri, Jul 31, 2015 at 7:20 PM, Drew Adams <drew.adams@oracle.com> wrote:
> Saving, resetting, and restoring `buffer-modified-p' is not
> sufficient to inhibit this user prompting.
> [...]
> I'm hoping that there is already a feature for handling this
> kind of use case, which I'm just unaware of.
`with-silent-modifications' does the trick for me.
I tried with an externally modified file don't get the prompt.
João
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: using text properties in a buffer that is older than its file
2015-07-31 20:17 ` João Távora
@ 2015-07-31 20:49 ` Drew Adams
2015-07-31 20:59 ` Drew Adams
0 siblings, 1 reply; 6+ messages in thread
From: Drew Adams @ 2015-07-31 20:49 UTC (permalink / raw)
To: João Távora; +Cc: emacs-devel
> `with-silent-modifications' does the trick for me.
> I tried with an externally modified file don't get the prompt.
Thank you, João.
I've filed bug # , to get this documented in the Elisp manual.
It's apparently been around since Emacs 23.
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: using text properties in a buffer that is older than its file
2015-07-31 20:49 ` Drew Adams
@ 2015-07-31 20:59 ` Drew Adams
0 siblings, 0 replies; 6+ messages in thread
From: Drew Adams @ 2015-07-31 20:59 UTC (permalink / raw)
To: João Távora; +Cc: emacs-devel
> > `with-silent-modifications'...
>
> I've filed bug # , to get this documented in the Elisp manual.
21171
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: using text properties in a buffer that is older than its file
2015-07-31 18:20 using text properties in a buffer that is older than its file Drew Adams
2015-07-31 20:17 ` João Távora
@ 2015-07-31 22:02 ` Stefan Monnier
2015-07-31 22:10 ` Drew Adams
1 sibling, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2015-07-31 22:02 UTC (permalink / raw)
To: Drew Adams; +Cc: emacs-devel
> Saving, resetting, and restoring `buffer-modified-p' is not
> sufficient to inhibit this user prompting.
C-h f with-silent-modifications RET
Stefan
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: using text properties in a buffer that is older than its file
2015-07-31 22:02 ` Stefan Monnier
@ 2015-07-31 22:10 ` Drew Adams
0 siblings, 0 replies; 6+ messages in thread
From: Drew Adams @ 2015-07-31 22:10 UTC (permalink / raw)
To: Stefan Monnier; +Cc: emacs-devel
> > Saving, resetting, and restoring `buffer-modified-p' is not
> > sufficient to inhibit this user prompting.
>
> C-h f with-silent-modifications RET
Yes, thanks. (João beat you to it - thanks to both.)
And please see bug #21171.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-07-31 22:10 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-31 18:20 using text properties in a buffer that is older than its file Drew Adams
2015-07-31 20:17 ` João Távora
2015-07-31 20:49 ` Drew Adams
2015-07-31 20:59 ` Drew Adams
2015-07-31 22:02 ` Stefan Monnier
2015-07-31 22:10 ` Drew Adams
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).