* eww and bookmarks
@ 2020-05-20 11:48 Matthias Meulien
2020-05-20 16:29 ` Drew Adams
0 siblings, 1 reply; 45+ messages in thread
From: Matthias Meulien @ 2020-05-20 11:48 UTC (permalink / raw)
To: emacs-devel
Is there any reason why eww doesn't use bookmark.el? I could not
found any explanation in eww.el nor the info documentation of
Emacs.
I'd prefer to have all my bookmarks available in a single buffer
and managed in a single place; And I am happy so far with
bookmark.el for usual bookmarks. Are you interested in eww to
support bookmark.el (could be through a customization variable for
example)?
--
Matthias
^ permalink raw reply [flat|nested] 45+ messages in thread
* RE: eww and bookmarks
2020-05-20 11:48 Matthias Meulien
@ 2020-05-20 16:29 ` Drew Adams
2020-05-20 16:35 ` Noam Postavsky
0 siblings, 1 reply; 45+ messages in thread
From: Drew Adams @ 2020-05-20 16:29 UTC (permalink / raw)
To: Matthias Meulien, emacs-devel
> Is there any reason why eww doesn't use bookmark.el? I could not
> found any explanation in eww.el nor the info documentation of
> Emacs.
>
> I'd prefer to have all my bookmarks available in a single buffer
> and managed in a single place; And I am happy so far with
> bookmark.el for usual bookmarks. Are you interested in eww to
> support bookmark.el (could be through a customization variable for
> example)?
This has come up before. See thread "EWW improvements:
open in new buffer, tags, quickmarks, search engines, ..."
If you use Bookmark+ then you can create and use
ordinary Emacs bookmarks for EWW, not the EWW
pseudo-bookmarks. By "ordinary" I mean that they
are like other bookmarks, show up in your bookmarks
list, are jumped to in the usual way, etc.
https://lists.gnu.org/archive/html/emacs-devel/2018-05/msg00041.html
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: eww and bookmarks
2020-05-20 16:29 ` Drew Adams
@ 2020-05-20 16:35 ` Noam Postavsky
2020-05-20 16:40 ` Drew Adams
` (2 more replies)
0 siblings, 3 replies; 45+ messages in thread
From: Noam Postavsky @ 2020-05-20 16:35 UTC (permalink / raw)
To: Drew Adams; +Cc: Matthias Meulien, Emacs developers
On Wed, 20 May 2020 at 12:31, Drew Adams <drew.adams@oracle.com> wrote:
>
> > Is there any reason why eww doesn't use bookmark.el? I could not
> > found any explanation in eww.el nor the info documentation of
> > Emacs.
> This has come up before. See thread "EWW improvements:
> open in new buffer, tags, quickmarks, search engines, ..."
> https://lists.gnu.org/archive/html/emacs-devel/2018-05/msg00041.html
Even more recently at
https://lists.gnu.org/archive/html/help-gnu-emacs/2020-03/msg00127.html
https://lists.gnu.org/archive/html/help-gnu-emacs/2020-04/msg00265.html
says "installed!" but I'm not seeing it (though maybe my git-fu is
failing)
^ permalink raw reply [flat|nested] 45+ messages in thread
* RE: eww and bookmarks
2020-05-20 16:35 ` Noam Postavsky
@ 2020-05-20 16:40 ` Drew Adams
2020-05-20 20:13 ` Matthias Meulien
2020-05-20 22:14 ` Michael Heerdegen
2 siblings, 0 replies; 45+ messages in thread
From: Drew Adams @ 2020-05-20 16:40 UTC (permalink / raw)
To: Noam Postavsky; +Cc: Matthias Meulien, Emacs developers
> Even more recently at
> https://urldefense.com/v3/__https://lists.gnu.org/archive/html/help-
> gnu-emacs/2020-
> 03/msg00127.html__;!!GqivPVa7Brio!LFSplTAXJ0IXXYTIl8h9l3BvvOndBdlgDTAAv
> 2EZ6e6ElAxd50rLadxOc2DFj3ZZ$
>
> https://urldefense.com/v3/__https://lists.gnu.org/archive/html/help-
> gnu-emacs/2020-
> 04/msg00265.html__;!!GqivPVa7Brio!LFSplTAXJ0IXXYTIl8h9l3BvvOndBdlgDTAAv
> 2EZ6e6ElAxd50rLadxOczoAisIo$
Thanks. I searched bug-list and emacs-devel msgs
I've saved, but didn't think to do the same for
help-gnu-emacs.
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: eww and bookmarks
2020-05-20 16:35 ` Noam Postavsky
2020-05-20 16:40 ` Drew Adams
@ 2020-05-20 20:13 ` Matthias Meulien
2020-05-23 22:56 ` Michael Heerdegen
2020-05-20 22:14 ` Michael Heerdegen
2 siblings, 1 reply; 45+ messages in thread
From: Matthias Meulien @ 2020-05-20 20:13 UTC (permalink / raw)
To: Noam Postavsky; +Cc: Drew Adams, Emacs developers
Noam Postavsky <npostavs@gmail.com> writes:
> https://lists.gnu.org/archive/html/help-gnu-emacs/2020-04/msg00265.html
> says "installed!" but I'm not seeing it (though maybe my git-fu
> is failing)
On my side too, I could not find anything related on master.
--
Matthias
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: eww and bookmarks
2020-05-20 16:35 ` Noam Postavsky
2020-05-20 16:40 ` Drew Adams
2020-05-20 20:13 ` Matthias Meulien
@ 2020-05-20 22:14 ` Michael Heerdegen
2020-06-07 15:09 ` Michael Heerdegen
2 siblings, 1 reply; 45+ messages in thread
From: Michael Heerdegen @ 2020-05-20 22:14 UTC (permalink / raw)
To: emacs-devel
Noam Postavsky <npostavs@gmail.com> writes:
> Even more recently at
> https://lists.gnu.org/archive/html/help-gnu-emacs/2020-03/msg00127.html
>
> https://lists.gnu.org/archive/html/help-gnu-emacs/2020-04/msg00265.html
> says "installed!" but I'm not seeing it (though maybe my git-fu is
> failing)
I had installed something that treated a different problem that appeared
to us in the discussion, but not yet the original patch.
I'll install my suggested patch as well soon, sorry for the delay.
Michael.
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: eww and bookmarks
2020-05-20 20:13 ` Matthias Meulien
@ 2020-05-23 22:56 ` Michael Heerdegen
2020-05-24 8:44 ` Matthias Meulien
0 siblings, 1 reply; 45+ messages in thread
From: Michael Heerdegen @ 2020-05-23 22:56 UTC (permalink / raw)
To: Matthias Meulien; +Cc: Noam Postavsky, Drew Adams, Emacs developers
Matthias Meulien <orontee@gmail.com> writes:
> Noam Postavsky <npostavs@gmail.com> writes:
>
> > https://lists.gnu.org/archive/html/help-gnu-emacs/2020-04/msg00265.html
> > says "installed!" but I'm not seeing it (though maybe my git-fu
> > is failing)
>
> On my side too, I could not find anything related on master.
BTW, have you had a look at the discussion there? Any opinion?
How should the bookmarks behave? Should they be exact counterparts of
eww bookmarks? Should they be linked to eww, or should it be possible
to open them also with another browser (e.g. w3m).
Finally, what should I specify as `defaults' list for the name
suggestions available when you are prompted for a name for a new
bookmark? Just the url?
TIA,
Michael.
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: eww and bookmarks
2020-05-23 22:56 ` Michael Heerdegen
@ 2020-05-24 8:44 ` Matthias Meulien
2020-05-24 14:14 ` Alfred M. Szmidt
2020-05-25 4:28 ` Michael Heerdegen
0 siblings, 2 replies; 45+ messages in thread
From: Matthias Meulien @ 2020-05-24 8:44 UTC (permalink / raw)
To: Michael Heerdegen; +Cc: Noam Postavsky, Drew Adams, Emacs developers
Michael Heerdegen <michael_heerdegen@web.de> writes:
> Matthias Meulien <orontee@gmail.com> writes:
>
>> Noam Postavsky <npostavs@gmail.com> writes:
>>
>> > https://lists.gnu.org/archive/html/help-gnu-emacs/2020-04/msg00265.html
>> > says "installed!" but I'm not seeing it (though maybe my
>> > git-fu is failing)
>>
>> On my side too, I could not find anything related on master.
>
> BTW, have you had a look at the discussion there? Any opinion?
Yes, I read that thread. My use case is the same as the one of the
OP of the thread you referenced: Being able to bookmark a web page
and visit that page again in a different Emacs session, using the
usual commands defined in bookmark.el (if using eww bookmarks, I
would have to learn new kebindings and list bookmarks in different
buffer than *Bookmark List*).
By the way, I can't imagine installing a third-party library for
such a simple feature.
> How should the bookmarks behave? Should they be exact
> counterparts of eww bookmarks?
I went through what eww info manual says on bookmarks and used
those bookmarks once to understand what is the provided feature; I
can't find anything not available from standard bookmarks. Can you
give details on what would be lost if eww used bookmarks.el?
> Should they be linked to eww, or should it be possible to open
> them also with another browser (e.g. w3m).
May be use `browse-url-default-browser`, but it's a different
discussion IMOH; The current need is to make the user life simpler
with a single place to search their bookmarks and don't ask them
to learn a second set of key bindings, manage a new file
containing bookmarks and configure news hooks in case they want to
customize their bookmark list appearance...
Note that in the same direction there's a proposal to base
bookmark list on `tabulated-list-mode`
https://lists.gnu.org/archive/html/bug-gnu-emacs/2020-01/msg01319.html.
> Finally, what should I specify as `defaults' list for the name
> suggestions available when you are prompted for a name for a new
> bookmark? Just the url?
An HTML document may have a "title" element; Isn't it possible to
use the value of that element when available? And the URL
otherwise.
I apologize I've not found time to check your patch right now;
I'll try it in the forthcoming days.
--
Matthias Meulien
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: eww and bookmarks
2020-05-24 8:44 ` Matthias Meulien
@ 2020-05-24 14:14 ` Alfred M. Szmidt
2020-05-24 19:06 ` Karl Fogel
2020-05-25 4:35 ` Michael Heerdegen
2020-05-25 4:28 ` Michael Heerdegen
1 sibling, 2 replies; 45+ messages in thread
From: Alfred M. Szmidt @ 2020-05-24 14:14 UTC (permalink / raw)
To: Matthias Meulien; +Cc: michael_heerdegen, npostavs, drew.adams, emacs-devel
I haven't followed the discussion closely, so might have missed things
-- the addition of bookmarks for URLs would be very nice.
Isn't this very easily done though, both so that it works for the case
of eww, but also (which I think is important, in the generic case),
simple untested hackery, in .emacs.bmk we have:
("The GNU Operating System and the Free Software Movement"
(url . "http://www.gnu.org/")
(handler . browse-url-bookmark-jump))
Then browse-url-bookmark-jump is simply:
(defun browse-url-bookmark-jump (bmk)
(let* ((url (bookmark-prop-get bmk 'url))
(buf (save-window-excursion (browse-url url) (current-buffer))))
(bookmark-default-handler
`("" (buffer . ,buf) . ,(bookmark-get-bookmark-record bmk)))))
Those that like EWW would already be doing:
(setq browse-url-browser-function 'eww-browse-url)
And then the equivalent browse-url-bookmark-make-record (e.g,
Info-Info-bookmark-make-record) function for setting, which is left as
a excersie for the reader -- or I can make a patch. This might not
work of course if you are outside of the context of Emacs.
It would be strange if eww implemented its own bookmarking
functionality, when all of this is already simple to add.
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: eww and bookmarks
2020-05-24 14:14 ` Alfred M. Szmidt
@ 2020-05-24 19:06 ` Karl Fogel
2020-05-25 4:35 ` Michael Heerdegen
1 sibling, 0 replies; 45+ messages in thread
From: Karl Fogel @ 2020-05-24 19:06 UTC (permalink / raw)
To: Alfred M. Szmidt
Cc: michael_heerdegen, Matthias Meulien, npostavs, drew.adams,
emacs-devel
On 24 May 2020, Alfred M. Szmidt wrote:
>I haven't followed the discussion closely, so might have missed things
>-- the addition of bookmarks for URLs would be very nice.
>
>Isn't this very easily done though, both so that it works for the case
>of eww, but also (which I think is important, in the generic case),
>simple untested hackery, in .emacs.bmk we have:
>
>("The GNU Operating System and the Free Software Movement"
> (url . "http://www.gnu.org/")
> (handler . browse-url-bookmark-jump))
>
>Then browse-url-bookmark-jump is simply:
>
>(defun browse-url-bookmark-jump (bmk)
> (let* ((url (bookmark-prop-get bmk 'url))
> (buf (save-window-excursion (browse-url url) (current-buffer))))
> (bookmark-default-handler
> `("" (buffer . ,buf) . ,(bookmark-get-bookmark-record bmk)))))
>
>Those that like EWW would already be doing:
>
> (setq browse-url-browser-function 'eww-browse-url)
>
>And then the equivalent browse-url-bookmark-make-record (e.g,
>Info-Info-bookmark-make-record) function for setting, which is left as
>a excersie for the reader -- or I can make a patch. This might not
>work of course if you are outside of the context of Emacs.
>
>It would be strange if eww implemented its own bookmarking
>functionality, when all of this is already simple to add.
I've been watching this thread, trying to determine if any new functionality would need to be added to bookmark.el in order to support EWW bookmarks.
So far, it looks like it can all be implemented using existing functionality in bookmark.el, using `bookmark-make-record-function' and a handler function, as per above.
If it turns out that anything new is needed, please say so. bookmark.el should be able to supply generic bookmarking functionality to other packages, and I'm happy to help with that if further extension is needed.
Best regards,
-Karl
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: eww and bookmarks
2020-05-24 8:44 ` Matthias Meulien
2020-05-24 14:14 ` Alfred M. Szmidt
@ 2020-05-25 4:28 ` Michael Heerdegen
2020-05-25 14:35 ` T.V Raman
1 sibling, 1 reply; 45+ messages in thread
From: Michael Heerdegen @ 2020-05-25 4:28 UTC (permalink / raw)
To: Matthias Meulien; +Cc: Noam Postavsky, Drew Adams, Emacs developers
Matthias Meulien <orontee@gmail.com> writes:
> > How should the bookmarks behave? Should they be exact counterparts
> > of eww bookmarks?
>
> I went through what eww info manual says on bookmarks and used those
> bookmarks once to understand what is the provided feature; I can't
> find anything not available from standard bookmarks. Can you give
> details on what would be lost if eww used bookmarks.el?
I don't think anything would be lost. My setup is very different (I'm
saving Internet-related bookmarks in firefox and consult them from
Emacs), so I want to find out what a behavior users expect/prefer.
> > Should they be linked to eww, or should it be possible to open them
> > also with another browser (e.g. w3m).
>
> May be use `browse-url-default-browser`, but it's a different
> discussion IMOH; The current need is to make the user life simpler
> with a single place to search their bookmarks
Yes, but we need to specify some handler for the bookmarks, so it's
something to decide now.
> > Finally, what should I specify as `defaults' list for the name
> > suggestions available when you are prompted for a name for a new
> > bookmark? Just the url?
>
> An HTML document may have a "title" element; Isn't it possible to use
> the value of that element when available? And the URL otherwise.
I'll have a look.
Thanks,
Michael.
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: eww and bookmarks
2020-05-24 14:14 ` Alfred M. Szmidt
2020-05-24 19:06 ` Karl Fogel
@ 2020-05-25 4:35 ` Michael Heerdegen
2020-05-25 5:26 ` Alfred M. Szmidt
2020-05-25 12:51 ` Stefan Monnier
1 sibling, 2 replies; 45+ messages in thread
From: Michael Heerdegen @ 2020-05-25 4:35 UTC (permalink / raw)
To: Alfred M. Szmidt; +Cc: Matthias Meulien, npostavs, drew.adams, emacs-devel
ams@gnu.org (Alfred M. Szmidt) writes:
> Isn't this very easily done though, both so that it works for the case
No one said it is hard ;-) It's only left to decide how the handler
should behave.
> of eww, but also (which I think is important, in the generic case),
> simple untested hackery, in .emacs.bmk we have:
>
> ("The GNU Operating System and the Free Software Movement"
> (url . "http://www.gnu.org/")
> (handler . browse-url-bookmark-jump))
Is there really a generic case that creates bookmarks with an url field?
> Then browse-url-bookmark-jump is simply:
>
> (defun browse-url-bookmark-jump (bmk)
> (let* ((url (bookmark-prop-get bmk 'url))
> (buf (save-window-excursion (browse-url url) (current-buffer))))
> (bookmark-default-handler
> `("" (buffer . ,buf) . ,(bookmark-get-bookmark-record bmk)))))
>
> Those that like EWW would already be doing:
>
> (setq browse-url-browser-function 'eww-browse-url)
Ok, so you would make the handler call `browse-url-browser-function',
and not eww unconditionally. I think I would prefer that behavior, too.
> And then the equivalent browse-url-bookmark-make-record (e.g,
> Info-Info-bookmark-make-record) function for setting, which is left as
> a excersie for the reader -- or I can make a patch. This might not
> work of course if you are outside of the context of Emacs.
I already have one, but thanks for your input.
> It would be strange if eww implemented its own bookmarking
> functionality, when all of this is already simple to add.
Just to be clear: this is where we are, eww has it's own bookmarking
mechanism, for a long time.
Michael.
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: eww and bookmarks
2020-05-25 4:35 ` Michael Heerdegen
@ 2020-05-25 5:26 ` Alfred M. Szmidt
2020-05-26 2:17 ` Michael Heerdegen
2020-05-25 12:51 ` Stefan Monnier
1 sibling, 1 reply; 45+ messages in thread
From: Alfred M. Szmidt @ 2020-05-25 5:26 UTC (permalink / raw)
To: Michael Heerdegen; +Cc: orontee, npostavs, drew.adams, emacs-devel
> Isn't this very easily done though, both so that it works for the case
No one said it is hard ;-) It's only left to decide how the handler
should behave.
The most natural behaviour would be to use browse-url-browser-function
-- since that is what everything else in GNU Emacs would normally use
to browse URL's.
> of eww, but also (which I think is important, in the generic case),
> simple untested hackery, in .emacs.bmk we have:
>
> ("The GNU Operating System and the Free Software Movement"
> (url . "http://www.gnu.org/")
> (handler . browse-url-bookmark-jump))
Is there really a generic case that creates bookmarks with an url
field?
I'm not sure what you mean generic here?
Adding a new entry is possible, and even a supported case by
bookmark-make-record. Any web browser that can set a bookmark
(i.e. anything in Emacs) would ofcourse need to agree on using that
specific entry.
> It would be strange if eww implemented its own bookmarking
> functionality, when all of this is already simple to add.
Just to be clear: this is where we are, eww has it's own
bookmarking mechanism, for a long time.
That is a pity, but not one that is impossible to change. The
bookmarking code in eww, could be replaced with the same functionality
as used in rest of Emacs and still I think be compatible with the
current way eww does bookmarks from a users point of view.
Some sort of hackery maybe to convert existing bookmarks to
bookmark.el format might be useful though.
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: eww and bookmarks
2020-05-25 4:35 ` Michael Heerdegen
2020-05-25 5:26 ` Alfred M. Szmidt
@ 2020-05-25 12:51 ` Stefan Monnier
2020-05-25 13:52 ` Marcin Borkowski
` (2 more replies)
1 sibling, 3 replies; 45+ messages in thread
From: Stefan Monnier @ 2020-05-25 12:51 UTC (permalink / raw)
To: Michael Heerdegen
Cc: Alfred M. Szmidt, Matthias Meulien, npostavs, drew.adams,
emacs-devel
>> Those that like EWW would already be doing:
>> (setq browse-url-browser-function 'eww-browse-url)
> Ok, so you would make the handler call `browse-url-browser-function',
> and not eww unconditionally. I think I would prefer that behavior, too.
FWIW, I would like to use bookmarks for EWW, and I'd like those
bookmarks to *always* use EWW, and my `browse-url-browser-function` is
definitely not EWW but Firefox.
Emacs bookmarks don't just refer to a particular "page" but also
remember the place within that page (by remembering surrounding text)
and I think this part can only work if we go back with EWW.
Since the page was originally viewed in EWW the corresponding bookmark
*by default* should use EWW as well. We can add a configuration option
to make it obey `browse-url-browser-function` if you want, but it should
not be the default behavior: a bookmark is supposed to bring you back to
where it was created, so if it was created in EWW it shouldn't send you
to Firefox.
Stefan
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: eww and bookmarks
2020-05-25 12:51 ` Stefan Monnier
@ 2020-05-25 13:52 ` Marcin Borkowski
2020-05-25 15:03 ` Alfred M. Szmidt
[not found] ` <e23432dd-212b-4bf0-8e8c-185988c653f0@default>
2 siblings, 0 replies; 45+ messages in thread
From: Marcin Borkowski @ 2020-05-25 13:52 UTC (permalink / raw)
To: Stefan Monnier
Cc: Michael Heerdegen, Matthias Meulien, npostavs, emacs-devel,
Alfred M. Szmidt, drew.adams
On 2020-05-25, at 14:51, Stefan Monnier <monnier@iro.umontreal.ca> wrote:
>>> Those that like EWW would already be doing:
>>> (setq browse-url-browser-function 'eww-browse-url)
>> Ok, so you would make the handler call `browse-url-browser-function',
>> and not eww unconditionally. I think I would prefer that behavior, too.
>
> FWIW, I would like to use bookmarks for EWW, and I'd like those
> bookmarks to *always* use EWW, and my `browse-url-browser-function` is
> definitely not EWW but Firefox.
>
> Emacs bookmarks don't just refer to a particular "page" but also
> remember the place within that page (by remembering surrounding text)
> and I think this part can only work if we go back with EWW.
>
> Since the page was originally viewed in EWW the corresponding bookmark
> *by default* should use EWW as well. We can add a configuration option
> to make it obey `browse-url-browser-function` if you want, but it should
> not be the default behavior: a bookmark is supposed to bring you back to
> where it was created, so if it was created in EWW it shouldn't send you
> to Firefox.
+1
I was one of the people who asked for this feature at all. My main
browser is Firefox, but in this particular case, I prefer eww because of
the incremental search/swiper (the page is a poorly formatted
documentation for certain library).
Opening the bookmark in firefox would completely defeat the purpose of
having it at all.
It's not the question whether I like eww or not (in fact, I don't). The
thing is that I want to view some pages in firefox and others in eww.
Best,
--
Marcin Borkowski
http://mbork.pl
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: eww and bookmarks
2020-05-25 4:28 ` Michael Heerdegen
@ 2020-05-25 14:35 ` T.V Raman
0 siblings, 0 replies; 45+ messages in thread
From: T.V Raman @ 2020-05-25 14:35 UTC (permalink / raw)
To: Michael Heerdegen
Cc: Matthias Meulien, Noam Postavsky, Drew Adams, Emacs developers
Michael Heerdegen <michael_heerdegen@web.de> writes:
Here is a slightly different perspective --- as someone who pretty much
does everything Web from emacs --- and have done so for a long time,
especially during the dark years when W3 was moribund and EWW did not
exist, I got used to using org-capture for managing bookmarks. It has
some of its own advantages and encourages a slightly different workflow
-- especially if one is already using org-capture to quickly remember
ideas and organize them later.> Matthias Meulien <orontee@gmail.com> writes:
>
>> > How should the bookmarks behave? Should they be exact counterparts
>> > of eww bookmarks?
>>
>> I went through what eww info manual says on bookmarks and used those
>> bookmarks once to understand what is the provided feature; I can't
>> find anything not available from standard bookmarks. Can you give
>> details on what would be lost if eww used bookmarks.el?
>
> I don't think anything would be lost. My setup is very different (I'm
> saving Internet-related bookmarks in firefox and consult them from
> Emacs), so I want to find out what a behavior users expect/prefer.
>
>> > Should they be linked to eww, or should it be possible to open them
>> > also with another browser (e.g. w3m).
>>
>> May be use `browse-url-default-browser`, but it's a different
>> discussion IMOH; The current need is to make the user life simpler
>> with a single place to search their bookmarks
>
> Yes, but we need to specify some handler for the bookmarks, so it's
> something to decide now.
>
>> > Finally, what should I specify as `defaults' list for the name
>> > suggestions available when you are prompted for a name for a new
>> > bookmark? Just the url?
>>
>> An HTML document may have a "title" element; Isn't it possible to use
>> the value of that element when available? And the URL otherwise.
>
> I'll have a look.
>
> Thanks,
>
> Michael.
>
--
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: eww and bookmarks
2020-05-25 12:51 ` Stefan Monnier
2020-05-25 13:52 ` Marcin Borkowski
@ 2020-05-25 15:03 ` Alfred M. Szmidt
2020-05-25 15:24 ` Stefan Monnier
2020-05-25 23:40 ` Michael Heerdegen
[not found] ` <e23432dd-212b-4bf0-8e8c-185988c653f0@default>
2 siblings, 2 replies; 45+ messages in thread
From: Alfred M. Szmidt @ 2020-05-25 15:03 UTC (permalink / raw)
To: Stefan Monnier
Cc: michael_heerdegen, orontee, npostavs, drew.adams, emacs-devel
>> Those that like EWW would already be doing:
>> (setq browse-url-browser-function 'eww-browse-url)
> Ok, so you would make the handler call `browse-url-browser-function',
> and not eww unconditionally. I think I would prefer that behavior, too.
FWIW, I would like to use bookmarks for EWW, and I'd like those
bookmarks to *always* use EWW, and my `browse-url-browser-function` is
definitely not EWW but Firefox.
Wouldn't defadvice with browse-url-browser-function bound to
eww-browse-url over browse-url-bookmark-jump be sufficient?
Emacs bookmarks don't just refer to a particular "page" but also
remember the place within that page (by remembering surrounding text)
and I think this part can only work if we go back with EWW.
Since the page was originally viewed in EWW the corresponding bookmark
*by default* should use EWW as well. We can add a configuration option
to make it obey `browse-url-browser-function` if you want, but it should
not be the default behavior: a bookmark is supposed to bring you back to
where it was created, so if it was created in EWW it shouldn't send you
to Firefox.
That sounds like confusing behaviour, you would never know what your
bookmark jump would jump too -- somtimes it is EWW, somtimes it is
Firefox, sometimes it might be a third thing?
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: eww and bookmarks
2020-05-25 15:03 ` Alfred M. Szmidt
@ 2020-05-25 15:24 ` Stefan Monnier
2020-05-25 23:40 ` Michael Heerdegen
1 sibling, 0 replies; 45+ messages in thread
From: Stefan Monnier @ 2020-05-25 15:24 UTC (permalink / raw)
To: Alfred M. Szmidt
Cc: michael_heerdegen, orontee, npostavs, drew.adams, emacs-devel
> Wouldn't defadvice with browse-url-browser-function bound to
> eww-browse-url over browse-url-bookmark-jump be sufficient?
;-)
> That sounds like confusing behaviour, you would never know what your
> bookmark jump would jump too -- somtimes it is EWW, somtimes it is
> Firefox, sometimes it might be a third thing?
AFAIK we currently don't have any code which generates bookmarks that
are passed to Firefox. [ And Firefox has its own bookmarks for that. ]
Stefan
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: eww and bookmarks
2020-05-25 15:03 ` Alfred M. Szmidt
2020-05-25 15:24 ` Stefan Monnier
@ 2020-05-25 23:40 ` Michael Heerdegen
1 sibling, 0 replies; 45+ messages in thread
From: Michael Heerdegen @ 2020-05-25 23:40 UTC (permalink / raw)
To: Alfred M. Szmidt
Cc: emacs-devel, orontee, Stefan Monnier, drew.adams, npostavs
ams@gnu.org (Alfred M. Szmidt) writes:
> That sounds like confusing behaviour, you would never know what your
> bookmark jump would jump too -- somtimes it is EWW, somtimes it is
> Firefox, sometimes it might be a third thing?
If we add this, this new vanilla Emacs bookmark type would be the only
kind of Emacs bookmarks including an url, so the behavior would be
always the same, it would just be configurable - or do I miss something?
Michael.
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: eww and bookmarks
[not found] ` <e23432dd-212b-4bf0-8e8c-185988c653f0@default>
@ 2020-05-26 1:04 ` Michael Heerdegen
2020-05-27 5:10 ` Drew Adams
0 siblings, 1 reply; 45+ messages in thread
From: Michael Heerdegen @ 2020-05-26 1:04 UTC (permalink / raw)
To: Drew Adams; +Cc: Emacs Development
Drew Adams <drew.adams@oracle.com> writes:
> Some specifics:
>
> 1. Bookmark record uses web-page title as default name
> of bookmark.
>
> 2. Jumping to bookmark can use a new buffer, per option.
> nil (default): reuse an existing buffer for that URL.
> non-nil: use a new buffer.
>
> 3. Name of EWW buffer can optionally change when you
> jump to bookmark. Buffer name is per user option: nil
> (default): don't rename. `url': rename to web-page
> title plus last 20 chars of URL (e.g. anchor).
> `page': rename to web-page title (only).
>
> 4. Minor mode for automatic bookmark creation/updating.
> Option to choose whether to only updating existing
> bookmarks or also create new bookmarks. (Updating
> increases the recorded number of visits and the last
> visit date+time.)
What do you others think? Do you want to see some of those features in
Emacs (apart from 1, which I think is not controversial and definitely
"must have")?
> > Emacs bookmarks don't just refer to a particular "page" but also
> > remember the place within that page (by remembering surrounding text)
> > and I think this part can only work if we go back with EWW.
>
> Yes.
I think for w3m it could work as well, no?
But here we have a difference to eww bookmarks: AFAIK they don't save a
position along with the url.
Michael.
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: eww and bookmarks
2020-05-25 5:26 ` Alfred M. Szmidt
@ 2020-05-26 2:17 ` Michael Heerdegen
2020-06-10 15:39 ` Lars Ingebrigtsen
0 siblings, 1 reply; 45+ messages in thread
From: Michael Heerdegen @ 2020-05-26 2:17 UTC (permalink / raw)
To: Lars Ingebrigtsen, Alfred M. Szmidt
Cc: orontee, npostavs, drew.adams, emacs-devel
ams@gnu.org (Alfred M. Szmidt) writes:
> > It would be strange if eww implemented its own bookmarking
> > functionality, when all of this is already simple to add.
>
> Just to be clear: this is where we are, eww has it's own
> bookmarking mechanism, for a long time.
>
> That is a pity, but not one that is impossible to change. The
> bookmarking code in eww, could be replaced with the same functionality
> as used in rest of Emacs and still I think be compatible with the
> current way eww does bookmarks from a users point of view.
>
> Some sort of hackery maybe to convert existing bookmarks to
> bookmark.el format might be useful though.
Lars, we are wondering why you implemented a separate bookmarking
mechanism for eww instead of relying on the existing Emacs bookmarks.
Could you give us some background? Do eww bookmarks offer some feature
that vanilla bookmarks don't support? Or did you just want to have
something separate?
TIA,
Michael.
^ permalink raw reply [flat|nested] 45+ messages in thread
* RE: eww and bookmarks
2020-05-26 1:04 ` Michael Heerdegen
@ 2020-05-27 5:10 ` Drew Adams
0 siblings, 0 replies; 45+ messages in thread
From: Drew Adams @ 2020-05-27 5:10 UTC (permalink / raw)
To: Michael Heerdegen; +Cc: Emacs Development
> I think for w3m it could work as well, no?
Bookmark+ supports W3M too, but not as elaborately.
^ permalink raw reply [flat|nested] 45+ messages in thread
* eww and bookmarks
@ 2020-05-27 7:18 Boruch Baum
2020-05-27 14:40 ` Drew Adams
0 siblings, 1 reply; 45+ messages in thread
From: Boruch Baum @ 2020-05-27 7:18 UTC (permalink / raw)
To: Emacs-Devel List
For tinfoil-hat reasons, I'm hesitant about the idea of having a single
bookmark list for both local and network resources, and both emacs and
non-emacs launching. I don't want a situation where there might be
uncertainty which program is about to be launched or whether the network
is going to accessed and what follow-on 'stuff' my device will end up
doing.
That doesn't mean I oppose the notion of a single 'grand unified'
bookmark list, just that I would want some clear indication in advance
of what is about to happen should I open any specific link.
Maybe what would be sufficient for those concerns would be a pair of
visual cues: one for 'local/network', and a second for 'emacs/external'.
Then an interested user could query a bookmark's details for further
information, or just click-through. The visual cues might not even need
to take up additional screen space: maybe it would be sufficient to
underline network bookmarks, and to italicize bookmarks that launch
external programs.
--
hkp://keys.gnupg.net
CA45 09B5 5351 7C11 A9D1 7286 0036 9E45 1595 8BC0
^ permalink raw reply [flat|nested] 45+ messages in thread
* RE: eww and bookmarks
2020-05-27 7:18 eww and bookmarks Boruch Baum
@ 2020-05-27 14:40 ` Drew Adams
0 siblings, 0 replies; 45+ messages in thread
From: Drew Adams @ 2020-05-27 14:40 UTC (permalink / raw)
To: Boruch Baum, Emacs-Devel List
> For tinfoil-hat reasons, I'm hesitant about the idea of having a single
> bookmark list for both local and network resources, and both emacs and
> non-emacs launching. I don't want a situation where there might be
> uncertainty which program is about to be launched or whether the
> network
> is going to accessed and what follow-on 'stuff' my device will end up
> doing.
>
> That doesn't mean I oppose the notion of a single 'grand unified'
> bookmark list, just that I would want some clear indication in advance
> of what is about to happen should I open any specific link.
>
> Maybe what would be sufficient for those concerns would be a pair of
> visual cues: one for 'local/network', and a second for
> 'emacs/external'.
> Then an interested user could query a bookmark's details for further
> information, or just click-through. The visual cues might not even need
> to take up additional screen space: maybe it would be sufficient to
> underline network bookmarks, and to italicize bookmarks that launch
> external programs.
I'm not sure just what you're replying to,
but different bookmark types can be created.
So sure, you could have any number of different
kinds of bookmarks for URLs or whatever. And,
at least with Bookmark+, you can have different
types look different in the displayed bookmark
list. And you can sort that list by type.
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: eww and bookmarks
2020-05-20 22:14 ` Michael Heerdegen
@ 2020-06-07 15:09 ` Michael Heerdegen
2020-06-07 15:30 ` Basil L. Contovounesios
2020-06-07 16:31 ` Clément Pit-Claudel
0 siblings, 2 replies; 45+ messages in thread
From: Michael Heerdegen @ 2020-06-07 15:09 UTC (permalink / raw)
To: emacs-devel; +Cc: Lars Ingebrigtsen
[-- Attachment #1: Type: text/plain, Size: 753 bytes --]
Michael Heerdegen <michael_heerdegen@web.de> writes:
> I'll install my suggested patch as well soon, sorry for the delay.
Coming back to this: I've got a problem with the implementation: because
eww retrieves asynchronously, jumping to the bookmark's position does
not work, because when that is done, the buffer is not yet filled and
rendered. I don't see a way to make this work that is not either an
ugly hack or would involve changing and refactoring parts of the eww
code. I don't really feel qualified.
What would be needed at least would be to replace the hardcoded
#'eww-render in the `url-retrieve' call in `eww' with a newly introduced
variable `eww-render-function' I could bind. Or is there a better way?
Here is what I have so far:
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: WIP-Make-standard-bookmarks-work-for-eww-buffers.patch --]
[-- Type: text/x-diff, Size: 4604 bytes --]
From 520ada35ad5804b01afa84fd258d59ecc567799f 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
---
etc/NEWS | 3 +++
lisp/net/eww.el | 58 +++++++++++++++++++++++++++++++++++++++++++------
2 files changed, 54 insertions(+), 7 deletions(-)
diff --git a/etc/NEWS b/etc/NEWS
index ed4722b27f..3ddfbe3d25 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -403,6 +403,9 @@ The function that is invoked when clicking on or otherwise following a
'mailto:' link in an EWW buffer can now be customized. For more
information, see the related entry about 'shr-browse-url' above.
+*** Support for bookmark.el.
+EWW buffers can now be bookmarked with standard bookmarks.
+
** Project
*** New user option 'project-vc-merge-submodules'.
diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index 2a70560ca7..3b1948649d 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -83,6 +83,13 @@ eww-bookmarks-directory
:group 'eww
:type 'directory)
+(defcustom bookmark-eww-browse-url-function #'eww-browse-url
+ "Doc..."
+ :type '(choice
+ (function-item eww-browse-url :doc "Use eww")
+ (const :tag "Use value of `browse-url-browser-function'" nil)
+ function))
+
(defcustom eww-desktop-remove-duplicates t
"Whether to remove duplicates from the history when saving desktop data.
If non-nil, repetitive EWW history entries (comprising of the URI, the
@@ -895,6 +902,8 @@ 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
+ (setq-local bookmark-make-record-function #'eww-bookmark-make-record)
(setq truncate-lines t)
(buffer-disable-undo)
(setq buffer-read-only t))
@@ -1720,6 +1729,11 @@ eww-toggle-colors
(defvar eww-bookmarks nil)
+(defun eww--bookmark-title (title-string)
+ (replace-regexp-in-string
+ "\\` +\\| +\\'" ""
+ (replace-regexp-in-string "[\n\t\r]" " " title-string)))
+
(defun eww-add-bookmark ()
"Bookmark the current page."
(interactive)
@@ -1728,13 +1742,10 @@ eww-add-bookmark
(when (equal (plist-get eww-data :url) (plist-get bookmark :url))
(user-error "Already bookmarked")))
(when (y-or-n-p "Bookmark this page?")
- (let ((title (replace-regexp-in-string "[\n\t\r]" " "
- (plist-get eww-data :title))))
- (setq title (replace-regexp-in-string "\\` +\\| +\\'" "" title))
- (push (list :url (plist-get eww-data :url)
- :title title
- :time (current-time-string))
- eww-bookmarks))
+ (push (list :url (plist-get eww-data :url)
+ :title (eww--bookmark-title (plist-get eww-data :title))
+ :time (current-time-string))
+ eww-bookmarks)
(eww-write-bookmarks)
(message "Bookmarked %s (%s)" (plist-get eww-data :url)
(plist-get eww-data :title))))
@@ -1888,6 +1899,39 @@ 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 ()
+ "Create an emacs bookmark record for an eww buffer.
+This implements the `bookmark-make-record-function' type (which
+see)."
+ (let ((url (plist-get eww-data :url)))
+ `(,(plist-get eww-data :title)
+ ,@(bookmark-make-record-default 'no-file)
+ (url . ,url)
+ (defaults . (,(eww--bookmark-title (plist-get eww-data :title))
+ ,url))
+ (handler . ,#'bookmark-eww-bookmark-jump))))
+
+(declare-function bookmark-get-bookmark-record bookmark)
+;;;###autoload
+(defun bookmark-eww-bookmark-jump (bookmark)
+ "Bookmark handler for eww buffers."
+ (let ((browse-url-fun (or bookmark-eww-browse-url-function
+ browse-url-browser-function)))
+ (funcall browse-url-fun (bookmark-prop-get bookmark 'url))
+ (when (eq browse-url-fun #'eww-browse-url)
+ ;;FIXME: this doesn't work because eww renders asynchronously:
+ (bookmark-default-handler
+ `(""
+ (buffer . ,(current-buffer)) .
+ ,(bookmark-get-bookmark-record bookmark))))))
+
;;; History code
(defun eww-save-history ()
--
2.26.2
[-- Attachment #3: Type: text/plain, Size: 20 bytes --]
Thanks,
Michael.
^ permalink raw reply related [flat|nested] 45+ messages in thread
* Re: eww and bookmarks
2020-06-07 15:09 ` Michael Heerdegen
@ 2020-06-07 15:30 ` Basil L. Contovounesios
2020-06-07 16:13 ` Michael Heerdegen
` (2 more replies)
2020-06-07 16:31 ` Clément Pit-Claudel
1 sibling, 3 replies; 45+ messages in thread
From: Basil L. Contovounesios @ 2020-06-07 15:30 UTC (permalink / raw)
To: Michael Heerdegen; +Cc: Lars Ingebrigtsen, emacs-devel
Michael Heerdegen <michael_heerdegen@web.de> writes:
> Michael Heerdegen <michael_heerdegen@web.de> writes:
>
>> I'll install my suggested patch as well soon, sorry for the delay.
>
> Coming back to this: I've got a problem with the implementation: because
> eww retrieves asynchronously, jumping to the bookmark's position does
> not work, because when that is done, the buffer is not yet filled and
> rendered. I don't see a way to make this work that is not either an
> ugly hack or would involve changing and refactoring parts of the eww
> code. I don't really feel qualified.
>
> What would be needed at least would be to replace the hardcoded
> #'eww-render in the `url-retrieve' call in `eww' with a newly introduced
> variable `eww-render-function' I could bind. Or is there a better way?
There's eww-after-render-hook. Sample usage:
https://emacs.stackexchange.com/a/36287/15748
> Here is what I have so far:
Thanks, some minor comments from me.
[...]
> diff --git a/lisp/net/eww.el b/lisp/net/eww.el
> index 2a70560ca7..3b1948649d 100644
> --- a/lisp/net/eww.el
> +++ b/lisp/net/eww.el
> @@ -83,6 +83,13 @@ eww-bookmarks-directory
> :group 'eww
> :type 'directory)
>
> +(defcustom bookmark-eww-browse-url-function #'eww-browse-url
> + "Doc..."
> + :type '(choice
> + (function-item eww-browse-url :doc "Use eww")
> + (const :tag "Use value of `browse-url-browser-function'" nil)
> + function))
Isn't it strange having a boookmark-... variable defined in eww.el?
[...]
> +(defun eww--bookmark-title (title-string)
> + (replace-regexp-in-string
> + "\\` +\\| +\\'" ""
> + (replace-regexp-in-string "[\n\t\r]" " " title-string)))
Is the outer replace-regexp-in-string doing the same as string-trim?
[...]
> +(defun eww-bookmark-make-record ()
> + "Create an emacs bookmark record for an eww buffer.
^^^^^ ^^^
Capitalize Upcase
> +This implements the `bookmark-make-record-function' type (which
> +see)."
[...]
> +(defun bookmark-eww-bookmark-jump (bookmark)
> + "Bookmark handler for eww buffers."
^^^
Upcase
[...]
Thanks,
--
Basil
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: eww and bookmarks
2020-06-07 15:30 ` Basil L. Contovounesios
@ 2020-06-07 16:13 ` Michael Heerdegen
2020-06-07 16:36 ` Tomas Hlavaty
2020-06-07 18:23 ` Basil L. Contovounesios
2020-06-07 16:36 ` Lars Ingebrigtsen
2020-06-08 14:42 ` Michael Heerdegen
2 siblings, 2 replies; 45+ messages in thread
From: Michael Heerdegen @ 2020-06-07 16:13 UTC (permalink / raw)
To: Basil L. Contovounesios; +Cc: Lars Ingebrigtsen, emacs-devel
"Basil L. Contovounesios" <contovob@tcd.ie> writes:
> There's eww-after-render-hook. Sample usage:
> https://emacs.stackexchange.com/a/36287/15748
Yes, I know about the hook. But just binding it will not be enough
because the binding will be gone when it is consulted. We would have to
add a self-removing function at least to the local binding of the hook.
That's what I would call a hack.
Didn't yet look at your other points, but thank you so far.
Michael.
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: eww and bookmarks
2020-06-07 15:09 ` Michael Heerdegen
2020-06-07 15:30 ` Basil L. Contovounesios
@ 2020-06-07 16:31 ` Clément Pit-Claudel
1 sibling, 0 replies; 45+ messages in thread
From: Clément Pit-Claudel @ 2020-06-07 16:31 UTC (permalink / raw)
To: emacs-devel
On 07/06/2020 11.09, Michael Heerdegen wrote:
> + (replace-regexp-in-string
> + "\\` +\\| +\\'" ""
Would string-trim for this?
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: eww and bookmarks
2020-06-07 16:13 ` Michael Heerdegen
@ 2020-06-07 16:36 ` Tomas Hlavaty
2020-06-07 18:23 ` Basil L. Contovounesios
1 sibling, 0 replies; 45+ messages in thread
From: Tomas Hlavaty @ 2020-06-07 16:36 UTC (permalink / raw)
To: Michael Heerdegen, Basil L. Contovounesios; +Cc: Lars Ingebrigtsen, emacs-devel
Michael Heerdegen <michael_heerdegen@web.de> writes:
> "Basil L. Contovounesios" <contovob@tcd.ie> writes:
>
>> There's eww-after-render-hook. Sample usage:
>> https://emacs.stackexchange.com/a/36287/15748
>
> Yes, I know about the hook. But just binding it will not be enough
> because the binding will be gone when it is consulted. We would have to
> add a self-removing function at least to the local binding of the hook.
> That's what I would call a hack.
eww-after-render-hook does not seem to be useable because it runs in the
wrong buffer at the wrong time.
I hit the issue when implementing the following use-case:
1) Open login page URL
2) Automatically fill in username and password
3) Automatically submit the login form
My workaround something like this:
(defun login-fn-delayed ()
(with-current-buffer "*eww*"
(fill-in-username-and-password)
(submit-login-form)))
(defun login-fn ()
(interactive)
(eww some-url)
(run-with-timer "1 sec" nil 'login-fn-delayed))
It would be nice, if there was no need for run-with-timer and no need
for (with-current-buffer "*eww*"...).
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: eww and bookmarks
2020-06-07 15:30 ` Basil L. Contovounesios
2020-06-07 16:13 ` Michael Heerdegen
@ 2020-06-07 16:36 ` Lars Ingebrigtsen
2020-06-07 18:23 ` Basil L. Contovounesios
2020-06-08 14:42 ` Michael Heerdegen
2 siblings, 1 reply; 45+ messages in thread
From: Lars Ingebrigtsen @ 2020-06-07 16:36 UTC (permalink / raw)
To: Basil L. Contovounesios; +Cc: Michael Heerdegen, emacs-devel
"Basil L. Contovounesios" <contovob@tcd.ie> writes:
>> +(defun eww-bookmark-make-record ()
>> + "Create an emacs bookmark record for an eww buffer.
> ^^^^^ ^^^
> Capitalize Upcase
I always write eww in lower-case.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: eww and bookmarks
2020-06-07 16:13 ` Michael Heerdegen
2020-06-07 16:36 ` Tomas Hlavaty
@ 2020-06-07 18:23 ` Basil L. Contovounesios
2020-06-08 14:49 ` Michael Heerdegen
1 sibling, 1 reply; 45+ messages in thread
From: Basil L. Contovounesios @ 2020-06-07 18:23 UTC (permalink / raw)
To: Michael Heerdegen; +Cc: Lars Ingebrigtsen, emacs-devel
Michael Heerdegen <michael_heerdegen@web.de> writes:
> "Basil L. Contovounesios" <contovob@tcd.ie> writes:
>
>> There's eww-after-render-hook. Sample usage:
>> https://emacs.stackexchange.com/a/36287/15748
>
> Yes, I know about the hook. But just binding it will not be enough
> because the binding will be gone when it is consulted. We would have to
> add a self-removing function at least to the local binding of the hook.
> That's what I would call a hack.
Why? It's what minibuffer-with-setup-hook does, for example.
If you really wanted to you could add a new hook/variable to provide the
desired semantics directly, but it's not absolutely necessary.
--
Basil
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: eww and bookmarks
2020-06-07 16:36 ` Lars Ingebrigtsen
@ 2020-06-07 18:23 ` Basil L. Contovounesios
0 siblings, 0 replies; 45+ messages in thread
From: Basil L. Contovounesios @ 2020-06-07 18:23 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: Michael Heerdegen, emacs-devel
Lars Ingebrigtsen <larsi@gnus.org> writes:
> "Basil L. Contovounesios" <contovob@tcd.ie> writes:
>
>>> +(defun eww-bookmark-make-record ()
>>> + "Create an emacs bookmark record for an eww buffer.
>> ^^^^^ ^^^
>> Capitalize Upcase
>
> I always write eww in lower-case.
Okay, but that's not consistently followed. C-h f eww RET:
If called with a prefix ARG, use a new buffer instead of reusing
the default EWW buffer.
--
Basil
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: eww and bookmarks
2020-06-07 15:30 ` Basil L. Contovounesios
2020-06-07 16:13 ` Michael Heerdegen
2020-06-07 16:36 ` Lars Ingebrigtsen
@ 2020-06-08 14:42 ` Michael Heerdegen
2020-06-08 16:58 ` Basil L. Contovounesios
2 siblings, 1 reply; 45+ messages in thread
From: Michael Heerdegen @ 2020-06-08 14:42 UTC (permalink / raw)
To: Basil L. Contovounesios; +Cc: Lars Ingebrigtsen, emacs-devel
"Basil L. Contovounesios" <contovob@tcd.ie> writes:
> > +(defcustom bookmark-eww-browse-url-function #'eww-browse-url
> > + "Doc..."
> > + :type '(choice
> > + (function-item eww-browse-url :doc "Use eww")
> > + (const :tag "Use value of `browse-url-browser-function'" nil)
> > + function))
>
> Isn't it strange having a boookmark-... variable defined in eww.el?
Yes. OTOH I wanted to avoid the risk of confusion with eww bookmarks
and not call it "eww-bookmark-...". Suggestions?
> > +(defun eww--bookmark-title (title-string)
> > + (replace-regexp-in-string
> > + "\\` +\\| +\\'" ""
> > + (replace-regexp-in-string "[\n\t\r]" " " title-string)))
>
> Is the outer replace-regexp-in-string doing the same as string-trim?
Is it? I didn't touch that code, I only moved it for factoring.
> > +(defun eww-bookmark-make-record ()
> > + "Create an emacs bookmark record
> ^^^^^
> Capitalize
Done.
> > for an eww buffer.
> > ^^^
> > Upcase
Is it ok to leave it downcased?
Thanks,
Michael.
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: eww and bookmarks
2020-06-07 18:23 ` Basil L. Contovounesios
@ 2020-06-08 14:49 ` Michael Heerdegen
2020-06-08 16:54 ` Basil L. Contovounesios
0 siblings, 1 reply; 45+ messages in thread
From: Michael Heerdegen @ 2020-06-08 14:49 UTC (permalink / raw)
To: Basil L. Contovounesios; +Cc: Lars Ingebrigtsen, emacs-devel
"Basil L. Contovounesios" <contovob@tcd.ie> writes:
> > Yes, I know about the hook. But just binding it will not be enough
> > because the binding will be gone when it is consulted. We would have to
> > add a self-removing function at least to the local binding of the hook.
> > That's what I would call a hack.
>
> Why? It's what minibuffer-with-setup-hook does, for example.
That can use `unwind-protect' because it has not to wait an undefined
period of time (until the page has been retrieved asynchronously).
So we would have to consider what could happen if the user aborts
loading the page, the url can't be retrieved, there is an intermediate
error, and such. That's why I think using the callback of
`url-retrieve' would be better/cleaner.
Michael.
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: eww and bookmarks
2020-06-08 14:49 ` Michael Heerdegen
@ 2020-06-08 16:54 ` Basil L. Contovounesios
2020-06-10 12:01 ` Michael Heerdegen
0 siblings, 1 reply; 45+ messages in thread
From: Basil L. Contovounesios @ 2020-06-08 16:54 UTC (permalink / raw)
To: Michael Heerdegen; +Cc: Lars Ingebrigtsen, emacs-devel
Michael Heerdegen <michael_heerdegen@web.de> writes:
> "Basil L. Contovounesios" <contovob@tcd.ie> writes:
>
>> > Yes, I know about the hook. But just binding it will not be enough
>> > because the binding will be gone when it is consulted. We would have to
>> > add a self-removing function at least to the local binding of the hook.
>> > That's what I would call a hack.
>>
>> Why? It's what minibuffer-with-setup-hook does, for example.
>
> That can use `unwind-protect' because it has not to wait an undefined
> period of time (until the page has been retrieved asynchronously).
>
> So we would have to consider what could happen if the user aborts
> loading the page, the url can't be retrieved, there is an intermediate
> error, and such. That's why I think using the callback of
> `url-retrieve' would be better/cleaner.
Could you store the desired callback or other values in eww-data?
--
Basil
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: eww and bookmarks
2020-06-08 14:42 ` Michael Heerdegen
@ 2020-06-08 16:58 ` Basil L. Contovounesios
2020-06-10 12:06 ` Michael Heerdegen
0 siblings, 1 reply; 45+ messages in thread
From: Basil L. Contovounesios @ 2020-06-08 16:58 UTC (permalink / raw)
To: Michael Heerdegen; +Cc: Lars Ingebrigtsen, emacs-devel
Michael Heerdegen <michael_heerdegen@web.de> writes:
> "Basil L. Contovounesios" <contovob@tcd.ie> writes:
>
>> > +(defcustom bookmark-eww-browse-url-function #'eww-browse-url
>> > + "Doc..."
>> > + :type '(choice
>> > + (function-item eww-browse-url :doc "Use eww")
>> > + (const :tag "Use value of `browse-url-browser-function'" nil)
>> > + function))
>>
>> Isn't it strange having a boookmark-... variable defined in eww.el?
>
> Yes. OTOH I wanted to avoid the risk of confusion with eww bookmarks
> and not call it "eww-bookmark-...". Suggestions?
Is the proposed bookmark.el support not meant to supersede EWW's current
bookmark system?
Anyway, what about eww-browse-bookmark-function?
>> > +(defun eww--bookmark-title (title-string)
>> > + (replace-regexp-in-string
>> > + "\\` +\\| +\\'" ""
>> > + (replace-regexp-in-string "[\n\t\r]" " " title-string)))
>>
>> Is the outer replace-regexp-in-string doing the same as string-trim?
>
> Is it? I didn't touch that code, I only moved it for factoring.
That's what it looks like to me, but you can obviously leave it alone
for now.
>> > +(defun eww-bookmark-make-record ()
>> > + "Create an emacs bookmark record
>> ^^^^^
>> Capitalize
>
> Done.
>
>> > for an eww buffer.
>> > ^^^
>> > Upcase
>
> Is it ok to leave it downcased?
That's what Lars asked for, so yes.
--
Basil
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: eww and bookmarks
2020-06-08 16:54 ` Basil L. Contovounesios
@ 2020-06-10 12:01 ` Michael Heerdegen
0 siblings, 0 replies; 45+ messages in thread
From: Michael Heerdegen @ 2020-06-10 12:01 UTC (permalink / raw)
To: Basil L. Contovounesios; +Cc: Lars Ingebrigtsen, emacs-devel
"Basil L. Contovounesios" <contovob@tcd.ie> writes:
> > So we would have to consider what could happen if the user aborts
> > loading the page, the url can't be retrieved, there is an intermediate
> > error, and such. That's why I think using the callback of
> > `url-retrieve' would be better/cleaner.
>
> Could you store the desired callback or other values in eww-data?
I guess. But it's not the solution I would prefer.
BTW, `eww-render' already has a POINT argument. Not quite enough for
our purpose, though.
Another alternative: we could make the callback arg of the
`url-retrieve' call in `eww' a closure remembering the value of
`eww-after-render-hook'. That would make binding the hook variable work
as expected.
Michael.
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: eww and bookmarks
2020-06-08 16:58 ` Basil L. Contovounesios
@ 2020-06-10 12:06 ` Michael Heerdegen
2020-10-26 18:15 ` Adam Porter
0 siblings, 1 reply; 45+ messages in thread
From: Michael Heerdegen @ 2020-06-10 12:06 UTC (permalink / raw)
To: Basil L. Contovounesios; +Cc: Lars Ingebrigtsen, emacs-devel
"Basil L. Contovounesios" <contovob@tcd.ie> writes:
> Is the proposed bookmark.el support not meant to supersede EWW's current
> bookmark system?
In the long run, maybe. I will not do that now. Personally, I
don't feel bad about eww having a separate bookmarking mechanism like
any other browser.
Michael.
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: eww and bookmarks
2020-05-26 2:17 ` Michael Heerdegen
@ 2020-06-10 15:39 ` Lars Ingebrigtsen
2020-06-10 20:03 ` Drew Adams
0 siblings, 1 reply; 45+ messages in thread
From: Lars Ingebrigtsen @ 2020-06-10 15:39 UTC (permalink / raw)
To: Michael Heerdegen
Cc: Alfred M. Szmidt, orontee, npostavs, drew.adams, emacs-devel
Michael Heerdegen <michael_heerdegen@web.de> writes:
> Lars, we are wondering why you implemented a separate bookmarking
> mechanism for eww instead of relying on the existing Emacs bookmarks.
> Could you give us some background? Do eww bookmarks offer some feature
> that vanilla bookmarks don't support? Or did you just want to have
> something separate?
There's two reasons -- I had no idea that bookmark.el existed. Well,
OK, that's the main reason.
The other is that ever web browser has a bookmark facility, and that's
not usually mixed in with, well, other stuff.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 45+ messages in thread
* RE: eww and bookmarks
2020-06-10 15:39 ` Lars Ingebrigtsen
@ 2020-06-10 20:03 ` Drew Adams
0 siblings, 0 replies; 45+ messages in thread
From: Drew Adams @ 2020-06-10 20:03 UTC (permalink / raw)
To: Lars Ingebrigtsen, Michael Heerdegen; +Cc: ams, emacs-devel
Dunno why, but this message of mine seems never to have
made it to the mailing list (?). Maybe this time will
be luckier.
___
> > > Could you give us some background? Do eww bookmarks offer some feature
> > > that vanilla bookmarks don't support? Or did you just want to have
> > > something separate?
> >
> > There's two reasons -- I had no idea that bookmark.el existed. Well,
> > OK, that's the main reason.
> >
> > The other is that ever web browser has a bookmark facility, and that's
> > not usually mixed in with, well, other stuff.
>
> [Still dunno why I'm not seeing emacs-devel@gnu.org in the cc list for a few
> posts, and I have to add it manually because Reply All doesn't find it.]
>
> FYI/FWIW -
>
> When you use ordinary Emacs bookmarks (e.g. bookmark.el
> or Bookmark+), there's no requirement to mix bookmarks
> of different types. So EWW bookmarks that are "normal"
> (i.e. Emacs bookmarks, not what EWW calls "bookmarks")
> need not be "mixed in with, well, other stuff."
>
> You can organize bookmarks in different ways. One way
> is to use different bookmark files - you can have a file
> just for your EWW bookmarks, or just EWW bookmarks for
> certain purposes. You can have any number of bookmark
> files, and it's simple to switch among them.
>
> If you use Bookmark+, there are several other ways to
> organize bookmarks, including:
>
> * Different bookmark-list displays (which can themselves
> be bookmarked, BTW, as can bookmark files). So even if
> the current bookmark file has bookmarks of different
> kinds you can show and act on different sets of them,
> using different listings. [1] [2] [3]
>
> * You can tag bookmarks, and view/list or act on only
> those that have a given tag or set of tags. Tags allow
> organizations other than just flat sets or trees. Tags
> provide the most flexible way to organize bookmarks. [4]
>
> * You can sort bookmarks in the bookmark-list display in
> various ways, including according to type (e.g. all EWW
> bookmarks first). [5]
>
> * You can filter the bookmark-list display, to show only
> bookmarks that satisfy some condition(s) (e.g. being an
> EWW bookmark). And you can omit bookmarks from display
> that satisfy some conditions (as in Dired file omitting).
> [6] [7]
> ___
>
>
> [1]: https://www.emacswiki.org/emacs/BookmarkPlus#BookmarkListDisplay
>
> [2]: https://www.emacswiki.org/emacs/BookmarkPlus#bookmark-listBookmarks
>
> [3]: https://www.emacswiki.org/emacs/BookmarkPlus#BookmarkFileBookmarks
>
> [4]: https://www.emacswiki.org/emacs/BookmarkPlus#BookmarkTags
>
> [5]: https://www.emacswiki.org/emacs/BookmarkPlus#SortingBookmarks
>
> [6]: https://www.emacswiki.org/emacs/BookmarkPlus#FilteringBookmarks
>
> [7]: https://www.emacswiki.org/emacs/BookmarkPlus#OmittingBookmarks
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: eww and bookmarks
2020-06-10 12:06 ` Michael Heerdegen
@ 2020-10-26 18:15 ` Adam Porter
2020-10-26 18:33 ` Drew Adams
` (2 more replies)
0 siblings, 3 replies; 45+ messages in thread
From: Adam Porter @ 2020-10-26 18:15 UTC (permalink / raw)
To: emacs-devel
Hi,
Having recently put together a new package that uses bookmarks to
restore windows and buffers, Burly[0], I tested bookmarks with EWW
buffers, expecting them to be bookmarkable with Emacs bookmarks, but I
found that they aren't. Then I found this thread[1] from June about
Michael's patch, which sounds great, but it doesn't seem to have been
applied yet.
Is there any chance it can make it into Emacs 28? It seems a shame for
EWW buffers to not work with Emacs's own bookmark system.
Thanks to Michael, et al for your work on this patch.
0: https://github.com/alphapapa/burly.el
1: https://lists.gnu.org/archive/html/emacs-devel/2020-06/msg00364.html
^ permalink raw reply [flat|nested] 45+ messages in thread
* RE: eww and bookmarks
2020-10-26 18:15 ` Adam Porter
@ 2020-10-26 18:33 ` Drew Adams
2020-10-26 18:43 ` Lars Ingebrigtsen
2020-10-26 19:26 ` Karl Fogel
2 siblings, 0 replies; 45+ messages in thread
From: Drew Adams @ 2020-10-26 18:33 UTC (permalink / raw)
To: Adam Porter, emacs-devel
> I tested bookmarks with EWW buffers, expecting them to be
> bookmarkable with Emacs bookmarks, but I found that they aren't...
> It seems a shame for EWW buffers to not work with Emacs's own bookmark system.
FWIW, Bookmark+ provides normal bookmarking with EWW.
https://www.emacswiki.org/emacs/BookmarkPlus
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: eww and bookmarks
2020-10-26 18:15 ` Adam Porter
2020-10-26 18:33 ` Drew Adams
@ 2020-10-26 18:43 ` Lars Ingebrigtsen
2020-10-26 19:05 ` Adam Porter
2020-10-26 19:26 ` Karl Fogel
2 siblings, 1 reply; 45+ messages in thread
From: Lars Ingebrigtsen @ 2020-10-26 18:43 UTC (permalink / raw)
To: Adam Porter; +Cc: emacs-devel
Adam Porter <adam@alphapapa.net> writes:
> Having recently put together a new package that uses bookmarks to
> restore windows and buffers, Burly[0], I tested bookmarks with EWW
> buffers, expecting them to be bookmarkable with Emacs bookmarks, but I
> found that they aren't. Then I found this thread[1] from June about
> Michael's patch, which sounds great, but it doesn't seem to have been
> applied yet.
It sounded like a good idea to me, but looking at the thread, there were
some problems with an async callback? I've just skimmed it. But I'm
for using the normal Emacs bookmark regime in eww, if possible.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: eww and bookmarks
2020-10-26 18:43 ` Lars Ingebrigtsen
@ 2020-10-26 19:05 ` Adam Porter
0 siblings, 0 replies; 45+ messages in thread
From: Adam Porter @ 2020-10-26 19:05 UTC (permalink / raw)
To: emacs-devel
Lars Ingebrigtsen <larsi@gnus.org> writes:
> Adam Porter <adam@alphapapa.net> writes:
>
>> Having recently put together a new package that uses bookmarks to
>> restore windows and buffers, Burly[0], I tested bookmarks with EWW
>> buffers, expecting them to be bookmarkable with Emacs bookmarks, but I
>> found that they aren't. Then I found this thread[1] from June about
>> Michael's patch, which sounds great, but it doesn't seem to have been
>> applied yet.
>
> It sounded like a good idea to me, but looking at the thread, there were
> some problems with an async callback? I've just skimmed it. But I'm
> for using the normal Emacs bookmark regime in eww, if possible.
AIUI the issue is with restoring the position within a restored EWW
buffer. That's certainly desirable, but IMHO it needn't prevent the
patch from being merged; not all major modes even have bookmark support,
and not all bookmark handlers always restore the buffer position
correctly, anyway (e.g. if the file has changed sufficiently since being
bookmarked).
As for fixing that issue, I have two thoughts:
1. In Burly I faced a similar problem. I used a solution similar to
one mentioned in the thread: I added a self-removing function to a hook
that's run after the bookmark is loaded. In the thread, that solution
was not exactly rejected[0]; I think it's probably a good-enough
solution, especially by adding to the hook buffer-locally and wrapping
the hook-removal in an unwind-protect.
2. An alternative mentioned in the thread[1] was to use url-retrieve's
callback to move point after the buffer is rendered. If there are any
problems with that solution, it doesn't seem that any were mentioned.
0: https://lists.gnu.org/archive/html/emacs-devel/2020-06/msg00338.html
1: https://lists.gnu.org/archive/html/emacs-devel/2020-06/msg00363.html
^ permalink raw reply [flat|nested] 45+ messages in thread
* Re: eww and bookmarks
2020-10-26 18:15 ` Adam Porter
2020-10-26 18:33 ` Drew Adams
2020-10-26 18:43 ` Lars Ingebrigtsen
@ 2020-10-26 19:26 ` Karl Fogel
2 siblings, 0 replies; 45+ messages in thread
From: Karl Fogel @ 2020-10-26 19:26 UTC (permalink / raw)
To: Adam Porter; +Cc: emacs-devel
On 26 Oct 2020, Adam Porter wrote:
>Hi,
>
>Having recently put together a new package that uses bookmarks to
>restore windows and buffers, Burly[0], I tested bookmarks with EWW
>buffers, expecting them to be bookmarkable with Emacs bookmarks, but I
>found that they aren't. Then I found this thread[1] from June about
>Michael's patch, which sounds great, but it doesn't seem to have been
>applied yet.
>
>Is there any chance it can make it into Emacs 28? It seems a shame for
>EWW buffers to not work with Emacs's own bookmark system.
>
>Thanks to Michael, et al for your work on this patch.
>
>0: https://github.com/alphapapa/burly.el
>1: https://lists.gnu.org/archive/html/emacs-devel/2020-06/msg00364.html
(+1 to the "Thanks to Michael" there!)
From what I see of the thread, Michael's patch doesn't seem ready to apply yet. The most recent version is in this message...
https://lists.gnu.org/archive/html/emacs-devel/2020-06/msg00304.html
From: Michael Heerdegen
Subject: Re: eww and bookmarks
To: Emacs Devel
Cc: Lars Ingebrigtsen
Date: Sun, 07 Jun 2020 17:09:48 +0200
Message-ID: <87mu5ec3pf.fsf@web.de>
...but in that message he refers to some problems it still has. There is followup discussion in the thread in which he mentions further improvements, but no revised patch as far as I can see.
So currently I'm not sure what patch we would review. Michael, if you have a newest & working version, please post. (Or if you already have posted it, then please let me know. The way I searched was by looking at every subsequent post from you, in that thread, since the above message.)
Best regards,
-Karl
^ permalink raw reply [flat|nested] 45+ messages in thread
end of thread, other threads:[~2020-10-26 19:26 UTC | newest]
Thread overview: 45+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-27 7:18 eww and bookmarks Boruch Baum
2020-05-27 14:40 ` Drew Adams
-- strict thread matches above, loose matches on Subject: below --
2020-05-20 11:48 Matthias Meulien
2020-05-20 16:29 ` Drew Adams
2020-05-20 16:35 ` Noam Postavsky
2020-05-20 16:40 ` Drew Adams
2020-05-20 20:13 ` Matthias Meulien
2020-05-23 22:56 ` Michael Heerdegen
2020-05-24 8:44 ` Matthias Meulien
2020-05-24 14:14 ` Alfred M. Szmidt
2020-05-24 19:06 ` Karl Fogel
2020-05-25 4:35 ` Michael Heerdegen
2020-05-25 5:26 ` Alfred M. Szmidt
2020-05-26 2:17 ` Michael Heerdegen
2020-06-10 15:39 ` Lars Ingebrigtsen
2020-06-10 20:03 ` Drew Adams
2020-05-25 12:51 ` Stefan Monnier
2020-05-25 13:52 ` Marcin Borkowski
2020-05-25 15:03 ` Alfred M. Szmidt
2020-05-25 15:24 ` Stefan Monnier
2020-05-25 23:40 ` Michael Heerdegen
[not found] ` <e23432dd-212b-4bf0-8e8c-185988c653f0@default>
2020-05-26 1:04 ` Michael Heerdegen
2020-05-27 5:10 ` Drew Adams
2020-05-25 4:28 ` Michael Heerdegen
2020-05-25 14:35 ` T.V Raman
2020-05-20 22:14 ` Michael Heerdegen
2020-06-07 15:09 ` Michael Heerdegen
2020-06-07 15:30 ` Basil L. Contovounesios
2020-06-07 16:13 ` Michael Heerdegen
2020-06-07 16:36 ` Tomas Hlavaty
2020-06-07 18:23 ` Basil L. Contovounesios
2020-06-08 14:49 ` Michael Heerdegen
2020-06-08 16:54 ` Basil L. Contovounesios
2020-06-10 12:01 ` Michael Heerdegen
2020-06-07 16:36 ` Lars Ingebrigtsen
2020-06-07 18:23 ` Basil L. Contovounesios
2020-06-08 14:42 ` Michael Heerdegen
2020-06-08 16:58 ` Basil L. Contovounesios
2020-06-10 12:06 ` Michael Heerdegen
2020-10-26 18:15 ` Adam Porter
2020-10-26 18:33 ` Drew Adams
2020-10-26 18:43 ` Lars Ingebrigtsen
2020-10-26 19:05 ` Adam Porter
2020-10-26 19:26 ` Karl Fogel
2020-06-07 16:31 ` Clément Pit-Claudel
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.