diff options
| author | Lars Ingebrigtsen | 2015-12-28 21:55:18 +0100 |
|---|---|---|
| committer | Lars Ingebrigtsen | 2015-12-28 21:55:18 +0100 |
| commit | 1efc5f8b09273c359683ce13be95fb5df7a84311 (patch) | |
| tree | de6713eea616f53b3a6afdc2769cf2fbeee99b7d | |
| parent | d686802510c3902f6be4a4c4e82b1134d9dfb8a0 (diff) | |
| download | emacs-1efc5f8b09273c359683ce13be95fb5df7a84311.tar.gz emacs-1efc5f8b09273c359683ce13be95fb5df7a84311.zip | |
shr link traversal fixup
* shr.el (shr-next-link): Don't bug out on adjacent links.
| -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 469ef4ec52f..0b80e81abbc 100644 --- a/lisp/net/shr.el +++ b/lisp/net/shr.el | |||
| @@ -316,13 +316,25 @@ redirects somewhere else." | |||
| 316 | (defun shr-next-link () | 316 | (defun shr-next-link () |
| 317 | "Skip to the next link." | 317 | "Skip to the next link." |
| 318 | (interactive) | 318 | (interactive) |
| 319 | (let ((skip (text-property-any (point) (point-max) 'help-echo nil))) | 319 | (let ((current (get-text-property (point) 'shr-url)) |
| 320 | (if (or (eobp) | 320 | (start (point)) |
| 321 | (not (setq skip (text-property-not-all skip (point-max) | 321 | skip) |
| 322 | 'help-echo nil)))) | 322 | (while (and (not (eobp)) |
| 323 | (message "No next link") | 323 | (equal (get-text-property (point) 'shr-url) current)) |
| 324 | (forward-char 1)) | ||
| 325 | (cond | ||
| 326 | ((and (not (eobp)) | ||
| 327 | (get-text-property (point) 'shr-url)) | ||
| 328 | ;; The next link is adjacent. | ||
| 329 | (message "%s" (get-text-property (point) 'help-echo))) | ||
| 330 | ((or (eobp) | ||
| 331 | (not (setq skip (text-property-not-all (point) (point-max) | ||
| 332 | 'shr-url nil)))) | ||
| 333 | (goto-char start) | ||
| 334 | (message "No next link")) | ||
| 335 | (t | ||
| 324 | (goto-char skip) | 336 | (goto-char skip) |
| 325 | (message "%s" (get-text-property (point) 'help-echo))))) | 337 | (message "%s" (get-text-property (point) 'help-echo)))))) |
| 326 | 338 | ||
| 327 | (defun shr-previous-link () | 339 | (defun shr-previous-link () |
| 328 | "Skip to the previous link." | 340 | "Skip to the previous link." |