unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: phillip.lord@russet.org.uk (Phillip Lord)
To: Stefan Monnier <monnier@IRO.UMontreal.CA>
Cc: acm@muc.de, 23785@debbugs.gnu.org
Subject: bug#23785: Emacs 25: 'Undo' overdoes things.
Date: Tue, 21 Jun 2016 23:08:59 +0100	[thread overview]
Message-ID: <87twgmfb44.fsf@russet.org.uk> (raw)
In-Reply-To: <jwva8ietezv.fsf-monnier+emacsbugs@gnu.org> (Stefan Monnier's message of "Tue, 21 Jun 2016 17:25:29 -0400")

Stefan Monnier <monnier@IRO.UMontreal.CA> writes:

>> +      /*
>> +        Temporarily enable the undo-buffer to ensure that the change
>> +        is marked as an undoable one. Bug #23785.
>> +       */
>> +      bset_undo_list(current_buffer,Qnil);
>
> Additionally to Eli's remark about the shape of your comments, please
> also put spaces before open parens and after commas.

Oh, dear, I took Eli's okay and commited. I always was over
enthusiastic. I think I better revert.


>
>>        insert_from_buffer (XBUFFER (conversion_buffer),
>>  			  same_at_start_charpos, inserted_chars, 0);
>> +      bset_undo_list(current_buffer,Qt);
>
> Instead of two bset_undo_list, you could use a single specbind since the
> above code is almost immediately followed by unbind_to.


I tried that

      specbind (intern("buffer-undo-list"), Qnil);


> But more seriously, I'm wondering: where is undo-list set to t (and
> hence causing the problem we're seeing)?
> Searching for "undo" in that function gives m the impression that
> undo-0list won't be set to t during the call to insert_from_buffer.
> What am I missing?

It's set in several places to Qt, then restored at the end here.

      if (!empty_undo_list_p)
	{
	  bset_undo_list (current_buffer, old_undo);
	  if (CONSP (old_undo) && inserted != old_inserted)
	    {
	      /* Adjust the last undo record for the size change during
		 the format conversion.  */
	      Lisp_Object tem = XCAR (old_undo);
	      if (CONSP (tem) && INTEGERP (XCAR (tem))
		  && INTEGERP (XCDR (tem))
		  && XFASTINT (XCDR (tem)) == PT + old_inserted)
		XSETCDR (tem, make_number (PT + inserted));
	    }
	}

At least that was my theory; I tested it by adding print statements to
run_undoable_change which running, but returning before the call0.

run_undoable_change (void)
{
  if (EQ (BVAR (current_buffer, undo_list), Qt))
    return;

  call0 (Qundo_auto__undoable_change);
}

The code is convoluted enough, though, that I am worried that I may have
got this wrong.


Anyway, I've just testing emacs-25 after my change, the patch seems to
be doing very bad things -- i.e. leaving buffer-undo-list as Qt. So, I
think I really sure revert, then worry about it tomorrow.

Phil





  reply	other threads:[~2016-06-21 22:08 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-17 15:02 bug#23785: Emacs 25: "Undo" overdoes things Alan Mackenzie
2016-06-17 17:15 ` Eli Zaretskii
2016-06-17 17:45   ` Alan Mackenzie
2016-06-17 20:07     ` Eli Zaretskii
2016-06-17 21:47       ` Phillip Lord
2016-06-18  4:46         ` Stefan Monnier
2016-06-18  7:54         ` Eli Zaretskii
2016-06-18 18:42           ` Stefan Monnier
2016-06-18 19:02             ` Eli Zaretskii
2016-06-18 19:52               ` Stefan Monnier
2016-06-19 22:45                 ` bug#23785: Emacs 25: 'Undo' " Phillip Lord
2016-06-20  0:59                   ` Stefan Monnier
2016-06-20 12:47                     ` Phillip Lord
2016-06-20 14:04                       ` Stefan Monnier
2016-06-20 15:03                   ` Phillip Lord
2016-06-20 15:34                     ` Eli Zaretskii
2016-06-20 17:12                       ` Phillip Lord
2016-06-21 13:17                         ` Eli Zaretskii
2016-06-21 14:30                           ` Phillip Lord
2016-06-21 21:25                         ` Stefan Monnier
2016-06-21 22:08                           ` Phillip Lord [this message]
2020-09-04 14:03                             ` Lars Ingebrigtsen
2020-09-05 13:15                               ` Alan Mackenzie
2016-06-21 13:18                     ` Eli Zaretskii
2016-06-21 14:29                       ` Phillip Lord
2016-06-21 16:13                         ` Eli Zaretskii
2016-06-17 21:23     ` bug#23785: Emacs 25: "Undo" " Phillip Lord
2016-06-18 17:41       ` Alan Mackenzie
2016-06-17 21:49     ` Óscar Fuentes
2016-06-20 12:33       ` Phillip Lord

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=87twgmfb44.fsf@russet.org.uk \
    --to=phillip.lord@russet.org.uk \
    --cc=23785@debbugs.gnu.org \
    --cc=acm@muc.de \
    --cc=monnier@IRO.UMontreal.CA \
    /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 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).