From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Nathan Trapuzzano Newsgroups: gmane.emacs.bugs Subject: bug#16415: 24.3.50; Handle contiguous links correctly in shr [PATCH] Date: Fri, 10 Jan 2014 22:22:41 -0500 Message-ID: <87iotrfbi6.fsf@nbtrap.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1389410656 9338 80.91.229.3 (11 Jan 2014 03:24:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 11 Jan 2014 03:24:16 +0000 (UTC) To: 16415@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Jan 11 04:24:20 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1W1pBK-0007rg-VD for geb-bug-gnu-emacs@m.gmane.org; Sat, 11 Jan 2014 04:24:19 +0100 Original-Received: from localhost ([::1]:59966 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W1pBK-0005BB-Ed for geb-bug-gnu-emacs@m.gmane.org; Fri, 10 Jan 2014 22:24:18 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41933) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W1pBB-0005B0-0a for bug-gnu-emacs@gnu.org; Fri, 10 Jan 2014 22:24:15 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W1pB4-0002E6-DC for bug-gnu-emacs@gnu.org; Fri, 10 Jan 2014 22:24:08 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:60097) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W1pB4-0002E2-9e for bug-gnu-emacs@gnu.org; Fri, 10 Jan 2014 22:24:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1W1pB3-0000EZ-UK for bug-gnu-emacs@gnu.org; Fri, 10 Jan 2014 22:24:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Nathan Trapuzzano Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 11 Jan 2014 03:24:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 16415 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.1389410590811 (code B ref -1); Sat, 11 Jan 2014 03:24:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 11 Jan 2014 03:23:10 +0000 Original-Received: from localhost ([127.0.0.1]:45883 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W1pAE-0000D1-1W for submit@debbugs.gnu.org; Fri, 10 Jan 2014 22:23:10 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:40088) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W1pAB-0000Cp-A5 for submit@debbugs.gnu.org; Fri, 10 Jan 2014 22:23:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W1pA4-00028c-KT for submit@debbugs.gnu.org; Fri, 10 Jan 2014 22:23:07 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:45184) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W1pA4-00028Y-Ha for submit@debbugs.gnu.org; Fri, 10 Jan 2014 22:23:00 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41801) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W1p9y-00057a-GJ for bug-gnu-emacs@gnu.org; Fri, 10 Jan 2014 22:23:00 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W1p9s-00028E-Ee for bug-gnu-emacs@gnu.org; Fri, 10 Jan 2014 22:22:54 -0500 Original-Received: from oproxy1-pub.mail.unifiedlayer.com ([66.147.249.253]:33355) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1W1p9s-00028A-6o for bug-gnu-emacs@gnu.org; Fri, 10 Jan 2014 22:22:48 -0500 Original-Received: (qmail 26519 invoked by uid 0); 11 Jan 2014 03:22:44 -0000 Original-Received: from unknown (HELO host393.hostmonster.com) (66.147.240.193) by oproxy20.mail.unifiedlayer.com with SMTP; 11 Jan 2014 03:22:44 -0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=nbtrap.com; s=default; h=Content-Type:MIME-Version:Message-ID:Date:Subject:To:From; bh=HvfytioRHD5swV6rfsvZ3KateXFuAXvRwNdA/m0Ok5A=; b=QzF0pBgMmSBFtliIjQ0BqH4oiANHbpUbRCeS6d6lv8zIEnOIA+ejHMdhqgAW/twORaJOXlsgImhsqusPsMVr1JADZ/CYz5Od1u1FF2CmyonozYKwGQChKizW4rbzW00Y; Original-Received: from [50.90.253.209] (port=60638 helo=Nathan-GNU) by host393.hostmonster.com with esmtpsa (UNKNOWN:CAMELLIA128-SHA:128) (Exim 4.80) (envelope-from ) id 1W1p9o-0001kh-4d for bug-gnu-emacs@gnu.org; Fri, 10 Jan 2014 20:22:44 -0700 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-Identified-User: {1585:host393.hostmonster.com:nbtrapco:nbtrap.com} {sentby:smtp auth 50.90.253.209 authed with nbtrap@nbtrap.com} X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:83265 Archived-At: --=-=-= Content-Type: text/plain `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... --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=shr.patch # 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 + + * lisp/net/shr.el (shr-next-link, shr-previous-link): Don't skip + over contiguous links. + 2014-01-10 Glenn Morris * 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 rqx2kdHhIf4pwU1HjNyUVY8d7gqWbW0dqMEXPXJPGSPhG9oLz4j4Sfp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