all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@IRO.UMontreal.CA>
To: emacs-devel@gnu.org
Cc: Phillip Lord <phillip.lord@russet.org.uk>
Subject: Re: [Emacs-diffs] fix/undo-point-in-wrong-place 6b3cfe4 4/4: Prepare for record now separate function.
Date: Sun, 22 Nov 2015 00:21:27 -0500	[thread overview]
Message-ID: <jwvtwoeiqsb.fsf-monnier+emacsdiffs@gnu.org> (raw)
In-Reply-To: <E1Zztvo-0005ey-0X@vcs.savannah.gnu.org> (Phillip Lord's message of "Fri, 20 Nov 2015 22:13:24 +0000")

>     PT is the position of point that will naturally occur as a result of the
>     undo record that will be added just after this command terminates.  */

This comment is invalidated by your change.

> +      record_point (beg + SCHARS (string));

Hmm I thought the sign on sbeg took care of this case already (i.e. the
record_point should only record something when point was neither at the
beginning nor at the end of the deleted string).

As for the source of the bug (i.e. what change caused the new behavior):
in the old code, undo-boundary was called right before every command
(whether there was a need to push a boundary or not), so contrary to the
comment in the code, last_boundary_position was actually recording
"position of point at beginning of the command" rather than "position of
point last time we inserted a boundary".

So the hunk below should recover the old behavior (well, more or less:
it wouldn't compile as is, but I hope you get the idea).  But to fix it
right, we should rename these vars and adjust their comment to better
reflect the way they're really used.


        Stefan


diff --git a/src/keyboard.c b/src/keyboard.c
index 849066c..125091e 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -1448,6 +1448,8 @@ command_loop_1 (void)
             /* Ensure that we have added appropriate undo-boundaries as a
                result of changes from the last command. */
             call0 (Qundo_auto__add_boundary);
+            last_boundary_position = PT;
+            last_boundary_buffer = current_buffer;
 
             call1 (Qcommand_execute, Vthis_command);
 



       reply	other threads:[~2015-11-22  5:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20151120221320.21643.45342@vcs.savannah.gnu.org>
     [not found] ` <E1Zztvo-0005ey-0X@vcs.savannah.gnu.org>
2015-11-22  5:21   ` Stefan Monnier [this message]
2015-11-23 17:41     ` [Emacs-diffs] fix/undo-point-in-wrong-place 6b3cfe4 4/4: Prepare for record now separate function Phillip Lord
2015-11-25 22:46       ` Phillip Lord
2015-11-26  4:00         ` Stefan Monnier
2015-11-26 10:32           ` Phillip Lord
2015-11-26 15:56             ` Eli Zaretskii

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=jwvtwoeiqsb.fsf-monnier+emacsdiffs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    --cc=phillip.lord@russet.org.uk \
    /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.