I'm attempting to create a bookmark handler for eww so I can use Emacs's built-in bookmarks to save and visit urls with eww.
There's an equivenant setup for w3m here: https://github.com/TotalView/dotemacs/blob/master/.emacs.d/elpa/w3m-20140330.1933/bookmark-w3m.el
From what I can gather I need to:
- Create a function to actually make a properly formatted bookmark entry.
- Find a way to grab all the data you need to create the bookmark from eww.
- Set bookmark-make-record-function to that function.
- Make a bookmark 'handler' which launches eww with the bookmark's url.
So far I've got the following setup. However, I'm getting the error oht-eww-bookmark-make-record: Symbol’s value as variable is void: oht-eww-current-title
(defun oht-eww-current-title ()
"Returns the title of the current eww buffer"
(plist-get eww-data :title))
(defun oht-eww-bookmark-make-record ()
"Return a bookmark record for the current eww buffer."
(interactive)
`(,oht-eww-current-title
(location . ,eww-current-url)
(handler . ,oht-eww-bookmark-handler)))
(defun oht-eww-set-bookmark-handler ()
"Set local variable to call function to save eww bookmark"
(interactive)
(set (make-local-variable 'bookmark-make-record-function)
#'oht-eww-bookmark-make-record))
(defun oht-eww-bookmark-handler (record)
"Jump to an eww bookmarked location."
(eww (bookmark-prop-get record 'location)))