emacs-devel
[Top][All Lists]
Advanced

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

Re: eww and bookmarks


From: Basil L. Contovounesios
Subject: Re: eww and bookmarks
Date: Sun, 07 Jun 2020 16:30:23 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

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



reply via email to

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