From fde23c6e7426b96de0989e25d5a565652c995ca4 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Mon, 26 Sep 2022 15:16:16 +0200 Subject: [PATCH] Fix (thing-at-point 'url) in eww forms * lisp/net/eww.el (eww-tag-input): Don't claim to have an URL here (bug#58091). * lisp/net/shr.el (shr-next-link, shr-previous-link): Search for shr-tab-stop instead of shr-url so that we can be more general. (shr-urlify): Mark all links as tabbable-to. --- lisp/net/eww.el | 2 +- lisp/net/shr.el | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lisp/net/eww.el b/lisp/net/eww.el index 2a511333de1..61b1b750683 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el @@ -1629,7 +1629,7 @@ See URL `https://developer.mozilla.org/en-US/docs/Web/HTML/Element/Input'.") (unless (= start (point)) (put-text-property start (1+ start) 'help-echo "Input field") ;; Mark this as an element we can TAB to. - (put-text-property start (1+ start) 'shr-url dom)))) + (put-text-property start (1+ start) 'shr-tab-stop t)))) (defun eww-tag-select (dom) (shr-ensure-paragraph) diff --git a/lisp/net/shr.el b/lisp/net/shr.el index d56420eb02e..75992bc62a4 100644 --- a/lisp/net/shr.el +++ b/lisp/net/shr.el @@ -503,7 +503,7 @@ Value is a pair of positions (START . END) if there is a non-nil (defun shr-next-link () "Skip to the next link." (interactive) - (let ((match (text-property-search-forward 'shr-url nil nil t))) + (let ((match (text-property-search-forward 'shr-tab-stop nil nil t))) (if (not match) (message "No next link") (goto-char (prop-match-beginning match)) @@ -512,7 +512,7 @@ Value is a pair of positions (START . END) if there is a non-nil (defun shr-previous-link () "Skip to the previous link." (interactive) - (if (not (text-property-search-backward 'shr-url nil nil t)) + (if (not (text-property-search-backward 'shr-tab-stop nil nil t)) (message "No previous link") (message "%s" (get-text-property (point) 'help-echo)))) @@ -1215,6 +1215,7 @@ START, and END. Note that START and END should be markers." (add-text-properties start (point) (list 'shr-url url + 'shr-tab-stop t 'button t 'category 'shr ; For button.el button buffers. 'help-echo (let ((parsed (url-generic-parse-url -- 2.39.2