help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: EWW func add url under point as bookmark


From: Emanuel Berg
Subject: Re: EWW func add url under point as bookmark
Date: Tue, 19 Apr 2022 02:24:07 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Alex wrote:

> PD: nice website Emanuel

PD? thanks :)

> Ok, now, Im browsing in EWW, and Im in a page with many
> interesting urls, I want bookmarks all urls after point.

Uhm, when you say URL, you mean hyperlink?

> But moving the cursor, M-x eww-bookmark-add RET <title> RET
> with all urls is painfull.
>
> I need a func!
>
> #+begin_src elisp
>
> ;; Copyright 2022 Alex
> ;; under GPLv3-or-later License
>
> (defun eww-bookmark-buffer-urls ()
>   "Bookmark urls in current buffer"

That's (to the) right, period.

>   (interactive)
>   (shr-next-link)
>   (let ((url-str (thing-at-point 'url)))

I still think it better to check for nil here.

>   (if (save-excursion (shr-next-link))
>       (eww-bookmark-buffer-urls)))

Hm, that's look sa bit weird ... instead drop recursion and
when you find what you are looking for, just get it and
go on. (Should be `when' BTW as it stands.)

> Works, but sadly stop when find an url already bookmarked :/

Sadly, you checked this in the other code and it is signalled
as an error if it happens, sounds like overkill indeed..

-- 
underground experts united
https://dataswamp.org/~incal




reply via email to

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