[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bookmarks in EWW

From: Michael Heerdegen
Subject: Re: Bookmarks in EWW
Date: Wed, 25 Mar 2020 04:05:25 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Stefan Monnier <> writes:

> So should we expect a patch shortly on `master`?

My thoughts.

Ok, I've thrown something together (draft!) and tested quickly:

From 1c5929ee230d4efddfb4b0e0c647653026da4bd1 Mon Sep 17 00:00:00 2001
From: Michael Heerdegen <>
Date: Wed, 25 Mar 2020 03:55:41 +0100
Subject: [PATCH] WIP: Make standard bookmarks work for eww buffers

 lisp/net/eww.el | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index c83884fd25..8d0405ba0e 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -889,6 +889,9 @@ eww-mode
   (setq-local desktop-save-buffer #'eww-desktop-misc-data)
   ;; multi-page isearch support
   (setq-local multi-isearch-next-buffer-function #'eww-isearch-next-buffer)
+  ;; Emacs bookmarks support
+  (defvar bookmark-make-record-function)
+  (setq-local bookmark-make-record-function #'eww-bookmark-make-record)
   (setq truncate-lines t)
   (setq buffer-read-only t))
@@ -1880,6 +1883,27 @@ eww-bookmark-mode
   (setq truncate-lines t))

+;;; Emacs bookmarks support
+(declare-function bookmark-make-record-default
+                  "bookmark" (&optional no-file no-context posn))
+(declare-function bookmark-prop-get "bookmark" (bookmark prop))
+(declare-function bookmark-default-handler "bookmark" (bmk))
+(defun eww-bookmark-make-record  ()
+  "Doc..."
+  (let ((url (plist-get eww-data :url)))
+    `(,(plist-get eww-data :title)
+      ,@(bookmark-make-record-default 'no-file)
+      (url     . ,url)
+      (handler . bookmark-eww-bookmark-jump))))
+(defun bookmark-eww-bookmark-jump (bookmark)
+  "Default bookmark handler for eww buffers."
+  (eww-browse-url (bookmark-prop-get bookmark 'url))
+  (bookmark-default-handler bookmark))
 ;;; History code

 (defun eww-save-history ()


Does it make sense that these bookmarks save a text part?  Surely makes
sense for some cases, e.g. locally saved documentation in html, but
makes not much sense for e.g. newspaper sites.

Do I need to declare `bookmark-make-record-function' as special when
setting with `setq-local' (that's what doc-view does)?  If the answer is
"yes", do I need to do it at top-level?

Do I have to add a NEWS entry?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]