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: Sat, 11 Jan 2014 07:50:14 -0500 Message-ID: <87d2jy4r95.fsf@nbtrap.com> References: <87iotrfbi6.fsf@nbtrap.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1389444673 25469 80.91.229.3 (11 Jan 2014 12:51:13 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 11 Jan 2014 12:51:13 +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 13:51: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 1W1y23-000529-AM for geb-bug-gnu-emacs@m.gmane.org; Sat, 11 Jan 2014 13:51:19 +0100 Original-Received: from localhost ([::1]:33159 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W1y22-0000tz-Ty for geb-bug-gnu-emacs@m.gmane.org; Sat, 11 Jan 2014 07:51:18 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59431) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W1y1t-0000tq-SF for bug-gnu-emacs@gnu.org; Sat, 11 Jan 2014 07:51:15 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W1y1n-0007Rg-QI for bug-gnu-emacs@gnu.org; Sat, 11 Jan 2014 07:51:09 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:60324) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W1y1n-0007RR-CP for bug-gnu-emacs@gnu.org; Sat, 11 Jan 2014 07:51:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1W1y1m-0000lo-Ix for bug-gnu-emacs@gnu.org; Sat, 11 Jan 2014 07:51: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 12:51:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 16415 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 16415-submit@debbugs.gnu.org id=B16415.13894446242903 (code B ref 16415); Sat, 11 Jan 2014 12:51:02 +0000 Original-Received: (at 16415) by debbugs.gnu.org; 11 Jan 2014 12:50:24 +0000 Original-Received: from localhost ([127.0.0.1]:46110 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W1y18-0000kj-NX for submit@debbugs.gnu.org; Sat, 11 Jan 2014 07:50:23 -0500 Original-Received: from qproxy1-pub.mail.unifiedlayer.com ([173.254.64.10]:39781 helo=qproxy1.mail.unifiedlayer.com) by debbugs.gnu.org with smtp (Exim 4.80) (envelope-from ) id 1W1y16-0000ka-2P for 16415@debbugs.gnu.org; Sat, 11 Jan 2014 07:50:21 -0500 Original-Received: (qmail 1722 invoked by uid 0); 11 Jan 2014 19:50:18 -0000 Original-Received: from unknown (HELO host393.hostmonster.com) (66.147.240.193) by qproxy1.mail.unifiedlayer.com with SMTP; 11 Jan 2014 19:50:18 -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:In-Reply-To:Date:References:Subject:To:From; bh=29LT2Exd7JyGy1agM6oagesyzmu4kRR3pKuPzTeLGz8=; b=en5HJCFOmjv1gk9yMvuwqXIPzN2bFBNOsIV3I/r9jEtCqg3MMtCaPCKMI3LKPf69IcK5zk1y8dx9QuEyHMLgUN7yyIB1FVl/E6hPm3diGlyKvPR9AEo7GIcE/0Nlmed3; Original-Received: from [50.90.253.209] (port=33284 helo=Nathan-GNU) by host393.hostmonster.com with esmtpsa (UNKNOWN:CAMELLIA128-SHA:128) (Exim 4.80) (envelope-from ) id 1W1y12-0004M4-W2 for 16415@debbugs.gnu.org; Sat, 11 Jan 2014 05:50:17 -0700 In-Reply-To: <87iotrfbi6.fsf@nbtrap.com> (Nathan Trapuzzano's message of "Fri, 10 Jan 2014 22:22:41 -0500") 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-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:83291 Archived-At: --=-=-= Content-Type: text/plain Nathan Trapuzzano 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: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=shr.patch # 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 + + * 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 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/yb3E927Fiw7dnwPL8/6 frzpzCY1Ozpmhp2YTaQiTGjAXj6casqJlTiUu2uuROrpSAJIRbhVHzI8nEb0f/PMqYMn+M46S3B6 CpWkxpkea/QzGBmTMDYfdGtEDAhB5wbhF29zhaGpvXONN8InTy6BnsOqDwMajTryTON/rqPHPgld 9tVw+LFjnFYyaJ4VyFS1LOX4n3fxVRMuuoukpvINdNj4uFQytodes/lsH5AmAaPSewlk42K/EaOP GX4TErFM+UlTb7hTvQAX9KMoNI7zug8B+t+xguDOA0e10PSuW2NSPV1EhzhK8SULETmuw/nwzlJn Rq4XBV+x5CY9iZeXeYPR+wglQEvFaFCMyC5DDDCPIXxJ/RHT8ohI0TcwUykeqAdt2M5lubt1p1xQ i0CjQOKfnfgOc6ZgRhs/JsqUu44uHDIMIjsIkksaLx75BIKJIiAE2E80ggHwYTYLvhGr1EcVBbEg ilBJGVL7okT28QcK4wFePciyBD4FDgiex+cArGD621hliDgUdDkHl6kRYSBwgYQVovejbMoK8sV/ wqoo1wo1KX5k0NYMZnmVgLelkTYVZeeBiOTy025grf54wxkCrLv4OPHSSIhiSxByo11BSL4MwyUq 0HVkkRB8EMOBuHrXeRiUmiVzfgK2bzYyLDgOqZ8geGdYGdYxRorVZL0s7yuWdoT1Y0eDSBXPZ4oI 0LrdxC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