Subject: Re: bug#66764: 29.1; Emacs scrolls for "(goto-char (point-max))" instead of jumping

From: Gregory Heytings <[email-masked]>
Date: Thu, 11 Jan 2024 23:40:35 +0000

>
> Did you have any chance to look at this?
>

Yes, finally, and here is the patch.
From fb2c20bfffec757a1f707d4ab62c049ee7545c3a Mon Sep 17 00:00:00 2001
From: Gregory Heytings <[email-masked]>
Date: Thu, 11 Jan 2024 23:38:22 +0000
Subject: [PATCH] Fix blunder in labeled_narrow_to_region.

* src/editfns.c (labeled_narrow_to_region): Record point-marker
before, instead of after, calling narrow-to-region; otherwise
point has already changed.  Fixes bug#66764.
---
 src/editfns.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/editfns.c b/src/editfns.c
index 063dfc6d131..6ddee0840c2 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -2870,9 +2870,9 @@ unwind_labeled_narrow_to_region (Lisp_Object label)
 labeled_narrow_to_region (Lisp_Object begv, Lisp_Object zv,
 			  Lisp_Object label)
 {
-  Finternal__labeled_narrow_to_region (begv, zv, label);
   record_unwind_protect (restore_point_unwind, Fpoint_marker ());
   record_unwind_protect (unwind_labeled_narrow_to_region, label);
+  Finternal__labeled_narrow_to_region (begv, zv, label);
 }
 
 DEFUN ("widen", Fwiden, Swiden, 0, 0, "",
-- 
2.39.2