]> git.eshelyaron.com Git - emacs.git/commitdiff
Correct 'bookmark-display'
authorEshel Yaron <me@eshelyaron.com>
Mon, 17 Jun 2024 10:47:19 +0000 (12:47 +0200)
committerEshel Yaron <me@eshelyaron.com>
Mon, 17 Jun 2024 10:47:19 +0000 (12:47 +0200)
lisp/bookmark.el

index 42fdbc9ca858ca7d06ba1636ad60d7269c7e74b0..6056493c966cf67a0fd6ccb4fa2e7bd427275fe1 100644 (file)
@@ -1349,7 +1349,23 @@ and then show any annotations for this bookmark."
    (list
     (bookmark-completing-read "Display bookmark" bookmark-current-bookmark)))
   (unless bookmark (user-error "You didn't specify a bookmark"))
-  (bookmark-jump bookmark #'display-buffer))
+  (let* ((buf-point
+          (save-current-buffer
+            (bookmark-handle-bookmark bookmark)
+            (when bookmark-fringe-mark
+              (let ((overlays (overlays-in (pos-bol) (1+ (pos-bol))))
+                    temp found)
+                (while (and (not found) (setq temp (pop overlays)))
+                  (when (eq 'bookmark (overlay-get temp 'category))
+                    (setq found t)))
+                (unless found
+                  (bookmark--set-fringe-mark))))
+            (cons (current-buffer) (point))))
+         (buf (car buf-point))
+         (point (cdr buf-point)))
+    (display-buffer buf)
+    (when-let ((win (get-buffer-window buf 0)))
+      (set-window-point win point))))
 
 (put 'bookmark-display 'minibuffer-action "display")