Subject: bug#41385: [PATCH] Show eww bookmarks buffer only if it's not empty

From: Lars Ingebrigtsen <[email-masked]>
Date: Tue, 19 May 2020 14:34:45 +0200

Stefan Kangas <[email-masked]> writes:

> Please see the attached patch which fixes a minor annoyance with
> eww-list-bookmarks.

[...]

> -  (pop-to-buffer "*eww bookmarks*")
> -  (eww-bookmark-prepare))
> +  (let ((buf (get-buffer-create "*eww bookmarks*")) no-error)
> +    (unwind-protect
> +        (progn
> +          (pop-to-buffer buf)
> +          (eww-bookmark-prepare)
> +          (setq no-error t))
> +      (when (not no-error) (kill-buffer buf)))))

I don't think this is an ideal way to fix this command -- using error
handling to do control flow is usually the wrong thing to do, and it
makes debugging difficult.  What if there's a real bug in
eww-bookmark-prepare?

Instead eww-list-bookmarks should just do the

  (eww-read-bookmarks)
  (unless eww-bookmarks
    (user-error "No bookmarks are defined"))

bit, I think.  It might mean rearranging some stuff in eww-next-bookmark
etc, though.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no