From: Michael Heerdegen <michael_heerdegen@web.de>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: help-gnu-emacs@gnu.org
Subject: Re: Bookmarks in EWW
Date: Wed, 25 Mar 2020 04:05:25 +0100 [thread overview]
Message-ID: <87tv2d3zii.fsf@web.de> (raw)
In-Reply-To: <jwvy2rp7qvz.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Tue, 24 Mar 2020 10:46:14 -0400")
[-- Attachment #1: Type: text/plain, Size: 182 bytes --]
Stefan Monnier <monnier@iro.umontreal.ca> writes:
> So should we expect a patch shortly on `master`?
My thoughts.
Ok, I've thrown something together (draft!) and tested quickly:
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-WIP-Make-standard-bookmarks-work-for-eww-buffers.patch --]
[-- Type: text/x-diff, Size: 1805 bytes --]
From 1c5929ee230d4efddfb4b0e0c647653026da4bd1 Mon Sep 17 00:00:00 2001
From: Michael Heerdegen <michael_heerdegen@web.de>
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)
(buffer-disable-undo)
(setq buffer-read-only t))
@@ -1880,6 +1883,27 @@ eww-bookmark-mode
(buffer-disable-undo)
(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))))
+
+;;;###autoload
+(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 ()
--
2.25.1
[-- Attachment #3: Type: text/plain, Size: 431 bytes --]
Questions:
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?
TIA,
Michael.
next prev parent reply other threads:[~2020-03-25 3:05 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-23 11:26 Bookmarks in EWW Marcin Borkowski
2020-03-23 14:56 ` Drew Adams
2020-03-25 11:48 ` Marcin Borkowski
2020-03-23 20:41 ` Michael Heerdegen
2020-03-24 14:46 ` Stefan Monnier
2020-03-25 3:05 ` Michael Heerdegen [this message]
2020-03-25 3:45 ` `declare-function' docu (was: Re: Bookmarks in EWW) Emanuel Berg via Users list for the GNU Emacs text editor
2020-03-28 17:59 ` `declare-function' docu Bruno Félix Rezende Ribeiro
2020-03-28 18:38 ` Drew Adams
2020-04-09 12:30 ` Bruno Félix Rezende Ribeiro
2020-04-09 15:47 ` Drew Adams
2020-03-28 21:38 ` Emanuel Berg via Users list for the GNU Emacs text editor
2020-03-25 14:06 ` Bookmarks in EWW Stefan Monnier
2020-03-26 1:09 ` Michael Heerdegen
2020-03-26 4:07 ` Stefan Monnier
2020-03-27 2:07 ` Michael Heerdegen
2020-03-27 3:44 ` Stefan Monnier
2020-03-28 2:31 ` Michael Heerdegen
2020-03-28 2:55 ` Stefan Monnier
2020-04-19 3:42 ` Michael Heerdegen
2020-04-19 13:18 ` Stefan Monnier
2020-04-20 3:17 ` Michael Heerdegen
2020-04-20 13:24 ` Stefan Monnier
2020-04-21 0:59 ` Michael Heerdegen
2020-04-29 22:53 ` Michael Heerdegen
2020-04-30 1:25 ` Stefan Monnier
2020-04-30 2:08 ` Michael Heerdegen
2020-04-30 3:08 ` Stefan Monnier
2020-04-30 20:09 ` Michael Heerdegen
2020-04-27 2:43 ` Michael Heerdegen
2020-03-27 4:32 ` buffer-localness (was: Re: Bookmarks in EWW) Emanuel Berg via Users list for the GNU Emacs text editor
2020-03-25 21:48 ` Bookmarks in EWW Drew Adams
2020-03-26 2:29 ` Michael Heerdegen
2020-03-26 3:21 ` Drew Adams
2020-03-26 3:53 ` Michael Heerdegen
2020-03-26 14:02 ` Drew Adams
2020-03-26 22:33 ` Michael Heerdegen
2020-03-26 8:41 ` Marcin Borkowski
2020-03-25 11:49 ` Marcin Borkowski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87tv2d3zii.fsf@web.de \
--to=michael_heerdegen@web.de \
--cc=help-gnu-emacs@gnu.org \
--cc=monnier@iro.umontreal.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.