From: Thorsten Jolitz <tjolitz@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: How to determine buffer change
Date: Sat, 05 Apr 2014 16:54:28 +0200 [thread overview]
Message-ID: <87ioqnddy3.fsf@gmail.com> (raw)
In-Reply-To: jwvmwfzri5u.fsf-monnier+gmane.emacs.help@gnu.org
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>>> in a program I insert text in an empty temporary edit-buffer, what of
>>> course modifies the `buffer-undo-list'.
>>> Assume that at this moment (lets call it time T1)
>>>
>>> ,------------------------------
>>> | M-: (length buffer-undo-list)
>>> `------------------------------
>>>
>>> returns 9.
>>>
>>> Now when there are changes to the text in the edit-buffer, these are
>>> copied to the original buffer after quitting. But when nothing has
>>> changed after the insertion of the original text, it would be better to
>>> simply discard the edit-buffer and not touch the original buffer at
>>> all.
>>>
>>> I could remember the length of the buffer-undo-list at time T1 and then
>>> check if it changed when quitting, but this does not seem very robust,
>>> since this length grows and shrinks in both directions.
>
>> Did you try using buffer-modified-tick?
> set buffer-undo-list to nil (after all, so you really want the user to
> be able to un-insert the initial text?).
No, I don't, and the simplest solutions are often the best but don't
come to ones mind first. That works like a charm, thanks.
--
cheers,
Thorsten
prev parent reply other threads:[~2014-04-05 14:54 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-05 11:41 How to determine buffer change Thorsten Jolitz
2014-04-05 11:49 ` Thorsten Jolitz
2014-04-05 11:59 ` Eli Zaretskii
2014-04-05 12:52 ` Thorsten Jolitz
2014-04-05 13:23 ` Thorsten Jolitz
2014-04-05 14:00 ` Stefan Monnier
2014-04-05 14:54 ` Thorsten Jolitz [this message]
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ioqnddy3.fsf@gmail.com \
--to=tjolitz@gmail.com \
--cc=help-gnu-emacs@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.
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).