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

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

bug#16415: 24.3.50; Handle contiguous links correctly in shr [PATCH]


From: Nathan Trapuzzano
Subject: bug#16415: 24.3.50; Handle contiguous links correctly in shr [PATCH]
Date: Fri, 10 Jan 2014 22:22:41 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

`shr-next-link' and `shr-previous-link' currently skip over links that
are contiguous with the current link.  The attached patch addressed this
problem.

When I say "contiguous", I'm talking in terms of Emacs "positions"--not
in terms of HTML.

P.S. I'm still waiting for my boss to return the copyright disclaimer
form to me.  Hopefully this change is minor enough...

# Bazaar merge directive format 2 (Bazaar 0.90)
# revision_id: address@hidden
# target_branch: file:///home/nathan/opt/etc/bzr-repos/emacs/trunk/
# testament_sha1: 2b99f693499c398c7a9599c8d6b5eb6c7ccb7a47
# timestamp: 2014-01-10 22:16:56 -0500
# base_revision_id: address@hidden
# 
# Begin patch
=== modified file 'lisp/ChangeLog'
--- lisp/ChangeLog      2014-01-10 20:19:31 +0000
+++ lisp/ChangeLog      2014-01-11 03:16:17 +0000
@@ -1,3 +1,8 @@
+2014-01-11  Nathan Trapuzzano  <address@hidden>
+
+       * lisp/net/shr.el (shr-next-link, shr-previous-link): Don't skip
+       over contiguous links.
+
 2014-01-10  Glenn Morris  <address@hidden>
 
        * emacs-lisp/authors.el (authors-fixed-entries):

=== modified file 'lisp/net/shr.el'
--- lisp/net/shr.el     2014-01-05 10:23:35 +0000
+++ lisp/net/shr.el     2014-01-11 03:16:17 +0000
@@ -242,8 +242,10 @@
 (defun shr-next-link ()
   "Skip to the next link."
   (interactive)
-  (let ((skip (text-property-any (point) (point-max) 'help-echo nil)))
-    (if (not (setq skip (text-property-not-all skip (point-max)
+  (let ((skip (and (get-text-property (point) 'help-echo)
+                   (or (next-single-property-change (point) 'help-echo)
+                       (point-max)))))
+    (if (not (setq skip (text-property-not-all (or skip (point)) (point-max)
                                               'help-echo nil)))
        (message "No next link")
       (goto-char skip)
@@ -254,11 +256,17 @@
   (interactive)
   (let ((start (point))
        (found nil))
-    ;; Skip past the current link.
-    (while (and (not (bobp))
-               (get-text-property (point) 'help-echo))
+    ;; Skip past the current link.  When the current link extends past
+    ;; the end of the narrowed region and point is at (point-max),
+    ;; don't do anything, so that point will get moved to the
+    ;; beginning of this link.
+    (when (and (get-text-property (point) 'help-echo)
+               (not (and (eobp) (buffer-narrowed-p))))
+      (goto-char (or (previous-single-property-change
+                      (min (1+ (point)) (point-max)) 'help-echo)
+                     (point-min))))
+    (unless (bobp)
       (forward-char -1))
-    ;; Find the previous link.
     (while (and (not (bobp))
                (not (setq found (get-text-property (point) 'help-echo))))
       (forward-char -1))
@@ -267,10 +275,9 @@
          (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)
+      (goto-char (or (previous-single-property-change
+                      (min (1+ (point)) (point-max)) 'help-echo)
+                     (point-min)))
       (message "%s" (get-text-property (point) 'help-echo)))))
 
 (defun shr-show-alt-text ()

# Begin bundle
IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWfXc+CUAAuD/gHA4uABQ////
XgUMgL////BQBg1VeaDorNupU1Xc3XRwkkIRhAmNNAwiT9SaabUABjSA9QJKmUzU9NMSmQ2oGgaa
aNAAAAACRIJqp41T9E1PRP1E0ybU000eRGTQ00ABoc0ZMTABMRgRpgQYjBMmARgkkCaANEFNpP0q
eDUyekymQAND1A9JiJkmYjXlx0FUHqNeXnE2y591FE275bfzZHiCIa3LdjTS0volR52i+VrYU8Fq
S13RLUkhQgNM8mZGf7je7+Z/VSS5fsx59DRLeSqiQaQi4nhpZMyGyc1TghkhB9TQbuYYs4pxw2UT
rqx2kdHhIf4pwU1HjNyUVY8d7gqWbW0dqMEXPXJPGSPhG9oLz4j4Sfp0IwyGWGWwwv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