[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: EWW func add url under point as bookmark
From: |
Alex |
Subject: |
Re: EWW func add url under point as bookmark |
Date: |
Mon, 18 Apr 2022 22:29:21 +0200 |
Emanuel Berg via Users list for the GNU Emacs text editor
<help-gnu-emacs@gnu.org> writes:
> OK, good, but then better yet you could remove the interface/wrapper
> function and instead make eww-bookmark-add interactive (as well as
> non-interactive from Lisp), and for interactive use it'll read the URL
> from point.
new version:
#+begin_src elisp
;; Copyright 2022 Alex
;; under GPLv3-or-later License
(defun eww-bookmark-add (url title)
"Bookmark `URL' as `TITLE'."
(interactive (list (thing-at-point 'url)
(read-string "Title: ")))
(unless (stringp url)
(user-error "invalid url string required"))
(unless (stringp title)
(user-error "invalid title string required"))
(eww-read-bookmarks)
(dolist (bookmark eww-bookmarks)
(when (equal url (plist-get bookmark :url))
(user-error "Already bookmarked")))
(push (list :url url
:title title
:time (current-time-string))
eww-bookmarks)
(eww-write-bookmarks)
(message "Bookmarked %s (%s)" url title))
#+end_src
> Ironically then you have to get the title the way you initially did!
right lol
--
Alex
Emacs Lover.
FSF Member.
Free/Libre Software supporter.
stallmansupport.org - Disinformation succeeds because so many people
care deeply about injustice but do not take the time to check the facts.
- EWW func add url under point as bookmark, Alex, 2022/04/14
- RE: [External] : EWW func add url under point as bookmark, Drew Adams, 2022/04/14
- Re: EWW func add url under point as bookmark, Alex, 2022/04/15
- Re: EWW func add url under point as bookmark, Emanuel Berg, 2022/04/15
- Re: EWW func add url under point as bookmark, Alex, 2022/04/16
- Re: EWW func add url under point as bookmark, Emanuel Berg, 2022/04/17
- Re: EWW func add url under point as bookmark,
Alex <=
- Re: EWW func add url under point as bookmark, Emanuel Berg, 2022/04/18
- Re: EWW func add url under point as bookmark, Alex, 2022/04/18
- Re: EWW func add url under point as bookmark, Emanuel Berg, 2022/04/20
- Re: EWW func add url under point as bookmark, Emanuel Berg, 2022/04/17
Re: EWW func add url under point as bookmark, Emanuel Berg, 2022/04/15