I use Emacs Bookmarks, and I miss a follow functionality for showing the file content of the bookmarks. So, when I move the cursor up or down the lines in the bookmark list window, a new window should open vertically to show the content of the file the current bookmark is associated to.

Can such a follow mode be made?

Can a similar follow mode be made, that show the bookmarks annotations instead of the bookmarks file content?

1 Answer 1


Just bind the up/down cursor-movement commands to a command that invokes bookmark-bmenu-switch-other-window after moving the cursor.

(defun my-next-line (&optional ARG TRY-VSCROLL)
  "`next-line' followed by `bookmark-bmenu-switch-other-window'."
  (interactive "^p\np")
  (call-interactively #'next-line)

(defun my-previous-line (&optional ARG TRY-VSCROLL)
  "`previous-line' followed by `bookmark-bmenu-switch-other-window'."
  (interactive "^p\np")
  (call-interactively #'previous-line)

(define-key bookmark-bmenu-mode-map [remap next-line]     'my-next-line)
(define-key bookmark-bmenu-mode-map [remap previous-line] 'my-previous-line)
  • Thanks!The file content is shown in a second window to the right. But, for bookmarks with an annotation, the annotation text is shown in the right window, while the file content is shown in the left window, hiding the bookmark list. Two questions about code change: 1) Is it possible to show the annotation in the upper 1/5 part of the right window, and show the the file content in the lower 4/5 part of the same window? 2) Is it possible to close the right window when I hit return on a bookmark, so that the file opens in a frame with only one window?
    – myotis
    Sep 8, 2017 at 22:28
  • All of that is possible, but it doesn't really have anything to do with bookmarks. Customizing the behavior of displaying buffers in windows is a wide subject in itself. Vanilla Emacs bookmarks, and even more [Bookmark+](), give you some "hooks" (in the wider sense) you can use to customize bookmark visiting, which generally includes display, but it's up to you to do what you want with them. (Personally, I visit bookmarks in their own frames, by default. And for buffers such as Info I use dedicated windows (in their own frame).)
    – Drew
    Sep 8, 2017 at 23:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.