From xah@xahlee.org Fri Jul 18 05:42:43 2008 X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) on rzlab.ucr.edu X-Spam-Level: X-Spam-Status: No, score=-4.1 required=4.0 tests=AWL,BAYES_00, RCVD_IN_DNSWL_LOW autolearn=ham version=3.2.3-bugs.debian.org_2005_01_02 Received: (at submit) by emacsbugs.donarmstrong.com; 18 Jul 2008 12:42:43 +0000 Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m6ICgc8L027900 for ; Fri, 18 Jul 2008 05:42:39 -0700 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KJpIC-0007Rf-Oe for bug-gnu-emacs@gnu.org; Fri, 18 Jul 2008 08:42:36 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KJpI8-0007Px-HS for bug-gnu-emacs@gnu.org; Fri, 18 Jul 2008 08:42:34 -0400 Received: from [199.232.76.173] (port=35573 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KJpI7-0007Pi-NS for bug-gnu-emacs@gnu.org; Fri, 18 Jul 2008 08:42:32 -0400 Received: from mout.perfora.net ([74.208.4.197]:61255) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KJpI6-0000iI-SC for bug-gnu-emacs@gnu.org; Fri, 18 Jul 2008 08:42:31 -0400 Received: from [192.168.1.5] (c-24-6-97-120.hsd1.ca.comcast.net [24.6.97.120]) by mrelay.perfora.net (node=mrus1) with ESMTP (Nemesis) id 0MKpCa-1KJpHi1d3t-0004i0; Fri, 18 Jul 2008 08:42:07 -0400 Mime-Version: 1.0 (Apple Message framework v753.1) Content-Transfer-Encoding: quoted-printable Message-Id: <03625014-7638-464D-87AB-773848C25295@xahlee.org> Content-Type: text/plain; charset=UTF-8; delsp=yes; format=flowed To: bug-gnu-emacs@gnu.org From: xah lee Subject: thing-at-point 'url gets confused if url has paren Date: Fri, 18 Jul 2008 05:41:38 -0700 X-Mailer: Apple Mail (2.753.1) X-Provags-ID: V01U2FsdGVkX18clfRNxcCf9/uthQxAYrP1urXXZ9nbih2p6U9 s4597Yq13cPMu/S18AWVV5+waL5RrC6+R3qP8J8MJtSmIRNseH ICQ5Y1i1wGFPAa00Wv7SQ== X-detected-kernel: by monty-python.gnu.org: Linux 2.6? (barebone, rare!) (thing-at-point 'url) gets confused if the url contains a parenthesis such as in http://en.wikipedia.org/wiki/Oz_(programming_language) Note that, according to http://en.wikipedia.org/wiki/Percent-encoding parenthesis in uri do not necessarily needs to be percent encoded, =20 depending on the context the uri is used. Quote: =C2=ABWhen a character =20= from the reserved set (a "reserved character") has special meaning (a =20= "reserved purpose") in a certain context, and a URI scheme says that =20 it is necessary to use that character for some other purpose, then =20 the character must be percent-encoded.=C2=BB But anyhow, practically speaking, often uri will contain parens. e.g. =20= Wikipedia has lots of article with url containing paren, and in =20 browser they are shown as paren, and this is often copied and pasted =20 as is to editors. the above should be the complete bug description. The following are supplementary to this bug report. -------------------------------------------- Here's a sample code (defun wrap-url () "Make the url at cursor point into a html link. If there is a region, use the region as url instead. This function is interface wrapper for `wrap-url-string'. See that function for detail." (interactive) (let (bds p1 p2 url) (if (and transient-mark-mode mark-active) (progn (setq p1 (region-beginning)) (setq p2 (region-end)) ) (progn (setq bds (bounds-of-thing-at-point 'url)) (setq p1 (car bds)) (setq p2 (cdr bds)) ) ) (setq url (buffer-substring-no-properties p1 p2)) (delete-region p1 p2) (goto-char p1) (insert (wrap-url-string url)) ) ) the error from the above code when the cursor is on the following line: http://en.wikipedia.org/wiki/Oz_(programming_language) is: setq: Wrong type argument: integer-or-marker-p, nil presumably because the boundary p1 or p2 is not a integer or marker. ----------------- In GNU Emacs 22.2.1 (powerpc-apple-darwin8.11.0, Carbon Version 1.6.0) of 2008-04-05 on g5.tokyo.stp.isas.jaxa.jp Windowing system distributor `Apple Inc.', version 10.4.11 Xah =E2=88=91 http://xahlee.org/ =E2=98=84 =E2=98=84 From joakim@verona.se Sun Aug 3 14:43:10 2008 X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) on rzlab.ucr.edu X-Spam-Level: X-Spam-Status: No, score=-4.0 required=4.0 tests=AWL,BAYES_00, MURPHY_DRUGS_REL8 autolearn=ham version=3.2.3-bugs.debian.org_2005_01_02 Received: (at 572) by emacsbugs.donarmstrong.com; 3 Aug 2008 21:43:10 +0000 Received: from gate.verona.se (IDENT:0@iwfs.imcode.com [82.115.149.64]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m73Lh6Hp013766 for <572@emacsbugs.donarmstrong.com>; Sun, 3 Aug 2008 14:43:08 -0700 Received: from chopper (IDENT:1005@localhost [127.0.0.1]) by gate.verona.se (8.13.4/8.11.4) with ESMTP id m73Lh0G0013942 for <572@emacsbugs.donarmstrong.com>; Sun, 3 Aug 2008 23:43:00 +0200 From: joakim@verona.se To: 572@debbugs.gnu.org Subject: patch which seems to fix it Date: Sun, 03 Aug 2008 23:43:01 +0200 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Removing the () from the regexp seems to fix this. The OP:s assesment that () are valid in an url is correct. === modified file 'lisp/thingatpt.el' *** lisp/thingatpt.el 2008-05-06 13:57:18 +0000 --- lisp/thingatpt.el 2008-08-03 21:38:46 +0000 *************** *** 208,214 **** (goto-char (point-min))))) (defvar thing-at-point-url-path-regexp ! "[^]\t\n \"'()<>[^`{}]*[^]\t\n \"'()<>[^`{}.,;]+" "A regular expression probably matching the host and filename or e-mail part of a URL.") (defvar thing-at-point-short-url-regexp --- 208,214 ---- (goto-char (point-min))))) (defvar thing-at-point-url-path-regexp ! "[^]\t\n \"'<>[^`{}]*[^]\t\n \"'<>[^`{}.,;]+" "A regular expression probably matching the host and filename or e-mail part of a URL.") (defvar thing-at-point-short-url-regexp -- Joakim Verona From joakim@verona.se Thu Aug 7 12:17:25 2008 X-Spam-Checker-Version: SpamAssassin 3.2.3-bugs.debian.org_2005_01_02 (2007-08-08) on rzlab.ucr.edu X-Spam-Level: X-Spam-Status: No, score=-4.0 required=4.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.3-bugs.debian.org_2005_01_02 Received: (at 572-done) by emacsbugs.donarmstrong.com; 7 Aug 2008 19:17:25 +0000 Received: from gate.verona.se (IDENT:0@iwfs.imcode.com [82.115.149.64]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m77JHMDX023292 for <572-done@emacsbugs.donarmstrong.com>; Thu, 7 Aug 2008 12:17:23 -0700 Received: from chopper (IDENT:1005@localhost [127.0.0.1]) by gate.verona.se (8.13.4/8.11.4) with ESMTP id m77JHFn2012944 for <572-done@emacsbugs.donarmstrong.com>; Thu, 7 Aug 2008 21:17:15 +0200 From: joakim@verona.se To: 572-done@debbugs.gnu.org Subject: commited a fix User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) Date: Thu, 07 Aug 2008 21:17:09 +0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Thanks for the thorough bug report! -- Joakim Verona From unknown Thu Jun 19 14:03:52 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: $requester Subject: Internal Control Message-Id: bug archived. Date: Fri, 05 Sep 2008 14:24:03 +0000 User-Agent: Fakemail v42.6.9 # A New Hope # A log time ago, in a galaxy far, far away # something happened. # # Magically this resulted in the following # action being taken, but this fake control # message doesn't tell you why it happened # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator