From unknown Wed Jun 18 23:14:28 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#11774 <11774@debbugs.gnu.org> To: bug#11774 <11774@debbugs.gnu.org> Subject: Status: org-mode causes undo boundaries to be lost Reply-To: bug#11774 <11774@debbugs.gnu.org> Date: Thu, 19 Jun 2025 06:14:28 +0000 retitle 11774 org-mode causes undo boundaries to be lost reassign 11774 emacs,org-mode submitter 11774 Toby Cubitt severity 11774 normal thanks From debbugs-submit-bounces@debbugs.gnu.org Sun Jun 24 17:32:00 2012 Received: (at submit) by debbugs.gnu.org; 24 Jun 2012 21:32:00 +0000 Received: from localhost ([127.0.0.1]:55520 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SiuPX-0001Ep-4A for submit@debbugs.gnu.org; Sun, 24 Jun 2012 17:31:59 -0400 Received: from eggs.gnu.org ([208.118.235.92]:57560) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SiuPU-0001Ef-3G for submit@debbugs.gnu.org; Sun, 24 Jun 2012 17:31:57 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SiuLi-000678-TK for submit@debbugs.gnu.org; Sun, 24 Jun 2012 17:28:04 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.2 Received: from lists.gnu.org ([208.118.235.17]:52653) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SiuLi-000673-Po for submit@debbugs.gnu.org; Sun, 24 Jun 2012 17:28:02 -0400 Received: from eggs.gnu.org ([208.118.235.92]:48548) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SiuLg-0000eK-Vx for bug-gnu-emacs@gnu.org; Sun, 24 Jun 2012 17:28:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SiuLe-00066g-RZ for bug-gnu-emacs@gnu.org; Sun, 24 Jun 2012 17:28:00 -0400 Received: from sanddollar.geekisp.com ([216.168.135.167]:24134) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SiuLe-00066T-Mu for bug-gnu-emacs@gnu.org; Sun, 24 Jun 2012 17:27:58 -0400 Received: (qmail 29586 invoked by uid 1003); 24 Jun 2012 21:27:55 -0000 Received: from localhost (localhost.geekisp.com [127.0.0.1]) by localhost.geekisp.com (tmda-ofmipd) with ESMTP; Sun, 24 Jun 2012 17:27:53 -0400 Date: Sun, 24 Jun 2012 23:27:55 +0200 To: bug-gnu-emacs@gnu.org Subject: org-mode causes undo boundaries to be lost Message-ID: <20120624212755.GA14501@c3po.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-PGP-Key: http://www.dr-qubit.org/gpg-toby.asc User-Agent: Mutt/1.5.21 (2010-09-15) X-Delivery-Agent: TMDA/1.1.11 (Ladyburn) From: Toby Cubitt X-Primary-Address: toby@dr-qubit.org X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 208.118.235.17 X-Spam-Score: -6.1 (------) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list Reply-To: Toby Cubitt List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.1 (------) Steps to reproduce, starting from "emacs -Q": 1. C-x C-f test.org 2. M-x org-mode 3. M-: (add-hook 'post-command-hook (lambda () (message "%s" buffer-undo-list)) nil t) 4. type "a" 5. C- C- 6. type "bc" Expected behaviour: contents of `buffer-undo-list' after step 6. should be ((2 . 4) nil (1 . 2) (t . -1)) Actual behaviour: contents of `buffer-undo-list' after step 6. are ((2 . 4) (1 . 2) (t . -1)) For some unknown reason, org-mode is causing the undo boundary between the (2 . 4) and (1 . 2) entries to be removed from `buffer-undo-list'. If we try the same thing under another major mode (e.g. replace step 2 with "M-x text-mode"), then `buffer-undo-list' does contain the undo boundary, as expected. Step 3 is there to monitor what's going on. The same results are obtained if that step is omitted. However, with the post-command-hook enabled, you can see that the undo boundary is still there after typing "b" in step 6, but gets deleted after typing "c". This might look like a minor bug, but it can have severe consequences. E.g. when using undo-tree-mode in org-mode, the corrupted `buffer-undo-list' contents cause undo-tree-mode to discard the entire undo history. Toby In GNU Emacs 24.1.50.2 (i686-pc-linux-gnu, GTK+ Version 2.24.10) of 2012-06-20 on c3po Windowing system distributor `The X.Org Foundation', version 11.0.11104000 Configured using: `configure '--prefix=/usr' '--host=i686-pc-linux-gnu' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--datadir=/usr/share' '--sysconfdir=/etc' '--localstatedir=/var/lib' '--disable-dependency-tracking' '--program-suffix=-emacs-24-vcs' '--infodir=/usr/share/info/emacs-24-vcs' '--enable-locallisppath=/etc/emacs:/usr/share/emacs/site-lisp' '--with-crt-dir=/usr/lib/gcc/i686-pc-linux-gnu/4.5.3/../../../../lib' '--with-gameuser=games' '--without-compress-info' '--without-hesiod' '--without-kerberos' '--without-kerberos5' '--with-gpm' '--with-dbus' '--without-gnutls' '--without-xml2' '--without-selinux' '--without-wide-int' '--without-sound' '--with-x' '--without-ns' '--without-gconf' '--without-gsettings' '--with-toolkit-scroll-bars' '--without-gif' '--without-jpeg' '--with-png' '--with-rsvg' '--without-tiff' '--with-xpm' '--without-imagemagick' '--with-xft' '--without-libotf' '--without-m17n-flt' '--with-x-toolkit=gtk' 'EBZR_BRANCH=trunk' 'EBZR_REVNO=108667' '--build=i686-pc-linux-gnu' 'build_alias=i686-pc-linux-gnu' 'host_alias=i686-pc-linux-gnu' 'CFLAGS=-march=prescott -O2 -pipe -O2' 'LDFLAGS=-Wl,-O1 -Wl,--as-needed' 'CPPFLAGS='' Important settings: value of $LANG: en_GB.utf-8 locale-coding-system: utf-8-unix default enable-multibyte-characters: t -- Dr T. S. Cubitt Mathematics and Quantum Information group Department of Mathematics Complutense University Madrid, Spain email: tsc25@cantab.net web: www.dr-qubit.org From debbugs-submit-bounces@debbugs.gnu.org Sun Jun 24 17:42:30 2012 Received: (at 11774) by debbugs.gnu.org; 24 Jun 2012 21:42:30 +0000 Received: from localhost ([127.0.0.1]:55539 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SiuZh-0001TH-Rb for submit@debbugs.gnu.org; Sun, 24 Jun 2012 17:42:30 -0400 Received: from mail-we0-f172.google.com ([74.125.82.172]:59959) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SiuZf-0001T9-DM for 11774@debbugs.gnu.org; Sun, 24 Jun 2012 17:42:28 -0400 Received: by werb13 with SMTP id b13so2403561wer.3 for <11774@debbugs.gnu.org>; Sun, 24 Jun 2012 14:38:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=sender:from:to:cc:subject:in-reply-to:organization:references :user-agent:date:message-id:mime-version:content-type; bh=eXppJA+c/rdJfk/4Dx7Mp2RIjQhXY6nbZW2+WvcBhsQ=; b=Zz+qfHNDSB6WdWF6Zp1MolAVIBTPEMqE7rqqGeDPvEkFcw1J6/2E7i/J9QYSTQdU3C xN4l/qVdtSGePosntCw4InAVs7PouxxML1jSbAh4HA16WpCzU70G1R4J8vDufis5Pi5Y TmyoL/1maaIrSBeT8RBdrOK3tPoOR3XbFlHc2MknvixPvNCX6HGgUJzXFwse0XVlOIoR UMcCb9Ce/uFaTFJijcZOAp7ykPL5vgmEy4IzAWQ9iL8+S4jnXU9RLGoh1QRJ3bD/gmXc ZW3HgVtkLM6V4vTGgVle+sRMxxdbMC2YJvd5sbzv1Kl087mw/xkwexV9K7nBilO4QMxB fnjQ== Received: by 10.216.212.1 with SMTP id x1mr5136129weo.143.1340573914833; Sun, 24 Jun 2012 14:38:34 -0700 (PDT) Received: from myhost.localdomain (mar75-2-81-56-68-112.fbx.proxad.net. [81.56.68.112]) by mx.google.com with ESMTPS id fu8sm13002508wib.5.2012.06.24.14.38.30 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 24 Jun 2012 14:38:33 -0700 (PDT) Received: by myhost.localdomain (Postfix, from userid 1000) id 4988286BF; Sun, 24 Jun 2012 23:39:08 +0200 (CEST) From: Bastien To: Toby Cubitt Subject: Re: bug#11774: org-mode causes undo boundaries to be lost In-Reply-To: <20120624212755.GA14501@c3po.home> (Toby Cubitt's message of "Sun, 24 Jun 2012 23:27:55 +0200") Organization: GNU References: <20120624212755.GA14501@c3po.home> User-Agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.1.50 (gnu/linux) Date: Sun, 24 Jun 2012 23:39:08 +0200 Message-ID: <87395kcrur.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 11774 Cc: 11774@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Hi Toby, Toby Cubitt writes: > For some unknown reason, org-mode is causing the undo boundary between > the (2 . 4) and (1 . 2) entries to be removed from `buffer-undo-list'. Can you try again with (setq org-self-insert-cluster-for-undo nil) and report? Thanks, -- Bastien From debbugs-submit-bounces@debbugs.gnu.org Sun Jun 24 17:56:36 2012 Received: (at 11774) by debbugs.gnu.org; 24 Jun 2012 21:56:36 +0000 Received: from localhost ([127.0.0.1]:55552 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SiunM-0001m1-CN for submit@debbugs.gnu.org; Sun, 24 Jun 2012 17:56:36 -0400 Received: from sanddollar.geekisp.com ([216.168.135.167]:17609) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SiunK-0001lu-UJ for 11774@debbugs.gnu.org; Sun, 24 Jun 2012 17:56:35 -0400 Received: (qmail 31258 invoked by uid 1003); 24 Jun 2012 21:52:42 -0000 Received: from localhost (localhost.geekisp.com [127.0.0.1]) by localhost.geekisp.com (tmda-ofmipd) with ESMTP; Sun, 24 Jun 2012 17:52:39 -0400 Date: Sun, 24 Jun 2012 23:52:41 +0200 To: Bastien Subject: Re: bug#11774: org-mode causes undo boundaries to be lost Message-ID: <20120624215241.GA6205@c3po.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87395kcrur.fsf@gnu.org> X-PGP-Key: http://www.dr-qubit.org/gpg-toby.asc User-Agent: Mutt/1.5.21 (2010-09-15) X-Delivery-Agent: TMDA/1.1.11 (Ladyburn) From: Toby Cubitt X-Primary-Address: toby@dr-qubit.org X-Spam-Score: -0.4 (/) X-Debbugs-Envelope-To: 11774 Cc: 11774@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -0.4 (/) On Sun, Jun 24, 2012 at 11:39:08PM +0200, Bastien wrote: > Hi Toby, > > Toby Cubitt writes: > > > For some unknown reason, org-mode is causing the undo boundary between > > the (2 . 4) and (1 . 2) entries to be removed from `buffer-undo-list'. > > Can you try again with > > (setq org-self-insert-cluster-for-undo nil) > > and report? Yup, that fixes the problem. I don't fully understand the purpose of `org-self-insert-cluster-for-undo', given that the Emacs command loop already groups consecutive undo entries together, but presumably it enables a more aggressive form of clustering. If the behaviour I reported is the intended behaviour with this option set, perhaps the clustering heuristic can be improved to avoid triggering history discarding in undo-tree-mode? undo-tree-mode puts a "canary" at the end of buffer-undo-list, to detect when Emacs discards undo history behind undo-tree-mode's back. I.e. before any undo entries have been added, buffer-undo-list contains: (nil undo-tree-canary) org-mode's undo clustering deletes the undo boundary before the undo-tree-canary entry, causing undo-tree-mode to think that Emacs has discarded undo history behind its back. I could try to work around this in undo-tree-mode, but it seems to me that org-mode shouldn't be throwing away an undo boundary that comes before an entry which definitely shouldn't be clustered with anything (namely the undo-tree-canary symbol, which is meaningless to org-mode). Toby -- Dr T. S. Cubitt Mathematics and Quantum Information group Department of Mathematics Complutense University Madrid, Spain email: tsc25@cantab.net web: www.dr-qubit.org From debbugs-submit-bounces@debbugs.gnu.org Mon Jun 25 07:39:35 2012 Received: (at 11774) by debbugs.gnu.org; 25 Jun 2012 11:39:36 +0000 Received: from localhost ([127.0.0.1]:56766 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Sj7dj-0000Eh-FT for submit@debbugs.gnu.org; Mon, 25 Jun 2012 07:39:35 -0400 Received: from starfish.geekisp.com ([216.168.135.166]:28334) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Sj7dd-0000ES-4r for 11774@debbugs.gnu.org; Mon, 25 Jun 2012 07:39:29 -0400 Received: (qmail 13750 invoked by uid 1003); 25 Jun 2012 11:35:29 -0000 Received: from localhost (localhost.geekisp.com [127.0.0.1]) by localhost.geekisp.com (tmda-ofmipd) with ESMTP; Mon, 25 Jun 2012 07:35:27 -0400 Date: Mon, 25 Jun 2012 13:35:29 +0200 To: Bastien Subject: Re: bug#11774: org-mode causes undo boundaries to be lost Message-ID: <20120625113529.GA15913@c3po.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20120624215241.GA6205@c3po.home> X-PGP-Key: http://www.dr-qubit.org/gpg-toby.asc User-Agent: Mutt/1.5.21 (2010-09-15) X-Delivery-Agent: TMDA/1.1.11 (Ladyburn) From: Toby Cubitt X-Primary-Address: toby@dr-qubit.org X-Spam-Score: -0.4 (/) X-Debbugs-Envelope-To: 11774 Cc: 11774@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -0.4 (/) On Sun, Jun 24, 2012 at 11:52:41PM +0200, Toby Cubitt wrote: > On Sun, Jun 24, 2012 at 11:39:08PM +0200, Bastien wrote: > > Hi Toby, > > > > Toby Cubitt writes: > > > > > For some unknown reason, org-mode is causing the undo boundary between > > > the (2 . 4) and (1 . 2) entries to be removed from `buffer-undo-list'. > > > > Can you try again with > > > > (setq org-self-insert-cluster-for-undo nil) > > > > and report? > > Yup, that fixes the problem. > > I don't fully understand the purpose of > `org-self-insert-cluster-for-undo', given that the Emacs command loop > already groups consecutive undo entries together, but presumably it > enables a more aggressive form of clustering. > [snip] > > I could try to work around this in undo-tree-mode, but it seems to me > that org-mode shouldn't be throwing away an undo boundary that comes > before an entry which definitely shouldn't be clustered with anything > (namely the undo-tree-canary symbol, which is meaningless to org-mode). I've now added a work-around for this in undo-tree-mode (currently only in git, but I'll push to ELPA once it's sufficiently tested). I'm still not entirely convinced that the boundary discarding logic in org-self-insert-command is correct. For example, if I do the following: 1. Type some text at some location in an org-mode buffer 2. Move to another location very far away (without invoking any commands other than point motion) 3. Type some more text then org-self-insert-cluster-for-undo collapses the undo changesets for these two changes into one. Undoing then reverts both sets of changes at once, even though those changes might be so far apart that they aren't both visible at the same time in the buffer. That seems very undesirable to me. But as I can work around it in undo-tree-mode, I'll leave it up to Bastien to decide whether or not this feature needs reworking in org-mode. Best, Toby -- Dr T. S. Cubitt Mathematics and Quantum Information group Department of Mathematics Complutense University Madrid, Spain email: tsc25@cantab.net web: www.dr-qubit.org From debbugs-submit-bounces@debbugs.gnu.org Mon Jul 02 02:56:33 2012 Received: (at 11774) by debbugs.gnu.org; 2 Jul 2012 06:56:33 +0000 Received: from localhost ([127.0.0.1]:41031 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SlaYj-0000Vp-2l for submit@debbugs.gnu.org; Mon, 02 Jul 2012 02:56:33 -0400 Received: from os.inf.tu-dresden.de ([141.76.48.99]:49487) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SlaYe-0000Vd-If for 11774@debbugs.gnu.org; Mon, 02 Jul 2012 02:56:30 -0400 Received: from [84.179.214.51] (helo=[192.168.2.111]) by os.inf.tu-dresden.de with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.80) id 1SlaUA-0001np-MD; Mon, 02 Jul 2012 08:51:51 +0200 Message-ID: <4FF14504.10609@os.inf.tu-dresden.de> Date: Mon, 02 Jul 2012 08:51:48 +0200 From: Martin Pohlack User-Agent: Mozilla/5.0 (X11; Linux i686; rv:12.0) Gecko/20120430 Thunderbird/12.0.1 MIME-Version: 1.0 To: Toby Cubitt Subject: Re: [O] bug#11774: org-mode causes undo boundaries to be lost References: <20120624212755.GA14501@c3po.home> <20120625113529.GA15913@c3po.home> In-Reply-To: <20120625113529.GA15913@c3po.home> X-Enigmail-Version: 1.4.1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 11774 Cc: Bastien , 11774@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) Hi Toby, On 25.06.2012 13:35, Toby Cubitt wrote: > On Sun, Jun 24, 2012 at 11:52:41PM +0200, Toby Cubitt wrote: >> On Sun, Jun 24, 2012 at 11:39:08PM +0200, Bastien wrote: >>> Hi Toby, >>> >>> Toby Cubitt writes: >>> >>>> For some unknown reason, org-mode is causing the undo boundary between >>>> the (2 . 4) and (1 . 2) entries to be removed from `buffer-undo-list'. >>> >>> Can you try again with >>> >>> (setq org-self-insert-cluster-for-undo nil) >>> >>> and report? >> >> Yup, that fixes the problem. >> >> I don't fully understand the purpose of >> `org-self-insert-cluster-for-undo', given that the Emacs command loop >> already groups consecutive undo entries together, but presumably it >> enables a more aggressive form of clustering. >> > [snip] >> >> I could try to work around this in undo-tree-mode, but it seems to me >> that org-mode shouldn't be throwing away an undo boundary that comes >> before an entry which definitely shouldn't be clustered with anything >> (namely the undo-tree-canary symbol, which is meaningless to org-mode). > > I've now added a work-around for this in undo-tree-mode (currently only > in git, but I'll push to ELPA once it's sufficiently tested). > > I'm still not entirely convinced that the boundary discarding logic in > org-self-insert-command is correct. For example, if I do the following: > > 1. Type some text at some location in an org-mode buffer > 2. Move to another location very far away > (without invoking any commands other than point motion) > 3. Type some more text > > then org-self-insert-cluster-for-undo collapses the undo changesets for > these two changes into one. Undoing then reverts both sets of changes at > once, even though those changes might be so far apart that they aren't > both visible at the same time in the buffer. > > That seems very undesirable to me. Having been involved in org-mode's collapsing code I am interested in this, but I cannot reproduce your problem. I used a very large org-mode file, inserted some text, moved down some pages and inserted some text again (3 chars each). Undoing was split between both parts, exactly as desired. Could you provide more details please? Thanks, Martin From debbugs-submit-bounces@debbugs.gnu.org Tue Jul 03 11:23:28 2012 Received: (at 11774) by debbugs.gnu.org; 3 Jul 2012 15:23:28 +0000 Received: from localhost ([127.0.0.1]:45379 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Sm4wq-0002Qc-DN for submit@debbugs.gnu.org; Tue, 03 Jul 2012 11:23:28 -0400 Received: from os.inf.tu-dresden.de ([141.76.48.99]:35412) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Sm4wo-0002QT-4N for 11774@debbugs.gnu.org; Tue, 03 Jul 2012 11:23:27 -0400 Received: from [217.9.48.20] (helo=[165.204.15.163]) by os.inf.tu-dresden.de with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.80) id 1Sm4sD-0000eR-CJ; Tue, 03 Jul 2012 17:18:41 +0200 Message-ID: <4FF30D50.8010009@os.inf.tu-dresden.de> Date: Tue, 03 Jul 2012 17:18:40 +0200 From: Martin Pohlack User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120615 Thunderbird/13.0.1 MIME-Version: 1.0 To: Toby Cubitt Subject: Re: [O] bug#11774: org-mode causes undo boundaries to be lost References: <20120703095729.GA6651@c3po> In-Reply-To: <20120703095729.GA6651@c3po> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 11774 Cc: Bastien , 11774@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) On 03.07.2012 11:57, Toby Cubitt wrote: > On Mon, Jul 02, 2012 at 08:51:48AM +0200, Martin Pohlack wrote: >>> I'm still not entirely convinced that the boundary discarding logic in >>> org-self-insert-command is correct. For example, if I do the following: >>> >>> 1. Type some text at some location in an org-mode buffer >>> 2. Move to another location very far away >>> (without invoking any commands other than point motion) >>> 3. Type some more text >>> >>> then org-self-insert-cluster-for-undo collapses the undo changesets for >>> these two changes into one. Undoing then reverts both sets of changes at >>> once, even though those changes might be so far apart that they aren't >>> both visible at the same time in the buffer. >>> >>> That seems very undesirable to me. >> >> Having been involved in org-mode's collapsing code I am interested in >> this, but I cannot reproduce your problem. I used a very large org-mode >> file, inserted some text, moved down some pages and inserted some text >> again (3 chars each). Undoing was split between both parts, exactly as >> desired. Could you provide more details please? > > > Sure. The following steps produce the effect I described, at least for > me. This is on a fairly recent (a couple of weeks old) bzr build of > Emacs, and a similarly recent git build of org-mode: > > 1. $ emacs -Q > 2. C-x C-f test.org > 3. M-x org-mode [not really necessary since already in org-mode] > 5. C-u 50 M-x newline > 6. M-< > 7. type "a" > 8. M-> > 9. type "bc" > > buffer-undo-list now contains: > > (nil (52 . 54) (1 . 2) nil (1 . 51) (t . -1)) > > Note the lack of undo boundary between (52 . 54) and (1 . 2), which means > that undoing once (C-/) deletes both "bc" *and* "a" in one step. Understood. I tried exactly the same thing with an older emacs (GNU Emacs 23.2.1 (x86_64-pc-linux-gnu, GTK+ Version 2.24.4) of 2011-04-04 on crested, modified by Debian) and org-mode (6.33x and 7.6) and have this result: (nil (53 . 54) (52 . 53) nil (1 . 2) nil (1 . 51) (t 65535 . 65535)) Which is what one wants. Someone seems to be merging the self-insert commands in your situation. Probably the native merging code has changed in recent emacs itself. If this is confirmed, we could modify org-mode's merging code to only merge undo entries that span one character. Martin From debbugs-submit-bounces@debbugs.gnu.org Tue Jul 03 11:49:12 2012 Received: (at 11774) by debbugs.gnu.org; 3 Jul 2012 15:49:12 +0000 Received: from localhost ([127.0.0.1]:45424 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Sm5Lj-00031O-Fx for submit@debbugs.gnu.org; Tue, 03 Jul 2012 11:49:12 -0400 Received: from starfish.geekisp.com ([216.168.135.166]:4352) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Sm2ss-00073s-2g for 11774@debbugs.gnu.org; Tue, 03 Jul 2012 09:11:14 -0400 Received: (qmail 28190 invoked by uid 1003); 3 Jul 2012 13:06:32 -0000 Received: from localhost (localhost.geekisp.com [127.0.0.1]) by localhost.geekisp.com (tmda-ofmipd) with ESMTP; Tue, 03 Jul 2012 09:06:29 -0400 Date: Tue, 3 Jul 2012 11:57:29 +0200 To: Martin Pohlack Subject: Re: [O] bug#11774: org-mode causes undo boundaries to be lost Message-ID: <20120703095729.GA6651@c3po> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4FF14504.10609@os.inf.tu-dresden.de> X-PGP-Key: http://www.dr-qubit.org/gpg-toby.asc User-Agent: Mutt/1.5.21 (2010-09-15) X-Delivery-Agent: TMDA/1.1.11 (Ladyburn) From: Toby Cubitt X-Primary-Address: toby@dr-qubit.org X-Spam-Score: 1.2 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has identified this incoming email as possible spam. The original message has been attached to this so you can view it (if it isn't spam) or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: On Mon, Jul 02, 2012 at 08:51:48AM +0200, Martin Pohlack wrote: > > I'm still not entirely convinced that the boundary discarding logic in > > org-self-insert-command is correct. For example, if I do the following: > > > > 1. Type some text at some location in an org-mode buffer > > 2. Move to another location very far away > > (without invoking any commands other than point motion) > > 3. Type some more text > > > > then org-self-insert-cluster-for-undo collapses the undo changesets for > > these two changes into one. Undoing then reverts both sets of changes at > > once, even though those changes might be so far apart that they aren't > > both visible at the same time in the buffer. > > > > That seems very undesirable to me. > > Having been involved in org-mode's collapsing code I am interested in > this, but I cannot reproduce your problem. I used a very large org-mode > file, inserted some text, moved down some pages and inserted some text > again (3 chars each). Undoing was split between both parts, exactly as > desired. Could you provide more details please? [...] Content analysis details: (1.2 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 1.6 DATE_IN_PAST_03_06 Date: is 3 to 6 hours before Received: date -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 1.5 FAKE_REPLY_C FAKE_REPLY_C X-Debbugs-Envelope-To: 11774 X-Mailman-Approved-At: Tue, 03 Jul 2012 11:49:09 -0400 Cc: Bastien , 11774@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: 1.2 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has identified this incoming email as possible spam. The original message has been attached to this so you can view it (if it isn't spam) or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: On Mon, Jul 02, 2012 at 08:51:48AM +0200, Martin Pohlack wrote: > > I'm still not entirely convinced that the boundary discarding logic in > > org-self-insert-command is correct. For example, if I do the following: > > > > 1. Type some text at some location in an org-mode buffer > > 2. Move to another location very far away > > (without invoking any commands other than point motion) > > 3. Type some more text > > > > then org-self-insert-cluster-for-undo collapses the undo changesets for > > these two changes into one. Undoing then reverts both sets of changes at > > once, even though those changes might be so far apart that they aren't > > both visible at the same time in the buffer. > > > > That seems very undesirable to me. > > Having been involved in org-mode's collapsing code I am interested in > this, but I cannot reproduce your problem. I used a very large org-mode > file, inserted some text, moved down some pages and inserted some text > again (3 chars each). Undoing was split between both parts, exactly as > desired. Could you provide more details please? [...] Content analysis details: (1.2 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 1.6 DATE_IN_PAST_03_06 Date: is 3 to 6 hours before Received: date -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 1.5 FAKE_REPLY_C FAKE_REPLY_C On Mon, Jul 02, 2012 at 08:51:48AM +0200, Martin Pohlack wrote: > > I'm still not entirely convinced that the boundary discarding logic in > > org-self-insert-command is correct. For example, if I do the following: > > > > 1. Type some text at some location in an org-mode buffer > > 2. Move to another location very far away > > (without invoking any commands other than point motion) > > 3. Type some more text > > > > then org-self-insert-cluster-for-undo collapses the undo changesets for > > these two changes into one. Undoing then reverts both sets of changes at > > once, even though those changes might be so far apart that they aren't > > both visible at the same time in the buffer. > > > > That seems very undesirable to me. > > Having been involved in org-mode's collapsing code I am interested in > this, but I cannot reproduce your problem. I used a very large org-mode > file, inserted some text, moved down some pages and inserted some text > again (3 chars each). Undoing was split between both parts, exactly as > desired. Could you provide more details please? Sure. The following steps produce the effect I described, at least for me. This is on a fairly recent (a couple of weeks old) bzr build of Emacs, and a similarly recent git build of org-mode: 1. $ emacs -Q 2. C-x C-f test.org 3. M-x org-mode [not really necessary since already in org-mode] 5. C-u 50 M-x newline 6. M-< 7. type "a" 8. M-> 9. type "bc" buffer-undo-list now contains: (nil (52 . 54) (1 . 2) nil (1 . 51) (t . -1)) Note the lack of undo boundary between (52 . 54) and (1 . 2), which means that undoing once (C-/) deletes both "bc" *and* "a" in one step. HTH, Toby -- Dr T. S. Cubitt Mathematics and Quantum Information group Department of Mathematics Complutense University Madrid, Spain email: tsc25@cantab.net web: www.dr-qubit.org From debbugs-submit-bounces@debbugs.gnu.org Tue Jul 03 13:34:37 2012 Received: (at 11774) by debbugs.gnu.org; 3 Jul 2012 17:34:37 +0000 Received: from localhost ([127.0.0.1]:45594 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Sm6zk-0006GV-Ta for submit@debbugs.gnu.org; Tue, 03 Jul 2012 13:34:37 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.182]:15833) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Sm6zj-0006GN-CQ for 11774@debbugs.gnu.org; Tue, 03 Jul 2012 13:34:35 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av0EAG6Zu09MCquH/2dsb2JhbABEtBGBCIIVAQEEAVYjBQsLDiYSFBgNJIgcBboJkEQDozOBWIMF X-IronPort-AV: E=Sophos;i="4.75,637,1330923600"; d="scan'208";a="192556311" Received: from 76-10-171-135.dsl.teksavvy.com (HELO pastel.home) ([76.10.171.135]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 03 Jul 2012 13:29:52 -0400 Received: by pastel.home (Postfix, from userid 20848) id 4AD554E706; Tue, 3 Jul 2012 13:29:51 -0400 (EDT) From: Stefan Monnier To: Martin Pohlack Subject: Re: bug#11774: [O] bug#11774: org-mode causes undo boundaries to be lost Message-ID: References: <20120703095729.GA6651@c3po> <4FF30D50.8010009@os.inf.tu-dresden.de> Date: Tue, 03 Jul 2012 13:29:51 -0400 In-Reply-To: <4FF30D50.8010009@os.inf.tu-dresden.de> (Martin Pohlack's message of "Tue, 03 Jul 2012 17:18:40 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 11774 Cc: Bastien , Toby Cubitt , 11774@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) > Which is what one wants. Someone seems to be merging the self-insert > commands in your situation. Probably the native merging code has > changed in recent Emacs itself. Indeed, self-insert-command used to be treated specially by the read-eval-loop and the merging was performed there. Now this command is handled like any other, and self-insert-command does the merging itself. In most cases the result is the same, but the behavior is not quite identical in the details. Stefan From debbugs-submit-bounces@debbugs.gnu.org Tue Jul 03 14:24:53 2012 Received: (at 11774) by debbugs.gnu.org; 3 Jul 2012 18:24:53 +0000 Received: from localhost ([127.0.0.1]:45716 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Sm7mO-0008Ee-46 for submit@debbugs.gnu.org; Tue, 03 Jul 2012 14:24:52 -0400 Received: from mail-ob0-f172.google.com ([209.85.214.172]:59327) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Sm7fc-00084y-0G for 11774@debbugs.gnu.org; Tue, 03 Jul 2012 14:17:56 -0400 Received: by obbwc20 with SMTP id wc20so10331535obb.3 for <11774@debbugs.gnu.org>; Tue, 03 Jul 2012 11:13:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=Jx50kAJdLBveLkDe8UES29TGsizh1i6ziApFsONqgOc=; b=mcKJCAv4xEwAR48f1pz3YdQX0YdFDP/50plTICjKhvOCVqFHTrn8+S/nmPdYjj9VeJ I06QbQtDwhx9ducufgcj6RXWLpC2VE56QRWUacNP7P09qwYKCwMF4n+Wq2wv6oWiUbuh pEi+1sWvXgDscKox4nIRvPh56RI1bYsekN50ZX7qJeC8wprAZ/TPqDYnYGhKmsJM9Qhe Pfuky+jEYXsKEanqGLBI0ewvOgibfsy2uTEdScm5AFMz6WD16/ObMUko76poe5+/m/ec QqbGCX4ea96Vm9RBvX6Wkno1dmbXrQ7X9qZbL2maSCROP4NNSycYKp4mRnR2Cc5RG9y9 ryIg== MIME-Version: 1.0 Received: by 10.182.207.39 with SMTP id lt7mr4131211obc.67.1341339187667; Tue, 03 Jul 2012 11:13:07 -0700 (PDT) Received: by 10.76.83.6 with HTTP; Tue, 3 Jul 2012 11:13:07 -0700 (PDT) In-Reply-To: References: <20120703095729.GA6651@c3po> <4FF30D50.8010009@os.inf.tu-dresden.de> Date: Tue, 3 Jul 2012 11:13:07 -0700 Message-ID: Subject: Re: [O] bug#11774: bug#11774: org-mode causes undo boundaries to be lost From: Samuel Wales To: Stefan Monnier Content-Type: text/plain; charset=UTF-8 X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 11774 X-Mailman-Approved-At: Tue, 03 Jul 2012 14:24:50 -0400 Cc: Bastien , Martin Pohlack , Toby Cubitt , 11774@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) On 7/3/12, Stefan Monnier wrote: > Indeed, self-insert-command used to be treated specially by the > read-eval-loop and the merging was performed there. Now this command is > handled like any other, and self-insert-command does the merging itself. > In most cases the result is the same, but the behavior is not quite > identical in the details. Here is the way I understand it: There are two problems with self-insert-command now, while before there was only one. The first is that it hardcodes the clustering by 20. As it happens, I strongly prefer clustering by 1. That is, I do not want undo to jump around or type more than necessary. I just want to autorepeat undo (C-/) until I get to where I need to be. Otherwise it is far too jerky and unpredictable and you have to type more either to delete (if you didn't undo far back enough) or add (if you undid too far). This was possible to work around before Emacs 24. You could advise self-insert-command or wrap it. This is why Org was able to control this with a variable to support clustering or not clustering. What is new in Emacs is that self-insert-command now destroys undo-boundary. If you wrap it, it destroys all of your effort on the next call to it. This causes subtle issues such as Org and undo-tree are dealing with. It is not reasonable to work around this because of the extra functionality you need to implement (especially if you want Org to do speed commands, table operations, and tag padding, which, who doesn't?). Unlike before, changing a hardcoded number or undo-boundary and then recompiling Emacs is necessary if you want to fix it. :( The loss of this ability to configure the cluster amount, and the subtle bug introduced, IMO merit a reversion or a fix to Emacs self-insert-command. Even just turning that magic 20 number into a variable would help. At least that's my understanding. I am just a user and I am not familiar with the internals. Samuel -- The Kafka Pandemic: http://thekafkapandemic.blogspot.com From debbugs-submit-bounces@debbugs.gnu.org Tue Jul 03 14:38:28 2012 Received: (at 11774) by debbugs.gnu.org; 3 Jul 2012 18:38:28 +0000 Received: from localhost ([127.0.0.1]:45732 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Sm7zY-00006H-96 for submit@debbugs.gnu.org; Tue, 03 Jul 2012 14:38:28 -0400 Received: from os.inf.tu-dresden.de ([141.76.48.99]:40817) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1Sm7zV-00006A-VP for 11774@debbugs.gnu.org; Tue, 03 Jul 2012 14:38:26 -0400 Received: from [84.179.222.151] (helo=[192.168.2.111]) by os.inf.tu-dresden.de with esmtpsa (TLSv1:DHE-RSA-AES256-SHA:256) (Exim 4.80) id 1Sm7uu-0007na-Ql; Tue, 03 Jul 2012 20:33:41 +0200 Message-ID: <4FF33AFF.10302@os.inf.tu-dresden.de> Date: Tue, 03 Jul 2012 20:33:35 +0200 From: Martin Pohlack User-Agent: Mozilla/5.0 (X11; Linux i686; rv:13.0) Gecko/20120615 Thunderbird/13.0.1 MIME-Version: 1.0 To: Toby Cubitt Subject: Re: [O] bug#11774: org-mode causes undo boundaries to be lost References: <20120624212755.GA14501@c3po.home> <20120625113529.GA15913@c3po.home> In-Reply-To: <20120625113529.GA15913@c3po.home> X-Enigmail-Version: 1.4.2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 11774 Cc: Bastien , 11774@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) On 25.06.2012 13:35, Toby Cubitt wrote: > On Sun, Jun 24, 2012 at 11:52:41PM +0200, Toby Cubitt wrote: >> On Sun, Jun 24, 2012 at 11:39:08PM +0200, Bastien wrote: >>> Hi Toby, >>> >>> Toby Cubitt writes: >>> >>>> For some unknown reason, org-mode is causing the undo boundary between >>>> the (2 . 4) and (1 . 2) entries to be removed from `buffer-undo-list'. >>> >>> Can you try again with >>> >>> (setq org-self-insert-cluster-for-undo nil) >>> >>> and report? >> >> Yup, that fixes the problem. >> >> I don't fully understand the purpose of >> `org-self-insert-cluster-for-undo', given that the Emacs command loop >> already groups consecutive undo entries together, but presumably it >> enables a more aggressive form of clustering. Just to clarify this little piece here: I originally introduces this clustering code to mimic emacs' behavior in text mode. Org-mode's aggressive interception seemed to prevent that and undoing in org-mode felt unnatural compared to vanilla text mode. It was never meant to be *more* aggressive than emacs' original behavior. The grouping did not happen at the time. The original thread is here: http://lists.gnu.org/archive/html/emacs-orgmode/2009-02/msg00691.html Martin From debbugs-submit-bounces@debbugs.gnu.org Tue Jul 03 19:02:12 2012 Received: (at 11774) by debbugs.gnu.org; 3 Jul 2012 23:02:12 +0000 Received: from localhost ([127.0.0.1]:46390 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SmC6m-0008BZ-9F for submit@debbugs.gnu.org; Tue, 03 Jul 2012 19:02:12 -0400 Received: from ironport2-out.teksavvy.com ([206.248.154.182]:19484) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SmC6k-0008BS-Bo for 11774@debbugs.gnu.org; Tue, 03 Jul 2012 19:02:10 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av0EAG6Zu09MCquH/2dsb2JhbABEtBGBCIIVAQEEAVYjBQsLDiYSFBgNJIgcBboJkEQDozOBWIMF X-IronPort-AV: E=Sophos;i="4.75,637,1330923600"; d="scan'208";a="192585573" Received: from 76-10-171-135.dsl.teksavvy.com (HELO fmsmemgm.homelinux.net) ([76.10.171.135]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 03 Jul 2012 18:57:25 -0400 Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848) id A3427AE322; Tue, 3 Jul 2012 18:57:25 -0400 (EDT) From: Stefan Monnier To: Samuel Wales Subject: Re: [O] bug#11774: bug#11774: org-mode causes undo boundaries to be lost Message-ID: References: <20120703095729.GA6651@c3po> <4FF30D50.8010009@os.inf.tu-dresden.de> Date: Tue, 03 Jul 2012 18:57:25 -0400 In-Reply-To: (Samuel Wales's message of "Tue, 3 Jul 2012 11:13:07 -0700") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -1.9 (-) X-Debbugs-Envelope-To: 11774 Cc: Bastien , Martin Pohlack , Toby Cubitt , 11774@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -1.9 (-) > The first is that it hardcodes the clustering by 20. I guess that's the problem which is not new. > This was possible to work around before Emacs 24. You could advise > self-insert-command or wrap it. This is why Org was able to control > this with a variable to support clustering or not clustering. IIUC Org's clustering was only introduced because self-insert-command's clustering only worked when it was handled by the read-eval-loop, so it was not done to "avoid" the clustering, but to make it work in more cases. So it might be unneeded in Emacs-24. > What is new in Emacs is that self-insert-command now destroys > undo-boundary. If you wrap it, it destroys all of your effort on the > next call to it. I don't have it fresh in my memory but if you can post some sample code showing what you're doing, and how self-insert-command's behavior makes it difficult, maybe we can make it work better. > self-insert-command. Even just turning that magic 20 number into a > variable would help. Providing it as a variable would be very easy, indeed. Stefan From debbugs-submit-bounces@debbugs.gnu.org Tue Jul 03 20:23:40 2012 Received: (at 11774) by debbugs.gnu.org; 4 Jul 2012 00:23:41 +0000 Received: from localhost ([127.0.0.1]:46453 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SmDNc-0001Ud-HX for submit@debbugs.gnu.org; Tue, 03 Jul 2012 20:23:40 -0400 Received: from mail-ob0-f172.google.com ([209.85.214.172]:47345) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SmDNX-0001US-LO for 11774@debbugs.gnu.org; Tue, 03 Jul 2012 20:23:39 -0400 Received: by obbwc20 with SMTP id wc20so10707829obb.3 for <11774@debbugs.gnu.org>; Tue, 03 Jul 2012 17:18:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=kPYamGCFE2t1+vcxASZw0ytojF3wn60oaVwux31rzHo=; b=QfeH5Z8XISv9gRSBQT6wpgcA7/5zs9M5yuAyIqVkDfpshnHOmAIDz1lpxcwKC88m6h onIYMeehBDn26gbyKlOSGqHw22jy6UTRwHJ20yfxpAWrYg6MQx+WSh0s3MtvsVHxXsVJ PaWVTRvbPwgroeQwE936aTof4KA1UdlkHDmyHdhkmWYempgKdqoTfduz4e3z3twHdjco MlWgV5/j39beE7UuVKJMazg+ufr97WSEuKshbTAWI19VOrb9EiAbBW1SejFJnBbEJv2f TgIxB5bEDceyzuYJ6uWiblnunta5bdgNm8O20P/ya/UB0gx8AZ8ItGXI9KV9edMskP2s yPkA== MIME-Version: 1.0 Received: by 10.60.9.134 with SMTP id z6mr20496211oea.46.1341361130958; Tue, 03 Jul 2012 17:18:50 -0700 (PDT) Received: by 10.76.83.6 with HTTP; Tue, 3 Jul 2012 17:18:50 -0700 (PDT) In-Reply-To: References: <20120703095729.GA6651@c3po> <4FF30D50.8010009@os.inf.tu-dresden.de> Date: Tue, 3 Jul 2012 17:18:50 -0700 Message-ID: Subject: Re: [O] bug#11774: bug#11774: org-mode causes undo boundaries to be lost From: Samuel Wales To: Stefan Monnier Content-Type: text/plain; charset=UTF-8 X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 11774 Cc: Bastien , Martin Pohlack , Toby Cubitt , 11774@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) On 7/3/12, Stefan Monnier wrote: >> self-insert-command. Even just turning that magic 20 number into a >> variable would help. > > Providing it as a variable would be very easy, indeed. Hi Stefan, To clarify, that is actually the only thing that I need as a user for self-insert-command. It would make an enormous difference in my use of Emacs. Huge. So I don't need undo-boundary to work in any particular way -- IF I have the ability to cluster self-insert-command by 1 instead of that hardcoded 20 throughout Emacs (including Org of course). My need for undo-boundary to work the way it did before is only so that I could call undo-boundary after every invocation of self-insert-command. Therefore, IF we have that variable, then undo-boundary considerations should be simply to DTRT for undo-tree, org-self-insert-command, and other code, in such a way that subtle bugs are prevented. Maybe the user should be able to set undo boundaries and have them work after self-insert-command? Dunno, I'm not familiar with internals enough to opine. Hope that clarifies. I will follow the discussion as long as I'm CC'ed as I am now. Thanks. Samuel -- The Kafka Pandemic: http://thekafkapandemic.blogspot.com From debbugs-submit-bounces@debbugs.gnu.org Tue Jul 03 20:29:17 2012 Received: (at 11774) by debbugs.gnu.org; 4 Jul 2012 00:29:17 +0000 Received: from localhost ([127.0.0.1]:46461 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SmDT3-0001cQ-CI for submit@debbugs.gnu.org; Tue, 03 Jul 2012 20:29:17 -0400 Received: from mail-ob0-f172.google.com ([209.85.214.172]:59815) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SmDT1-0001cJ-E4 for 11774@debbugs.gnu.org; Tue, 03 Jul 2012 20:29:15 -0400 Received: by obbwc20 with SMTP id wc20so10713625obb.3 for <11774@debbugs.gnu.org>; Tue, 03 Jul 2012 17:24:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=EuIOb7517RhR8MReAkyQ5hphHnDjZymHAyQQR5mvf0U=; b=PEDvN265QYprfAEZpdqUn0FkHQ5Ku5PeYGQW51lOV5MWtgv0UC2WNgxug4kq4JugN/ /Kxm9+1qOzgnkH8rUxYyVTJ7f8ZRW+YPXHt6M7+kBQNeejUwwn6poY3SlvTDIXh551X9 cWLo2G1zmIN5Xf+gtmkWpu+UIe44/ja78KDl0OymCz0MuiaPol8cI1EFQhz43LK4+keP oEZ15NXeTF7M1nhYewHQPgHc6oa+5WNbY4LrK1sWA7l16/psUpwHAWurawpvzYAFkls0 6WwsyiGlblkTERB7zOdTpgjdSZyoUL/7MuYrbSgBDdnAtuWbpk0F8TntNjFn2AhUSYFg p3yg== MIME-Version: 1.0 Received: by 10.182.112.102 with SMTP id ip6mr1974740obb.39.1341361470847; Tue, 03 Jul 2012 17:24:30 -0700 (PDT) Received: by 10.76.83.6 with HTTP; Tue, 3 Jul 2012 17:24:30 -0700 (PDT) In-Reply-To: References: <20120703095729.GA6651@c3po> <4FF30D50.8010009@os.inf.tu-dresden.de> Date: Tue, 3 Jul 2012 17:24:30 -0700 Message-ID: Subject: Re: [O] bug#11774: bug#11774: bug#11774: org-mode causes undo boundaries to be lost From: Samuel Wales To: Stefan Monnier Content-Type: text/plain; charset=UTF-8 X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 11774 Cc: Bastien , Martin Pohlack , Toby Cubitt , 11774@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) On 7/3/12, Samuel Wales wrote: > My need for undo-boundary to work the way it did That should read, "My need for self-insert-command to work the way it did". From debbugs-submit-bounces@debbugs.gnu.org Wed Jul 04 05:45:29 2012 Received: (at 11774) by debbugs.gnu.org; 4 Jul 2012 09:45:29 +0000 Received: from localhost ([127.0.0.1]:47225 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SmM9I-0005iM-Ji for submit@debbugs.gnu.org; Wed, 04 Jul 2012 05:45:29 -0400 Received: from starfish.geekisp.com ([216.168.135.166]:18050) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SmM9G-0005i9-3B for 11774@debbugs.gnu.org; Wed, 04 Jul 2012 05:45:26 -0400 Received: (qmail 2086 invoked by uid 1003); 4 Jul 2012 09:40:39 -0000 Received: from localhost (localhost.geekisp.com [127.0.0.1]) by localhost.geekisp.com (tmda-ofmipd) with ESMTP; Wed, 04 Jul 2012 05:40:35 -0400 Date: Wed, 4 Jul 2012 11:40:37 +0200 To: Samuel Wales Subject: Re: [O] bug#11774: bug#11774: org-mode causes undo boundaries to be lost Message-ID: <20120704094036.GA23683@c3po> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-PGP-Key: http://www.dr-qubit.org/gpg-toby.asc User-Agent: Mutt/1.5.21 (2010-09-15) X-Delivery-Agent: TMDA/1.1.11 (Ladyburn) From: Toby Cubitt X-Primary-Address: toby@dr-qubit.org X-Spam-Score: -0.4 (/) X-Debbugs-Envelope-To: 11774 Cc: Bastien , Martin Pohlack , Stefan Monnier , 11774@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -0.4 (/) On Tue, Jul 03, 2012 at 05:18:50PM -0700, Samuel Wales wrote: > On 7/3/12, Stefan Monnier wrote: > >> self-insert-command. Even just turning that magic 20 number into a > >> variable would help. > > > > Providing it as a variable would be very easy, indeed. > > Therefore, IF we have that variable, then undo-boundary considerations > should be simply to DTRT for undo-tree, org-self-insert-command, > and other code, in such a way that subtle bugs are prevented. Just to clarify the situation with undo-tree: it doesn't care how or when undo boundaries are inserted, and never did. The problem was only that undo boundaries that had nothing to do with self-insert-command were being *deleted*, due to the subtle interaction between the new Emacs-24 self-insert-command and org-mode's org-self-insert-cluster-for-undo feature. I've already pushed a change to the git version of undo-tree to make it work even if something else deletes undo boundaries that it shouldn't have touched (e.g. org-mode + Emacs-24). Deleting boundaries that have nothing to do with self-insert-command is still a bug, in my opinion, but it's a bug that no longer has catastrophic consequences in undo-tree-mode. It sounds from the preceding discussion that the right solution is simply to disable org-self-insert-cluster-for-undo in Emacs-24, since the purpose of org-mode's clustering was to recover the normal clustering behaviour and the standard self-insert-command clustering now works in org-mode with Emacs-24. The question of how to customize the clustering granularity seems to me to be a separate question (which can presumably be solved by making the hard-coded 20 into a variable). Toby -- Dr T. S. Cubitt Mathematics and Quantum Information group Department of Mathematics Complutense University Madrid, Spain email: tsc25@cantab.net web: www.dr-qubit.org From debbugs-submit-bounces@debbugs.gnu.org Wed Jul 18 09:28:02 2012 Received: (at 11774-done) by debbugs.gnu.org; 18 Jul 2012 13:28:02 +0000 Received: from localhost ([127.0.0.1]:47737 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SrUIL-0001Cz-Nm for submit@debbugs.gnu.org; Wed, 18 Jul 2012 09:28:02 -0400 Received: from pruche.dit.umontreal.ca ([132.204.246.22]:36035) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SrUIF-0001Ci-86 for 11774-done@debbugs.gnu.org; Wed, 18 Jul 2012 09:27:58 -0400 Received: from fmsmemgm.homelinux.net (lechon.iro.umontreal.ca [132.204.27.242]) by pruche.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id q6IDLh8S004732; Wed, 18 Jul 2012 09:21:44 -0400 Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848) id 15DBDAECAF; Wed, 18 Jul 2012 09:21:42 -0400 (EDT) From: Stefan Monnier To: Samuel Wales Subject: Re: [O] bug#11774: bug#11774: org-mode causes undo boundaries to be lost Message-ID: References: <20120703095729.GA6651@c3po> <4FF30D50.8010009@os.inf.tu-dresden.de> Date: Wed, 18 Jul 2012 09:21:42 -0400 In-Reply-To: (Samuel Wales's message of "Tue, 3 Jul 2012 17:18:50 -0700") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-NAI-Spam-Flag: NO X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0 X-NAI-Spam-Rules: 1 Rules triggered RV4282=0 X-NAI-Spam-Version: 2.2.0.9309 : core <4282> : streams <786702> : uri <1168477> X-Spam-Score: -3.5 (---) X-Debbugs-Envelope-To: 11774-done Cc: Bastien , 11774-done@debbugs.gnu.org, Martin Pohlack , Toby Cubitt X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -3.5 (---) >>> self-insert-command. Even just turning that magic 20 number into a >>> variable would help. >> Providing it as a variable would be very easy, indeed. > Maybe the user should be able to set undo boundaries and > have them work after self-insert-command? Dunno, I'm > not familiar with internals enough to opine. I installed the patch below which makes self-insert-command more careful to only remove undo boundaries that were auto-added. So (add-hook 'post-self-insert-hook #'undo-boundary 'append) should give you pretty much the behavior you were looking for. Stefan === modified file 'src/ChangeLog' --- src/ChangeLog 2012-07-18 05:44:36 +0000 +++ src/ChangeLog 2012-07-18 13:17:22 +0000 @@ -1,3 +1,10 @@ +2012-07-18 Stefan Monnier + + * lisp.h (last_undo_boundary): Declare new var. + * keyboard.c (command_loop_1): Set it. + * cmds.c (Fself_insert_command): Use it to only remove boundaries that + were auto-added by the command loop (bug#11774). + 2012-07-18 Dmitry Antipov Return more descriptive data from Fgarbage_collect. === modified file 'src/cmds.c' --- src/cmds.c 2012-06-16 12:24:15 +0000 +++ src/cmds.c 2012-07-18 13:08:43 +0000 @@ -296,7 +296,10 @@ if (remove_boundary && CONSP (BVAR (current_buffer, undo_list)) - && NILP (XCAR (BVAR (current_buffer, undo_list)))) + && NILP (XCAR (BVAR (current_buffer, undo_list))) + /* Only remove auto-added boundaries, not boundaries + added be explicit calls to undo-boundary. */ + && EQ (BVAR (current_buffer, undo_list), last_undo_boundary)) /* Remove the undo_boundary that was just pushed. */ BVAR (current_buffer, undo_list) = XCDR (BVAR (current_buffer, undo_list)); === modified file 'src/keyboard.c' --- src/keyboard.c 2012-07-12 03:45:46 +0000 +++ src/keyboard.c 2012-07-18 13:13:31 +0000 @@ -1318,6 +1318,9 @@ } #endif +/* The last boundary auto-added to buffer-undo-list. */ +Lisp_Object last_undo_boundary; + /* FIXME: This is wrong rather than test window-system, we should call a new set-selection, which will then dispatch to x-set-selection, or tty-set-selection, or w32-set-selection, ... */ @@ -1565,7 +1568,13 @@ #endif if (NILP (KVAR (current_kboard, Vprefix_arg))) /* FIXME: Why? --Stef */ + { + Lisp_Object undo = BVAR (current_buffer, undo_list); Fundo_boundary (); + last_undo_boundary + = (EQ (undo, BVAR (current_buffer, undo_list)) + ? Qnil : BVAR (current_buffer, undo_list)); + } Fcommand_execute (Vthis_command, Qnil, Qnil, Qnil); #ifdef HAVE_WINDOW_SYSTEM === modified file 'src/lisp.h' --- src/lisp.h 2012-07-18 05:44:36 +0000 +++ src/lisp.h 2012-07-18 13:05:33 +0000 @@ -2921,7 +2921,7 @@ extern void syms_of_search (void); extern void clear_regexp_cache (void); -/* Defined in minibuf.c */ +/* Defined in minibuf.c. */ extern Lisp_Object Qcompletion_ignore_case; extern Lisp_Object Vminibuffer_list; @@ -2930,25 +2930,25 @@ extern void init_minibuf_once (void); extern void syms_of_minibuf (void); -/* Defined in callint.c */ +/* Defined in callint.c. */ extern Lisp_Object Qminus, Qplus; extern Lisp_Object Qwhen; extern Lisp_Object Qcall_interactively, Qmouse_leave_buffer_hook; extern void syms_of_callint (void); -/* Defined in casefiddle.c */ +/* Defined in casefiddle.c. */ extern Lisp_Object Qidentity; extern void syms_of_casefiddle (void); extern void keys_of_casefiddle (void); -/* Defined in casetab.c */ +/* Defined in casetab.c. */ extern void init_casetab_once (void); extern void syms_of_casetab (void); -/* Defined in keyboard.c */ +/* Defined in keyboard.c. */ extern Lisp_Object echo_message_buffer; extern struct kboard *echo_kboard; @@ -2956,6 +2956,7 @@ extern Lisp_Object Qdisabled, QCfilter; extern Lisp_Object Qup, Qdown, Qbottom; extern Lisp_Object Qtop; +extern Lisp_Object last_undo_boundary; extern int input_pending; extern Lisp_Object menu_bar_items (Lisp_Object); extern Lisp_Object tool_bar_items (Lisp_Object, int *); @@ -2976,13 +2977,13 @@ extern void syms_of_keyboard (void); extern void keys_of_keyboard (void); -/* Defined in indent.c */ +/* Defined in indent.c. */ extern ptrdiff_t current_column (void); extern void invalidate_current_column (void); extern int indented_beyond_p (ptrdiff_t, ptrdiff_t, EMACS_INT); extern void syms_of_indent (void); -/* Defined in frame.c */ +/* Defined in frame.c. */ extern Lisp_Object Qonly; extern Lisp_Object Qvisible; extern void store_frame_param (struct frame *, Lisp_Object, Lisp_Object); @@ -2995,7 +2996,7 @@ extern void frames_discard_buffer (Lisp_Object); extern void syms_of_frame (void); -/* Defined in emacs.c */ +/* Defined in emacs.c. */ extern char **initial_argv; extern int initial_argc; #if defined (HAVE_X_WINDOWS) || defined (HAVE_NS) From debbugs-submit-bounces@debbugs.gnu.org Wed Aug 01 10:33:16 2012 Received: (at 11774) by debbugs.gnu.org; 1 Aug 2012 14:33:16 +0000 Received: from localhost ([127.0.0.1]:54891 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SwZzA-0004Nn-5C for submit@debbugs.gnu.org; Wed, 01 Aug 2012 10:33:16 -0400 Received: from mail-wg0-f46.google.com ([74.125.82.46]:58228) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SwZz7-0004Ne-BV for 11774@debbugs.gnu.org; Wed, 01 Aug 2012 10:33:14 -0400 Received: by wgbdq10 with SMTP id dq10so6230224wgb.15 for <11774@debbugs.gnu.org>; Wed, 01 Aug 2012 07:25:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=sender:from:to:cc:subject:in-reply-to:organization:references :user-agent:date:message-id:mime-version:content-type; bh=MOV9j/4GTXp22MCXrT2XTDV8XbaVUbKBHT4y3PTAZE0=; b=0e/wTWbiO+Q2iWC8kAjnSoaZLtzdRP1Hzlgk7ajOQx2Q6CfU6ooRub8mte32Wl1de3 Rc5ExvZ8A9/eQ3J2WtF5uT/Am8LC34k+04OYk7VXSPOuk48v1/pJPtk9k8Y0AS32Lnfo exrT/kk5KaPTewmnUC+svC7rrK5ESpESOODYlHAr2Fcqtyh7IQiTVi9Rp3AAnnhh4gli mXh2hkvoJuyhp7a7tLqEwaHwmyEYupcDXU1+x2fXbszEFoBu8ZEQYgdLMZV78AL7Spkn EGhja9sp1QftRmL5YLgczPhUVtRpWsmFkDr9kg/kC5UWnuwNk2/AeH5ljOTai1xn/4ZG 4CWA== Received: by 10.216.243.203 with SMTP id k53mr9308340wer.90.1343831147547; Wed, 01 Aug 2012 07:25:47 -0700 (PDT) Received: from myhost.localdomain (gob75-3-89-83-75-124.dsl.sta.abo.bbox.fr. [89.83.75.124]) by mx.google.com with ESMTPS id cu1sm28150683wib.6.2012.08.01.07.25.46 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 01 Aug 2012 07:25:46 -0700 (PDT) Received: by myhost.localdomain (Postfix, from userid 1000) id F335F8207; Wed, 1 Aug 2012 16:26:23 +0200 (CEST) From: Bastien To: 11774@debbugs.gnu.org Subject: Re: bug#11774: bug#11774: bug#11774: org-mode causes undo boundaries to be lost In-Reply-To: (Stefan Monnier's message of "Wed, 18 Jul 2012 09:21:42 -0400") Organization: GNU References: <20120703095729.GA6651@c3po> <4FF30D50.8010009@os.inf.tu-dresden.de> User-Agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.1.50 (gnu/linux) Date: Wed, 01 Aug 2012 16:26:23 +0200 Message-ID: <87y5lyn0xc.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -2.6 (--) X-Debbugs-Envelope-To: 11774 Cc: monnier@IRO.UMontreal.CA X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -2.6 (--) Stefan Monnier writes: >>>> self-insert-command. Even just turning that magic 20 number into a >>>> variable would help. >>> Providing it as a variable would be very easy, indeed. >> Maybe the user should be able to set undo boundaries and >> have them work after self-insert-command? Dunno, I'm >> not familiar with internals enough to opine. > > I installed the patch below which makes self-insert-command more careful > to only remove undo boundaries that were auto-added. > So (add-hook 'post-self-insert-hook #'undo-boundary 'append) should give you > pretty much the behavior you were looking for. On Org's side, `org-self-insert-cluster-for-undo' now defaults to nil for Emacs >=24.1, t otherwise. Thanks, -- Bastien From unknown Wed Jun 18 23:14:28 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Thu, 30 Aug 2012 11:24:03 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator From debbugs-submit-bounces@debbugs.gnu.org Mon Nov 03 02:10:41 2014 Received: (at control) by debbugs.gnu.org; 3 Nov 2014 07:10:41 +0000 Received: from localhost ([127.0.0.1]:46722 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XlBmj-0000Aq-0y for submit@debbugs.gnu.org; Mon, 03 Nov 2014 02:10:41 -0500 Received: from mail-lb0-f182.google.com ([209.85.217.182]:41869) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XlBmf-0000AU-6n for control@debbugs.gnu.org; Mon, 03 Nov 2014 02:10:37 -0500 Received: by mail-lb0-f182.google.com with SMTP id f15so9807678lbj.27 for ; Sun, 02 Nov 2014 23:10:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=yvkvQA0mRKETRbqvI+UkaFZH+AFU5ywdPALlu8cYGdE=; b=JAt8dovXZKgA/uDhOVmsMP14SJC1LQ6R1LDOqI7JuCX6F59oCIbkXEETS+/r8OGof8 EKGS2vgs5H7DUeauFZ9XeeEFs+4TTZLKYyeTEvaDyW/ocM7XKlKWkzmZCbB2tlDmPStj MCoJdxI7TXihodpiA3/bsNzZX8kxBqVVHudZsL0Jj8FoXAbvUGqZJAMwNrJidByiu3at vT5jsQzaZQYLog/KNgFXfjn9Wqu0Q2foMNkN3bUYHfixyNpkS6hLAoEL/h0q/FrtTaSa PK+6IkUBmo7UuaqwwJcXjh4icZyy3JEmmYLCwIVsuZsEh4ZxUAgZY11ZcoNEKHn1Uv+I GuJA== MIME-Version: 1.0 X-Received: by 10.112.83.100 with SMTP id p4mr7653750lby.62.1414998631221; Sun, 02 Nov 2014 23:10:31 -0800 (PST) Received: by 10.25.26.143 with HTTP; Sun, 2 Nov 2014 23:10:31 -0800 (PST) Date: Mon, 3 Nov 2014 00:10:31 -0700 Message-ID: Subject: From: Samuel Wales To: control@debbugs.gnu.org Content-Type: text/plain; charset=UTF-8 X-Spam-Score: 1.3 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has identified this incoming email as possible spam. The original message has been attached to this so you can view it (if it isn't spam) or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: unarchive 11774 -- The Kafka Pandemic: http://thekafkapandemic.blogspot.com The disease DOES progress. MANY people have died from it. And ANYBODY can get it. [...] Content analysis details: (1.3 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (samologist[at]gmail.com) -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.217.182 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 2.0 BLANK_SUBJECT Subject is present but empty 0.0 T_DKIM_INVALID DKIM-Signature header exists but is not valid X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.3 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has identified this incoming email as possible spam. The original message has been attached to this so you can view it (if it isn't spam) or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: unarchive 11774 -- The Kafka Pandemic: http://thekafkapandemic.blogspot.com The disease DOES progress. MANY people have died from it. And ANYBODY can get it. [...] Content analysis details: (1.3 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.217.182 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (samologist[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record 2.0 BLANK_SUBJECT Subject is present but empty 0.0 T_DKIM_INVALID DKIM-Signature header exists but is not valid unarchive 11774 -- The Kafka Pandemic: http://thekafkapandemic.blogspot.com The disease DOES progress. MANY people have died from it. And ANYBODY can get it. Denmark: free Karina Hansen NOW. From debbugs-submit-bounces@debbugs.gnu.org Mon Nov 03 09:35:24 2014 Received: (at 11774-done) by debbugs.gnu.org; 3 Nov 2014 14:35:24 +0000 Received: from localhost ([127.0.0.1]:46950 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XlIj4-0000Tk-VS for submit@debbugs.gnu.org; Mon, 03 Nov 2014 09:35:23 -0500 Received: from ironport2-out.teksavvy.com ([206.248.154.181]:46914) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XlIj0-0000T5-VE for 11774-done@debbugs.gnu.org; Mon, 03 Nov 2014 09:35:19 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Aq0IAOatTlRFpY87/2dsb2JhbABcgw6DYtJRBAICgRwXAQF8hAMBAQMBViMFCwsOJhIUGA0kiEsJy3IBAQEBBgEBAQEekQgHhEsFi2STLoNJjTSCEYFvhBYfgnoBAQE X-IPAS-Result: Aq0IAOatTlRFpY87/2dsb2JhbABcgw6DYtJRBAICgRwXAQF8hAMBAQMBViMFCwsOJhIUGA0kiEsJy3IBAQEBBgEBAQEekQgHhEsFi2STLoNJjTSCEYFvhBYfgnoBAQE X-IronPort-AV: E=Sophos;i="5.04,797,1406606400"; d="scan'208";a="95842831" Received: from 69-165-143-59.dsl.teksavvy.com (HELO pastel.home) ([69.165.143.59]) by ironport2-out.teksavvy.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 03 Nov 2014 09:35:12 -0500 Received: by pastel.home (Postfix, from userid 20848) id C21458597; Mon, 3 Nov 2014 09:35:12 -0500 (EST) From: Stefan Monnier To: Samuel Wales Subject: Re: [O] bug#11774: bug#11774: org-mode causes undo boundaries to be lost Message-ID: References: <20120703095729.GA6651@c3po> <4FF30D50.8010009@os.inf.tu-dresden.de> Date: Mon, 03 Nov 2014 09:35:12 -0500 In-Reply-To: (Samuel Wales's message of "Mon, 3 Nov 2014 00:06:08 -0700") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.3 (/) X-Debbugs-Envelope-To: 11774-done Cc: Bastien , 11774-done@debbugs.gnu.org, Martin Pohlack , Toby Cubitt X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.3 (/) > There is one possible bug. I have undo-boundary on self-insert-hook. > If I do newline-and-indent, for some reason both the newline and the > indent get undo boundaries. My expectation is that typing RET should > only have one undo boundary. > I don't know if that is user expectation error, but seems worth mentioning. Maybe the issue is simply that you need to be careful to put your undo-boundary "late" on the post-self-insert-hook (i.e. to use the `append' argument of add-hook). If not, then please post a new bug-report about it, so we can see on which side it should be solved. Stefan From debbugs-submit-bounces@debbugs.gnu.org Mon Nov 03 14:25:34 2014 Received: (at 11774-done) by debbugs.gnu.org; 3 Nov 2014 19:25:34 +0000 Received: from localhost ([127.0.0.1]:47852 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XlNFu-0008Uq-E2 for submit@debbugs.gnu.org; Mon, 03 Nov 2014 14:25:34 -0500 Received: from mail-la0-f54.google.com ([209.85.215.54]:59074) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XlNFs-0008Ui-Fx for 11774-done@debbugs.gnu.org; Mon, 03 Nov 2014 14:25:33 -0500 Received: by mail-la0-f54.google.com with SMTP id s18so4744989lam.13 for <11774-done@debbugs.gnu.org>; Mon, 03 Nov 2014 11:25:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:cc:content-type; bh=KcfGZ0zzF3syD4MOC09r0emtxBo3eS4yT7woT9cpXpo=; b=jQn1Ci2QCZrQ+RhoauRJ/pYPLABCBF4MBtetgqzjAAUzKLEbpO6VMa3krw3QBMMwK3 lch5Isbunur3g2UUPhAYk1LBTWPXBi8A1/SouuxitnsQck1cpI9rImEiUpnf8o4i46NU VOVHBk9ymCYB+15MeQoFXeXpywuTM80ivzhrvjnX2Edam1I3IMnMMuAngkfKMmVt4lrA Vv1N/SszDtf9QeX/5WbeEKPd7ySu1EwcFrvt8f2qyR6nsr3TNQ9U1TkODHQEXNklWlbL 0KPHaAcXIM71NTl+E1M131iU0ia0JoDyzXzGb6zNFTWzrRTHcQNfUFzjxNnm8I4CEUgg wVdg== MIME-Version: 1.0 X-Received: by 10.152.30.9 with SMTP id o9mr53529681lah.8.1415042730331; Mon, 03 Nov 2014 11:25:30 -0800 (PST) Received: by 10.25.26.143 with HTTP; Mon, 3 Nov 2014 11:25:30 -0800 (PST) Date: Mon, 3 Nov 2014 12:25:30 -0700 Message-ID: Subject: Emacs 24.3: newline-and-indent has two undo boundaries From: Samuel Wales To: bug-gnu-emacs@gnu.org, Stefan Monnier Content-Type: text/plain; charset=UTF-8 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 11774-done Cc: Bastien , 11774-done@debbugs.gnu.org, Martin Pohlack , Toby Cubitt X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) Reporting as suggested by Stefan. In order to bunch up undos by 1 instead of the hardcoded 20, I do this: (add-hook 'post-self-insert-hook #'undo-boundary 'append) This or advice used to work, then around Emacs 24.1 it stopped working. Stefan patched it in 24.3. It now works in most cases. The history is in this Debian bug: Re: [O] bug#11774: bug#11774: org-mode causes undo boundaries to be lost I use undo-tree 0.6.6. The bug also occurs with it turned off. When I press RET when it is bound to newline-and-indent, the newline and the indentation are undone separately. I expected the RET to be undone. This is a minor issue for me, but might point to other cases. Thanks. Samuel From unknown Wed Jun 18 23:14:28 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Tue, 02 Dec 2014 12:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator