unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#16415: 24.3.50; Handle contiguous links correctly in shr [PATCH]
@ 2014-01-11  3:22 Nathan Trapuzzano
  2014-01-11 12:50 ` Nathan Trapuzzano
  2014-01-31  2:09 ` Lars Ingebrigtsen
  0 siblings, 2 replies; 14+ messages in thread
From: Nathan Trapuzzano @ 2014-01-11  3:22 UTC (permalink / raw)
  To: 16415

[-- Attachment #1: Type: text/plain, Size: 370 bytes --]

`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...


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: shr.patch --]
[-- Type: text/x-diff, Size: 4848 bytes --]

# Bazaar merge directive format 2 (Bazaar 0.90)
# revision_id: nbtrap@nbtrap.com-20140111031617-s3vx9z7lf9ah91gr
# 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: rgm@gnu.org-20140110201931-3ybs57oe9egahtb4
# 
# 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  <nbtrap@nbtrap.com>
+
+	* lisp/net/shr.el (shr-next-link, shr-previous-link): Don't skip
+	over contiguous links.
+
 2014-01-10  Glenn Morris  <rgm@gnu.org>
 
 	* 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
eDUyekymQAND1A9JiJkmYjXlx0FU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JSlZrwI0pgvcs1m+Pr4JcOrrGw2MMSvEVjwrTMjCdfYb+ByMuUGge9GQHS
QOqrADAz5lZ2cy0ynUxEX29pFnZjUiorCCpZkMWcSA9SD+UQOQFF7fCwBrRPHL0YHXsinojn/0CS
Jgqw2pUiQyKfD1Q0c9U5e0WDjtN7HQiUM0ltoWXEkpY7n0uRmRAUYNRBTk4azimXUJUSHfTciaPW
Cr6BmSghzgpxKJgls5AcNGQwzLloNgdi3rEo6oiIY1BDydZIvGLI+4m96eRoaVPYHjExlJV9wj5G
aYs4loWsWodZVUVhhJVCalqhC0uZQpvhPINJtJmRNQw0ohXceQ82NtiGJw7JqtoUnTad4BckZcXR
ORygpQKQxo9yM6les6ppKlOivMeFBAWkpq0I1iHGFwjDWwwMnq9Kp5ohUwgnlThTKXUChwukMOHO
en9IJgxNRU4EfxKrCPSmiOSpVoaEMrVBjknmgVnxGnNhMtm4kna83oYbaBoGEq8d2BU9ZFIj3LkN
bd1ywRYrZrKsHFFl0NjzCvjRNvZipxJlJpQi79gZJgeHjVAgEukHF2RjgGuNg8XNnYaXqhGBgiCy
3Ah1TBY4XeDw2R68eKs7S4CfE4g96ZYCPwAcV5EC4LwzR5AQEt5mwMWBvM1HwAw3kNKYltP+LuSK
cKEh67nwSg==

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2015-12-28 21:21 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-11  3:22 bug#16415: 24.3.50; Handle contiguous links correctly in shr [PATCH] Nathan Trapuzzano
2014-01-11 12:50 ` Nathan Trapuzzano
2014-01-20 13:20   ` Nathan Trapuzzano
2014-01-31  2:09 ` Lars Ingebrigtsen
2014-01-31 16:06   ` nbtrap
2014-11-13 18:42     ` Lars Magne Ingebrigtsen
2015-12-25 17:37       ` Lars Ingebrigtsen
2015-12-26 11:10         ` bug#16415: 24.3.50; Handle contiguous links correctly in shr Ivan Shmakov
2015-12-26 12:12           ` Eli Zaretskii
2015-12-26 12:40             ` Ivan Shmakov
2015-12-26 13:02               ` Eli Zaretskii
2015-12-26 13:07                 ` Ivan Shmakov
2015-12-26 13:09                 ` Lars Ingebrigtsen
2015-12-28 21:21           ` Lars Ingebrigtsen

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).