diff options
| -rw-r--r-- | lisp/net/eww.el | 3 | ||||
| -rw-r--r-- | lisp/net/shr.el | 33 |
2 files changed, 34 insertions, 2 deletions
diff --git a/lisp/net/eww.el b/lisp/net/eww.el index 10d9c47e8de..08a40cef182 100644 --- a/lisp/net/eww.el +++ b/lisp/net/eww.el | |||
| @@ -1486,7 +1486,8 @@ If EXTERNAL is double prefix, browse in new buffer." | |||
| 1486 | ((string-match "^mailto:" url) | 1486 | ((string-match "^mailto:" url) |
| 1487 | (browse-url-mail url)) | 1487 | (browse-url-mail url)) |
| 1488 | ((and (consp external) (<= (car external) 4)) | 1488 | ((and (consp external) (<= (car external) 4)) |
| 1489 | (funcall shr-external-browser url)) | 1489 | (funcall shr-external-browser url) |
| 1490 | (shr--blink-link)) | ||
| 1490 | ;; This is a #target url in the same page as the current one. | 1491 | ;; This is a #target url in the same page as the current one. |
| 1491 | ((and (url-target (url-generic-parse-url url)) | 1492 | ((and (url-target (url-generic-parse-url url)) |
| 1492 | (eww-same-page-p url (plist-get eww-data :url))) | 1493 | (eww-same-page-p url (plist-get eww-data :url))) |
diff --git a/lisp/net/shr.el b/lisp/net/shr.el index e743f9d3849..2dc1036e412 100644 --- a/lisp/net/shr.el +++ b/lisp/net/shr.el | |||
| @@ -142,6 +142,11 @@ cid: URL as the argument.") | |||
| 142 | "Font for link elements." | 142 | "Font for link elements." |
| 143 | :group 'shr) | 143 | :group 'shr) |
| 144 | 144 | ||
| 145 | (defface shr-selected-link | ||
| 146 | '((t (:inherit shr-link :background "red"))) | ||
| 147 | "Font for link elements." | ||
| 148 | :group 'shr) | ||
| 149 | |||
| 145 | (defvar shr-inhibit-images nil | 150 | (defvar shr-inhibit-images nil |
| 146 | "If non-nil, inhibit loading images.") | 151 | "If non-nil, inhibit loading images.") |
| 147 | 152 | ||
| @@ -344,6 +349,30 @@ If the URL is already at the front of the kill ring act like | |||
| 344 | (shr-probe-and-copy-url url) | 349 | (shr-probe-and-copy-url url) |
| 345 | (shr-copy-url url))) | 350 | (shr-copy-url url))) |
| 346 | 351 | ||
| 352 | (defun shr--current-link-region () | ||
| 353 | (let ((current (get-text-property (point) 'shr-url)) | ||
| 354 | start) | ||
| 355 | (save-excursion | ||
| 356 | ;; Go to the beginning. | ||
| 357 | (while (and (not (bobp)) | ||
| 358 | (equal (get-text-property (point) 'shr-url) current)) | ||
| 359 | (forward-char -1)) | ||
| 360 | (unless (equal (get-text-property (point) 'shr-url) current) | ||
| 361 | (forward-char 1)) | ||
| 362 | (setq start (point)) | ||
| 363 | ;; Go to the end. | ||
| 364 | (while (and (not (eobp)) | ||
| 365 | (equal (get-text-property (point) 'shr-url) current)) | ||
| 366 | (forward-char 1)) | ||
| 367 | (list start (point))))) | ||
| 368 | |||
| 369 | (defun shr--blink-link () | ||
| 370 | (let* ((region (shr--current-link-region)) | ||
| 371 | (overlay (make-overlay (car region) (cadr region)))) | ||
| 372 | (overlay-put overlay 'face 'shr-selected-link) | ||
| 373 | (run-at-time 1 nil (lambda () | ||
| 374 | (delete-overlay overlay))))) | ||
| 375 | |||
| 347 | (defun shr-next-link () | 376 | (defun shr-next-link () |
| 348 | "Skip to the next link." | 377 | "Skip to the next link." |
| 349 | (interactive) | 378 | (interactive) |
| @@ -950,7 +979,9 @@ the mouse click event." | |||
| 950 | (browse-url-mail url)) | 979 | (browse-url-mail url)) |
| 951 | (t | 980 | (t |
| 952 | (if external | 981 | (if external |
| 953 | (funcall shr-external-browser url) | 982 | (progn |
| 983 | (funcall shr-external-browser url) | ||
| 984 | (shr--blink-link)) | ||
| 954 | (browse-url url)))))) | 985 | (browse-url url)))))) |
| 955 | 986 | ||
| 956 | (defun shr-save-contents (directory) | 987 | (defun shr-save-contents (directory) |