Re: Bookmark+: use bmkp-after-set-hook to archive to the Wayback Machine? (was RE: Bookmark+ question)

SW - Giovanni Biscuolo <[email protected]> Sun, 26 Jul 2026 11:07:47 +0200
Newsgroups gmane.emacs.devel
Organization SoftwareWorkers
Message-ID <[email protected]>
Hello Drew and Michael,

(I'm re-adding guix-devel since Drew original message was not sent there)

(Note: I'm also not subscribed to emacs-devel)

My apologies for this very late feedback!

On 2026-07-11, Drew Adams wrote:

> ping.
>
> From: Drew Adams <[email protected]> 
> Sent: Tuesday, June 16, 2026 8:21 AM
> ping.
>
> From: Drew Adams <[email protected]> Sent: Wednesday, May 20, 2026 2:29
> PM
> Giovanni,
> Were you able to solve your Bookmark+ problem?

Sorry I had no time to try to solve my problem following your sugesions, I should be able to test in the following two weeks (I hope).

I'll send you (and emacs-devel) a feedback - possibly with working code - as soon I have updates.

Thank you very much for your feedback and again my apologies to you all for not having replied earlier!

Happy hacking, Gio'

> -----Original Message-----
> From: Drew Adams <[email protected]> Sent: Friday, May 8, 2026 9:12 PM
> To: 'Michael Heerdegen' <[email protected]>;
> '[email protected]' <[email protected]>
>
> Michael,
>
>> Oops - I'm sorry, it was emacs-devel.  Thursday (yesterday):
>>   SW - Giovanni Biscuolo: "Bookmark+: use bmkp-after-set-hook to archive
>>   to the Wayback Machine?"
>> Do you find it now?
>
> Yes, thanks.  Adding Giovanni.
>
> Giovanni,
>
> I'm not sure I can help much, as I've been away from Emacs for a while now.
>
>
> I think the answer to your first question, how to get the URI (location)
> field of a bookmark is to just use (bookmark-location BOOKMARK) or
> (bookmark-prop-get BOOKMARK 'location).
>
> Looking at some of the bookmark+-1.el code now, I see that I've used this to
> check whether the location field is a URL (where bmk-location is the value
> returned by bookmark-location), and to return that URL if so:
>
> (and bmk-location
>      (require 'ffap nil t)
>      (ffap-url-p bmk-location))
>
> (There may be a better or newer way to do that. My code is meant to work
> also with old Emacs versions.)
>
> This code can test whether a bookmark is a web page (e.g., an EWW bookmark),
> which I guess is your second question: (bmkp-eww-bookmark-p BOOKMARK).  [And
> this works for W3M bookmarks: (bmkp-w3m-bookmark-p BOOKMARK).]
>
> I don't know url-retrieve, or I've forgotten it, but I suppose it grabs the
> HTML code from a web page at a given URL.  (The ";" char in that part of
> your code looks suspect, BTW.  And arg `status' isn't used in your lambda,
> so it could be just `_' or `_status'.)
>
> I don't really know how to "save the URI via API link", so I can't comment
> on that part.  Dunno anything about saving stuff to the wayback machine.
> (BTW, I don't see how/where your code actually saves that code anywhere, if
> url-retrieve just grabs the HTML code.)
>
> Anyway, yes, bmkp-after-set-hook can run your code to save a URL to the
> wayback machine.  That's the right hook.
>
> ___
> BTW, you might also want to associate the wayback location for your bookmark
> with the bookmark itself.  You could do that using an annotation that
> forwards to that wayback location.  See this part of page
> https://www.emacswiki.org/emacs/BookmarkPlus (or file bookmark+-doc.el).
>
>   You create an annotation forward for a bookmark by using one of these
> forms as the annotation text.
>
>      bmkp-annot-file: "FILE"
>      bmkp-annot-url: "URL"
>      bmkp-annot-bmk: "BOOKMARK"
>
>   FILE is an absolute file name. Forwarding to it uses
> 'find-file-other-window'.
>   URL is a URL. Forwarding to it uses 'browse-url'.
>   BOOKMARK is the name of a bookmark in the current bookmark alist.
> Forwarding just jumps to it.
> ___
>
> Dunno how helpful this info is.  As I say, I've lost touch with this stuff,
> at least for the time being. ;-)
>
> Thanks to Michael for pointing me to your post.  I'm not subscribed to
> [email protected] at the moment; I got your post here:
> https://lists.gnu.org/archive/html/emacs-devel/2026-05/msg00193.html.
>
> HTH - Drew Adams

-- 
:~ software|workers
   Giovanni Biscuolo
   https://swws.it/about/giovanni.biscuolo/
signature.asc (application/pgp-signature, 869 B)
-----BEGIN PGP SIGNATURE-----

iQJOBAEBCgA4FiEERcxjuFJYydVfNLI5030Op87MORIFAmplzmMaHGdpb3Zhbm5p
LmJpc2N1b2xvQHN3d3MuaXQACgkQ030Op87MORJ9rw/9HYEsnFA87jQ34oE8Uam2
gSvonqALvNkaesg8JqPvKZhjsjhgGox8OqrGNu9/kF5tiHXP5Kmsf8LfotJQIaPR
GvcfB6cNvR0sy3qHinRhXH6KAewJvIuQG2OPoIjcJXqfWXAAGTggvQGlYUJTx49J
ojF0b68C7GHPKX72HZbJkukayQzs7L7lD859FJxDK509U+nTx2OiGydwLLDY747G
LEAmHRTO3gP7sidwFr9WYF3ccwTbUats8JDo76pUoK3pwF1JX086Lpd/LgGP9SbF
mxGEb6cTulJSQLAYC3NHn399GjnpBF7PL4NgE/5t/sn6489cierTeNxAvNUoxQS+
LA2yiJYXTuIcuomGEV36C2lm10zDr0dSJRD3+NeM9rsMztvJd7Zs2lE7Mj90Qggt
rFB7EDDb//LRxFv7qwf3cMBvPZ6gp+7icQCuCpEO0EUwrZciXX11GwfopUUJTCh7
BSlKRRyR46PAT0gnbEbvf2GzPyRfrS4F8FpXIFBtxrcBP42h6NpKmAX2Ue6Nc1y6
6jeWumwEB1UEveFa8Yh+QhE5I95pTLhZHbkyJu4MNMjQH/R95pjoXlxsDTE4XmQb
cB8EkX+1sN/X6XjwH3499xIIaf0dN11aMR5HTXaMpVc6Ey9+RZ44uYIgkx+TxWKP
MmG7syphXQ71eY/Sb+bh7Zc=
=ZTj6
-----END PGP SIGNATURE-----