From: Nathan Trapuzzano <nbtrap@nbtrap.com>
To: 16415@debbugs.gnu.org
Subject: bug#16415: 24.3.50; Handle contiguous links correctly in shr [PATCH]
Date: Sat, 11 Jan 2014 07:50:14 -0500 [thread overview]
Message-ID: <87d2jy4r95.fsf@nbtrap.com> (raw)
In-Reply-To: <87iotrfbi6.fsf@nbtrap.com> (Nathan Trapuzzano's message of "Fri, 10 Jan 2014 22:22:41 -0500")
[-- Attachment #1: Type: text/plain, Size: 388 bytes --]
Nathan Trapuzzano <nbtrap@nbtrap.com> writes:
> `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.
Use this one instead. I clarified one of the comments and referenced a
bug number:
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: shr.patch --]
[-- Type: text/x-diff, Size: 5452 bytes --]
# Bazaar merge directive format 2 (Bazaar 0.90)
# revision_id: nbtrap@nbtrap.com-20140111124832-14454dcnawyzjkny
# target_branch: file:///home/nathan/opt/etc/bzr-repos/emacs/trunk/
# testament_sha1: 6cb8b589f64f1b09f140c539ef23d4305646a92e
# timestamp: 2014-01-11 07:48:46 -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 12:48:32 +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 backwards past the current link. Be carefule when the
+ ;; current link extends past the end of the narrowed region and
+ ;; point is at (point-max). In such a case, we proceed as though
+ ;; point is _not_ looking at a link. Cf. Emacs bug#16413.
+ (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
IyBCYXphYXIgcmV2aXNpb24gYnVuZGxlIHY0CiMKQlpoOTFBWSZTWU9sFaMABHF/gHA4uABY////
XiUMgL////BgCC+quzFADVUyAERVSCgEiRTaQ1GU8mp+k02phTymJoNqjRgIzaox6g5gCMExAMAm
CaMhoYBMEYmEpA1U/CKfpT0jQNNAAAAAAAA5gCMExAMAmCaMhoYBMEYmOYAjBMQDAJgmjIaGATBG
JhJICAAQ0QaGk8KTKfpE8oDRp6hpo/VMRhVomBDKL677TQTkiom/r41O/yb3E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S+tPEfgw4szLVi
EYFwEBYbRCHTZKocLoh4aTkUeiv4qPeEUFHivFD3iZXJL7AuOMFW5RC1FyMwX0BQSCo1Mcx48HA6
0G1CLtBfYFV0UdwMG8Vh6L/4u5IpwoSCe2CtGA==
next prev parent reply other threads:[~2014-01-11 12:50 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87d2jy4r95.fsf@nbtrap.com \
--to=nbtrap@nbtrap.com \
--cc=16415@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).