From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/65206 Path: news.gmane.org!not-for-mail From: Katsumi Yamaoka Newsgroups: gmane.emacs.gnus.general Subject: Re: URIs wrapped in angle brackets are not extracted correctly Date: Tue, 18 Sep 2007 20:45:41 +0900 Organization: Emacsen advocacy group Message-ID: References: <874phvi0ui.fsf@ID-24456.user.uni-berlin.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: sea.gmane.org 1190116057 9783 80.91.229.12 (18 Sep 2007 11:47:37 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 18 Sep 2007 11:47:37 +0000 (UTC) Cc: bugs@gnus.org, ding@gnus.org To: Christoph Conrad Original-X-From: ding-owner+M13719@lists.math.uh.edu Tue Sep 18 13:47:34 2007 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by lo.gmane.org with esmtp (Exim 4.50) id 1IXbY1-0004E4-Mw for ding-account@gmane.org; Tue, 18 Sep 2007 13:47:22 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by util0.math.uh.edu with smtp (Exim 4.63) (envelope-from ) id 1IXbXF-0007HK-9l; Tue, 18 Sep 2007 06:46:33 -0500 Original-Received: from mx1.math.uh.edu ([129.7.128.32]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1IXbXC-0007H1-9C for ding@lists.math.uh.edu; Tue, 18 Sep 2007 06:46:30 -0500 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx1.math.uh.edu with esmtp (Exim 4.67) (envelope-from ) id 1IXbX7-00050m-Qw for ding@lists.math.uh.edu; Tue, 18 Sep 2007 06:46:30 -0500 Original-Received: from orlando.hostforweb.net ([216.246.45.90]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1IXbWy-0004W2-00; Tue, 18 Sep 2007 13:46:16 +0200 Original-Received: from [66.225.201.151] (port=39322 helo=mail.jpl.org) by orlando.hostforweb.net with esmtpa (Exim 4.68) (envelope-from ) id 1IXbWZ-0007uQ-I7; Tue, 18 Sep 2007 06:45:52 -0500 X-Hashcash: 1:20:070918:christoph.conrad@gmx.de::93ymtnxoY9NEfLIo:000000000000000000000000000000000000004ck+ X-Hashcash: 1:20:070918:bugs@gnus.org::TvavspPJk9lxzwVx:00000IqX X-Hashcash: 1:20:070918:ding@gnus.org::sP4ZYP4TykmZsCm4:00000bqH X-Face: #kKnN,xUnmKia.'[pp`;Omh}odZK)?7wQSl"4o04=EixTF+V[""w~iNbM9ZL+.b*_CxUmFk B#Fu[*?MZZH@IkN:!"\w%I_zt>[$nm7nQosZ<3eu;B:$Q_:p!',P.c0-_Cy[dz4oIpw0ESA^D*1Lw= L&i*6&( User-Agent: Gnus/5.110007 (No Gnus v0.7) Emacs/23.0.50 (gnu/linux) Cancel-Lock: sha1:Ajk7GvjAUL+jeFCubjpbCjOAdJ8= X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - orlando.hostforweb.net X-AntiAbuse: Original Domain - gnus.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - jpl.org X-Source: X-Source-Args: X-Source-Dir: X-Spam-Score: -2.4 (--) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:65206 Archived-At: --=-=-= (I added Cc: ding.) >>>>> Christoph Conrad wrote: > No Gnus v0.7 > GNU Emacs 23.0.50.1 (i686-pc-linux-gnu, GTK+ Version 2.10.13, multi-tty) > of 2007-09-03 on brabbelbox > 200 news.gmane.org InterNetNews NNRP server INN 2.4.1 ready (posting ok). > Hi, > according to RFC 3986 Appendix C the following URI should be extracted > correctly when embedded in angle brackets, containing a line break: > This is not the case in current cvs-Gnus when pressing > (widget-button-press). Only the first part of the URI before the line > break is extracted. There might be a reason neither `ffap-url-at-point' (ffap.el) nor `thing-at-point' (thingatpt.el) works with such data. I tried making Gnus work (the patch is attached to this message). However, it currently does not work with the following ones: >>>>> Christoph Conrad wrote: > D2D4C29A2BA6460BE3F10EC~ATpl~Ecommon~Scontent.html> Katsumi> Katsumi> I think it is hard to make it work with any type of citations. Any idea? > ,---- >| In practice, URIs are delimited in a variety of ways, but usually within >| double-quotes "http://example.com/", angle brackets >| , or just by using whitespace >| [...] >| In some cases, extra whitespace (spaces, line-breaks, tabs, etc.) may >| have to be added to break a long URI across lines. The whitespace should >| be ignored when the URI is extracted. > `---- > Best regards, > Christoph --=-=-= Content-Type: text/x-patch Content-Disposition: attachment Content-Description: Patch to gnus-art.el --- gnus-art.el~ 2007-08-24 10:22:10 +0000 +++ gnus-art.el 2007-09-18 11:43:14 +0000 @@ -7357,9 +7357,24 @@ (setq regexp (eval (car entry))) (goto-char beg) (while (re-search-forward regexp nil t) - (let* ((start (and entry (match-beginning (nth 1 entry)))) - (end (and entry (match-end (nth 1 entry)))) + (let* ((start (match-beginning (nth 1 entry))) + (end (match-end (nth 1 entry))) (from (match-beginning 0))) + (when (eq (car entry) 'gnus-button-url-regexp) + (let ((to (match-end 0))) + (goto-char end) + (when (or (looking-at "[\t\n ]*>") + (progn + (goto-char start) + (and (or (eq (char-before) ?<) + (and (search-backward "<" nil t) + (string-match + "url:[\t\n ]*" + (buffer-substring (match-end 0) + start)))) + (re-search-forward "[\t\n ]*>" nil t)))) + (setq end (match-beginning 0))) + (goto-char to))) (when (and (or (eq t (nth 2 entry)) (eval (nth 2 entry))) (not (gnus-button-in-region-p @@ -7450,6 +7465,27 @@ (if (looking-at (eval (car entry))) (setq alist nil) (setq entry nil))) + (when (and entry + (eq (car entry) 'gnus-button-url-regexp)) + (let ((start (point)) + end md) + (goto-char (match-end (nth 1 entry))) + (when (save-match-data + (when (or (looking-at "[\t\n ]*>") + (progn + (goto-char start) + (and (or (eq (char-before) ?<) + (and (search-backward "<" nil t) + (string-match + "url:[\t\n ]*" + (buffer-substring (match-end 0) + start)))) + (re-search-forward "[\t\n ]*>" nil t)))) + (setq end (match-beginning 0)))) + (setq md (match-data)) + (setcar (nthcdr (1+ (* (nth 1 entry) 2)) md) end) + (set-match-data md)) + (goto-char start))) entry)) (defun gnus-button-push (marker) @@ -7460,7 +7496,9 @@ (inhibit-point-motion-hooks t) (fun (nth 3 entry)) (args (mapcar (lambda (group) - (let ((string (match-string group))) + (let ((string (gnus-replace-in-string + (match-string group) + "\\(?:[\t ]*\n\\)+[\t ]*" ""))) (set-text-properties 0 (length string) nil string) string)) --=-=-=--