emacs-diffs
[Top][All Lists]
Advanced

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

master b7068be 2/2: Provide a (thing-at-point 'url) in eww buffers


From: Lars Ingebrigtsen
Subject: master b7068be 2/2: Provide a (thing-at-point 'url) in eww buffers
Date: Sat, 23 Jan 2021 14:40:14 -0500 (EST)

branch: master
commit b7068be5c410c5592856aeebd7aa4d62b1dc68e5
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>

    Provide a (thing-at-point 'url) in eww buffers
    
    * lisp/net/eww.el (eww-mode): Allow (thing-at-point 'url) to work
    in eww buffers.
    (eww--url-at-point): New function.
---
 lisp/net/eww.el | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/lisp/net/eww.el b/lisp/net/eww.el
index d131b2b..e39a4c3 100644
--- a/lisp/net/eww.el
+++ b/lisp/net/eww.el
@@ -1050,9 +1050,16 @@ the like."
   ;; multi-page isearch support
   (setq-local multi-isearch-next-buffer-function #'eww-isearch-next-buffer)
   (setq truncate-lines t)
+  (setq-local thing-at-point-provider-alist
+              (append thing-at-point-provider-alist
+                      '((url . eww--url-at-point))))
   (buffer-disable-undo)
   (setq buffer-read-only t))
 
+(defun eww--url-at-point ()
+  "`thing-at-point' provider function."
+  (get-text-property (point) 'shr-url))
+
 ;;;###autoload
 (defun eww-browse-url (url &optional new-window)
   "Ask the EWW browser to load URL.



reply via email to

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