Hi everyone,
I use Doom Emacs with Evil and the +everywhere
flag. I read Wiki pages with eww and I would like jump to urls with the same visual approach as evilem-motion-*
, i.e., where the candidates are prefixed by letters.
I followed the definition of the evilem-motion-* motions to create a new one based on shr-next-link
:
(after! evil-easymotion (evilem-make-motion evilem-motion-shr-next-link #'shr-next-link :scope 'line)) (map! :after eww :map eww-mode-map (:prefix "g" :n "<tab>" #'evilem-motion-shr-next-link))
Which works as intended, but only highlight links in the current line while I wanted to highlight all the links in the window. This happend because I am using :scope 'line
.
window
scopeI managed to understand what was the scope handled by evil-easymotion
, i.e., everything recognised by the thing-at-point
function. But I didn't find any predefined thing
matching the window. Thus, I have created a new one:
(defun window-bounds-of-window-at-point () "Return the start and end points of a window." (save-excursion (message "%d-%d" (window-start) (window-end)) (cons (window-start) (window-end)))) (put 'window 'bounds-of-thing-at-point 'window-bounds-of-window-at-point)
And then I changed the scope of evilem-motion-shr-next-link
from 'line
to 'window
.
Everything work well, except that (window-end)
returns a different value when I run evilem-motion-shr-next-link
via the eval prompt, i.e., pp-eval-expression
, or via my keybinding.
For instance, on (eww "https://www.emacswiki.org/emacs/IntegerAtPoint")
with the cursor at the beginning, the debuging message in window-bounds-of-window-at-point
returns:
1-870
via the keybinding
1-1531
via the eval prompt
Does someone know why there is this difference between the two approaches to call the function?
Is there a simpler and more efficient solution to what I am doing?
Thank you in advance!
Edit: Fix the formatting