diff options
author | Lars Ingebrigtsen <larsi@gnus.org> | 2015-12-28 21:55:18 +0100 |
---|---|---|
committer | Lars Ingebrigtsen <larsi@gnus.org> | 2015-12-28 21:58:46 +0100 |
commit | 9982c01d1a190390254b8c5bd866aea62848664f (patch) | |
tree | 7c97a2e91076ca60a9a30175c979188274d6575e | |
parent | 2ed9de442cf0ff46cf3cf8484b587f7d52a50e3f (diff) | |
download | emacs-9982c01d1a190390254b8c5bd866aea62848664f.tar.gz |
shr link traversal fixup
* shr.el (shr-next-link): Don't bug out on adjacent links.
Backport:
(cherry picked from commit 1efc5f8b09273c359683ce13be95fb5df7a84311)
-rw-r--r-- | lisp/net/shr.el | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/lisp/net/shr.el b/lisp/net/shr.el index c28e0b8899c..d5c56362f60 100644 --- a/lisp/net/shr.el +++ b/lisp/net/shr.el @@ -303,13 +303,25 @@ redirects somewhere else." (defun shr-next-link () "Skip to the next link." (interactive) - (let ((skip (text-property-any (point) (point-max) 'help-echo nil))) - (if (or (eobp) - (not (setq skip (text-property-not-all skip (point-max) - 'help-echo nil)))) - (message "No next link") + (let ((current (get-text-property (point) 'shr-url)) + (start (point)) + skip) + (while (and (not (eobp)) + (equal (get-text-property (point) 'shr-url) current)) + (forward-char 1)) + (cond + ((and (not (eobp)) + (get-text-property (point) 'shr-url)) + ;; The next link is adjacent. + (message "%s" (get-text-property (point) 'help-echo))) + ((or (eobp) + (not (setq skip (text-property-not-all (point) (point-max) + 'shr-url nil)))) + (goto-char start) + (message "No next link")) + (t (goto-char skip) - (message "%s" (get-text-property (point) 'help-echo))))) + (message "%s" (get-text-property (point) 'help-echo)))))) (defun shr-previous-link () "Skip to the previous link." |