unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* 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

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).