emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 9a28600a973: Fix bug with point-adjustment after M-x COMMAND


From: Eli Zaretskii
Subject: master 9a28600a973: Fix bug with point-adjustment after M-x COMMAND
Date: Mon, 5 Jun 2023 08:58:33 -0400 (EDT)

branch: master
commit 9a28600a97351bccadb3473b0a7829b09b1bc413
Author: Eli Zaretskii <eliz@gnu.org>
Commit: Eli Zaretskii <eliz@gnu.org>

    Fix bug with point-adjustment after M-x COMMAND
    
    * src/keyboard.c (command_loop_1): Preserve 'last_point_position'
    across command execution, to avoid bugs in
    'adjust_point_for_property' if the command invokes
    'recursive-edit'.  Reported by Mats Lidell <matsl@gnu.org>.
---
 src/keyboard.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/keyboard.c b/src/keyboard.c
index 14c55666768..a1cddf9d145 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -1436,6 +1436,7 @@ command_loop_1 (void)
       prev_buffer = current_buffer;
       prev_modiff = MODIFF;
       last_point_position = PT;
+      ptrdiff_t last_pt = PT;
 
       /* By default, we adjust point to a boundary of a region that
          has such a property that should be treated intangible
@@ -1513,6 +1514,9 @@ command_loop_1 (void)
             unbind_to (scount, Qnil);
 #endif
           }
+      /* Restore last PT position value, possibly clobbered by
+         recursive-edit invoked by the command we just executed.  */
+      last_point_position = last_pt;
       kset_last_prefix_arg (current_kboard, Vcurrent_prefix_arg);
 
       safe_run_hooks_maybe_narrowed (Qpost_command_hook,



reply via email to

[Prev in Thread] Current Thread [Next in Thread]