Skip to content

Commit 27f46ba

Browse files
committed
(bookmark--jump-via): Ensure 'window-point' is set correctly
* lisp/bookmark.el (bookmark--jump-via): Record bookmark-prescribed point before calling DISPLAY-FUNCTION, and use it to set 'window-point' afterwards. (Bug#71603)
1 parent a5a3740 commit 27f46ba

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lisp/bookmark.el

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1265,10 +1265,12 @@ After calling DISPLAY-FUNCTION, set window point to the point specified
12651265
by BOOKMARK-NAME-OR-RECORD, if necessary, run `bookmark-after-jump-hook',
12661266
and then show any annotations for this bookmark."
12671267
(bookmark-handle-bookmark bookmark-name-or-record)
1268-
(save-current-buffer
1269-
(funcall display-function (current-buffer)))
1270-
(let ((win (get-buffer-window (current-buffer) 0)))
1271-
(if win (set-window-point win (point))))
1268+
;; Store `point' now, because `display-function' might change it.
1269+
(let ((point (point)))
1270+
(save-current-buffer
1271+
(funcall display-function (current-buffer)))
1272+
(let ((win (get-buffer-window (current-buffer) 0)))
1273+
(if win (set-window-point win point))))
12721274
;; FIXME: we used to only run bookmark-after-jump-hook in
12731275
;; `bookmark-jump' itself, but in none of the other commands.
12741276
(when bookmark-fringe-mark

0 commit comments

Comments
 (0)