From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Michael Heerdegen Newsgroups: gmane.emacs.help Subject: Re: Bookmarks in EWW Date: Wed, 25 Mar 2020 04:05:25 +0100 Message-ID: <87tv2d3zii.fsf@web.de> References: <878sjrfh2m.fsf@mbork.pl> <871rpipzwa.fsf@web.de> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="115915"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: help-gnu-emacs@gnu.org To: Stefan Monnier Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Wed Mar 25 04:07:24 2020 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jGwO4-000U2w-EP for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 25 Mar 2020 04:07:24 +0100 Original-Received: from localhost ([::1]:58582 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jGwO3-0005HF-9B for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 24 Mar 2020 23:07:23 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:46236) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jGwMH-0005G2-B3 for help-gnu-emacs@gnu.org; Tue, 24 Mar 2020 23:05:34 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jGwMG-0000wO-4j for help-gnu-emacs@gnu.org; Tue, 24 Mar 2020 23:05:33 -0400 Original-Received: from mout.web.de ([212.227.15.14]:48511) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1jGwMF-0000s2-Mc for help-gnu-emacs@gnu.org; Tue, 24 Mar 2020 23:05:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=web.de; s=dbaedf251592; t=1585105526; bh=fcwIzqAzoRqSPPfkgtg7osJAuKWAyE+dqfyX+jQ1QE4=; h=X-UI-Sender-Class:From:To:Cc:Subject:References:Date:In-Reply-To; b=iLO2VlqJ+MlNkm336E13oAbjqD4eenGpoImP2xXPmBMAaObPXFnqPGPQwBbW8gZvo r/XqRQqpa3S5KSbGALtWLDBVQaGQE56+mXxjUIMxG2E1Mwyuh5K60kcoXQCzHtTkMU NELlJXtKzMXtmHhY60uRB4fFauZoCW2ZU0KDobOo= X-UI-Sender-Class: c548c8c5-30a9-4db5-a2e7-cb6cb037b8f9 Original-Received: from drachen.dragon ([188.98.99.7]) by smtp.web.de (mrweb002 [213.165.67.108]) with ESMTPSA (Nemesis) id 0Lw189-1jKMCu3bxt-017pqO; Wed, 25 Mar 2020 04:05:26 +0100 In-Reply-To: (Stefan Monnier's message of "Tue, 24 Mar 2020 10:46:14 -0400") X-Provags-ID: V03:K1:ogUekGTGUtc4mi2tNNJb/FFv7MvBm50TJOEW61yzd5Qk5D0SnhK hrFGCU7EuV6JeadqOdpfEb/ILfvLNcsdjv0c5R+M3jqseiO9C6h9REBbFw0YObJ5+zVwKf1 ro1GPkvcEBPkvn8JubOk2iFLLIEy+ceoOAGMX3NHVUXnBdUH2im07Eo3TujHZ+yTTAdC00U 8RjocKRBfSW34o3UEnmxw== X-UI-Out-Filterresults: notjunk:1;V03:K0:Z3rk5xemQVw=:6zFE9viOU7ZmABW5RYPsoF fPpT0eMoTbM4EIH21HYMzcFdaRwJKag1iZzR3huUBc57aMJyQ3SEAkWkSuN9V1nHau52sCOHu 2e7iCiHvI+UNyES/kgE/Kb85fj8Py1qgQJ98/xTfdKhA+wCFCQqOa4E0iHKTxcFKHVnCAQUam 1JyfR58MrhiMxKfIKCiDMKe7lBFltAmvNmlUVdzFXMHeJl35/EfwvfssiTdOtp0lGcpsC3N6J WBVUdNU2HRc9YUgmHIRi9MtSFKka1J7MVc8pu0b7lPZhV1+hz55KL7eNcOxC62PZ0e2APdXjz QDF/vGlIUwqAlW7MpNFnlAMW6LsOJSp5+WoXGURiFQij30eJw77f5/yp1d3REyMm54pFHAddn 9ewwLhM/wwxL6bd+P5FAOANKU826LYEPNsS+a2DkjCT5PsntFwLEJvfVf/qD2m6bQ6oyQOlrY kxkUZirD/9eVAG59g731r+ljWu5Y6UFui/GaOCHkikjm5geY6ePTYnz4PuiGNZFV1WhEpmmDy hOG3Fvu3leku2060GvjyZV19UCoMDr/T097lz1fGO9F00dZJ++qvoe4czsp5nn//Q8CISAMZE ZfXlsnP58yA+7AU5jLY7F2dqpvOnZZAg8swke8CndXfoY0hl9S71HQmOvrdMjJW+FqRaVL/Dh YB6UQ6wNPapUgIObpijRLoDdYnH4ppqBgklDDNg2SR5MK+LO2NUorRkhvzwM15zXBXNFA0LDy S8N96jriIUSde5zrSeOV3exvWPHcZLyEYAa49hwJm7eE8ZLV7+G86VLpJx5NREs5s2twh/A+ X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.15.14 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:122650 Archived-At: --=-=-= Content-Type: text/plain Stefan Monnier writes: > So should we expect a patch shortly on `master`? My thoughts. Ok, I've thrown something together (draft!) and tested quickly: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-WIP-Make-standard-bookmarks-work-for-eww-buffers.patch Content-Transfer-Encoding: quoted-printable =46rom 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 =2D-- 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 =2D-- 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-buffe= r) + ;; 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 () =2D- 2.25.1 --=-=-= Content-Type: text/plain 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. --=-=-=--