Next: Fix EWW bookmark import.

master
Pierre Neidhardt 2020-05-03 16:42:52 +02:00
parent 3e6f3331a8
commit 74dde064f0
1 changed files with 34 additions and 13 deletions

View File

@ -134,17 +134,7 @@ Recognized formats:
(getf (nthcdr 3 object) :keybinding)
(format-c->lisp (nth 2 object)))))
(defvar my-search-engines
(loop for file in '("~/.emacs.d/lisp/init-engine.el"
"~/personal/bookmarks/engines.el")
append (next::with-maybe-gpg-file (s file)
(read-emacs-engines s))))
(define-configuration browser
((search-engines (append my-search-engines %slot-default))
(session-restore-prompt :always-restore)))
(defmethod deserialize-bookmarks (stream)
(defmethod deserialize-eww-bookmarks (stream)
"This version of deserialize-bookmarks is compatibly with Ambrevar's EWW
format."
(handler-case
@ -165,13 +155,44 @@ format."
(when (getf entry :mark)
(setf (getf entry :shortcut) (getf entry :mark))
(remf entry :mark))
(apply #'make-instance 'bookmark-entry
(apply #'make-instance 'next:bookmark-entry
entry))
entries)))
(error (c)
(log:error "Error during bookmark deserialization: ~a" c)
(log:error "During bookmark deserialization: ~a" c)
nil)))
(defun restore-eww-bookmarks ()
"Restore the bookmarks from EWW."
(handler-case
(let ((data (with-data-file (file (make-instance 'data-path
:basename "~/personal/bookmarks/eww-bookmarks.gpg")
:direction :input
:if-does-not-exist nil)
(when file
(deserialize-eww-bookmarks file)))))
(when data
(echo "Loading ~a bookmarks from ~s."
(length data)
(expand-path (bookmarks-path *browser*)))
(setf (slot-value *browser* 'next::bookmarks-data) data)))
(error (c)
(echo-warning "Failed to load bookmarks from ~s: ~a" (expand-path (bookmarks-path *browser*)) c))))
(defvar my-search-engines
(loop for file in '("~/.emacs.d/lisp/init-engine.el"
"~/personal/bookmarks/engines.el")
append (next::with-maybe-gpg-file (s file)
(read-emacs-engines s))))
(define-configuration browser
((search-engines (append my-search-engines %slot-default))
(session-restore-prompt :always-restore)
(bookmarks-path (make-instance 'bookmarks-data-path :basename "bookmarks.lisp.gpg"))
;; (bookmarks-restore-function #'restore-eww-bookmarks)
))
(setf next/vcs:*vcs-projects-roots* '("~/projects"
"~/common-lisp"
"~/.local/share/emacs/site-lisp"))