From 6ad13d2a6121676f0b82a037679d7c2be8b9238e Mon Sep 17 00:00:00 2001 From: plugd Date: Mon, 26 Jul 2021 21:09:05 +0200 Subject: [PATCH] Play better with bookmark-bmenu-other-window. Previous implementation of elpher-bookmark-jump was not acting properly as a bookmark-handler function, resulting in strange behaviour. --- elpher.el | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/elpher.el b/elpher.el index b018cc9..e3cd29a 100644 --- a/elpher.el +++ b/elpher.el @@ -1798,9 +1798,19 @@ record for the current elpher page." ;;;###autoload (defun elpher-bookmark-jump (bookmark) - "Go to a particular BOOKMARK." - (let* ((url (cdr (assq 'location bookmark)))) - (elpher-go url))) + "Handler used to open a bookmark using elpher. +The argument BOOKMARK is a bookmark record passed to the function. +This handler is responsible for loading the bookmark in some buffer, +then making that buffer the current buffer. It should not switch +to the buffer." + (let* ((url (cdr (assq 'location bookmark))) + (cleaned-url (string-trim url)) + (address (elpher-address-from-url cleaned-url)) + (page (elpher-make-page cleaned-url address))) + (elpher-with-clean-buffer + (elpher-visit-page page)) + (set-buffer (get-buffer elpher-buffer-name)) + nil)) (defun elpher-bookmark-link () "Bookmark the link at point. -- 2.20.1