all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: emacs-devel@gnu.org
Subject: using text properties in a buffer that is older than its file
Date: Fri, 31 Jul 2015 11:20:40 -0700 (PDT)	[thread overview]
Message-ID: <7af1a5b0-01c2-4095-9cc0-91da98738118@default> (raw)

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.



             reply	other threads:[~2015-07-31 18:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-31 18:20 Drew Adams [this message]
2015-07-31 20:17 ` using text properties in a buffer that is older than its file 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7af1a5b0-01c2-4095-9cc0-91da98738118@default \
    --to=drew.adams@oracle.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.