From: plugd Date: Mon, 26 Jul 2021 19:09:05 +0000 (+0200) Subject: Play better with bookmark-bmenu-other-window. X-Git-Tag: v3.1.0~15 X-Git-Url: https://thelambdalab.xyz/gitweb/index.cgi?p=elpher.git;a=commitdiff_plain;h=6ad13d2a6121676f0b82a037679d7c2be8b9238e 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. --- 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.