From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.help Subject: Re: How to determine buffer change Date: Sat, 05 Apr 2014 14:59:02 +0300 Message-ID: <83d2gw7zsp.fsf@gnu.org> References: <877g74dmve.fsf@gmail.com> NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1396699158 5424 80.91.229.3 (5 Apr 2014 11:59:18 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 5 Apr 2014 11:59:18 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Apr 05 13:59:11 2014 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1WWPFf-0005yV-B6 for geh-help-gnu-emacs@m.gmane.org; Sat, 05 Apr 2014 13:59:11 +0200 Original-Received: from localhost ([::1]:54215 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WWPFf-0003fQ-1m for geh-help-gnu-emacs@m.gmane.org; Sat, 05 Apr 2014 07:59:11 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58799) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WWPFM-0003eQ-7r for help-gnu-emacs@gnu.org; Sat, 05 Apr 2014 07:58:59 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WWPFE-0004rd-OL for help-gnu-emacs@gnu.org; Sat, 05 Apr 2014 07:58:52 -0400 Original-Received: from mtaout20.012.net.il ([80.179.55.166]:49256) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WWPFE-0004rV-Fz for help-gnu-emacs@gnu.org; Sat, 05 Apr 2014 07:58:44 -0400 Original-Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0N3K00J003KUP200@a-mtaout20.012.net.il> for help-gnu-emacs@gnu.org; Sat, 05 Apr 2014 14:58:43 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0N3K00JT83XUCB80@a-mtaout20.012.net.il> for help-gnu-emacs@gnu.org; Sat, 05 Apr 2014 14:58:43 +0300 (IDT) In-reply-to: <877g74dmve.fsf@gmail.com> X-012-Sender: halo1@inter.net.il X-detected-operating-system: by eggs.gnu.org: Solaris 10 X-Received-From: 80.179.55.166 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:97005 Archived-At: > From: Thorsten Jolitz > Date: Sat, 05 Apr 2014 13:41:41 +0200 > > 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?