bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#19560: shr.el: skips over adjacent links


From: Ivan Shmakov
Subject: bug#19560: shr.el: skips over adjacent links
Date: Sat, 10 Jan 2015 20:25:58 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux)

Package:  emacs
Severity: minor

        As of ec7605b4b137 (2015-01-10 16:54:24 +0000), the
        shr-next-link and shr-previous-link commands skip over adjacent
        links, as per the example MIMEd.

        With this same example, shr-previous-link also fails to deal
        with the link at the very beginning of the buffer.

        Please consider the patch MIMEd.

-- 
FSF associate member #7257  http://boycottsystemd.org/  … 3013 B6A0 230E 334A

AB

--- a/lisp/net/shr.el   2015-01-10 16:54:24 +0000
+++ b/lisp/net/shr.el   2015-01-10 20:20:24 +0000
@@ -265,8 +269,11 @@
 (defun shr-next-link ()
   "Skip to the next link."
   (interactive)
-  (let ((skip (text-property-any (point) (point-max) 'help-echo nil)))
+  (let* ((cur (get-text-property (point) 'help-echo))
+        (skip (text-property-not-all (point) (point-max)
+                                     'help-echo cur)))
     (if (or (eobp)
+           (not skip)
            (not (setq skip (text-property-not-all skip (point-max)
                                                   'help-echo nil))))
        (message "No next link")
@@ -276,25 +283,28 @@
 (defun shr-previous-link ()
   "Skip to the previous link."
   (interactive)
-  (let ((start (point))
+  (let ((cur (get-text-property (point) 'help-echo))
+       (start (point))
        (found nil))
     ;; Skip past the current link.
     (while (and (not (bobp))
-               (get-text-property (point) 'help-echo))
+               (when-let ((h-e (get-text-property (point) 'help-echo)))
+                 (eq cur h-e)))
       (forward-char -1))
     ;; Find the previous link.
-    (while (and (not (bobp))
-               (not (setq found (get-text-property (point) 'help-echo))))
+    (while (and (not (setq found (get-text-property (point) 'help-echo)))
+               (not (bobp)))
       (forward-char -1))
-    (if (not found)
+    (if (or (not found) (eq start (point)))
        (progn
          (message "No previous link")
          (goto-char start))
       ;; Put point at the start of the link.
-      (while (and (not (bobp))
-                 (get-text-property (point) 'help-echo))
-       (forward-char -1))
-      (forward-char 1)
+      (when (not (bobp))
+       (while (and (not (bobp))
+                   (eq found (get-text-property (point) 'help-echo)))
+         (forward-char -1))
+       (forward-char 1))
       (message "%s" (get-text-property (point) 'help-echo)))))
 
 (defun shr-show-alt-text ()

reply via email to

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