Subject: bug#572 closed by [email-masked] (commited a fix)

From: [email-masked] (Emacs bug Tracking System)

This is an automatic notification regarding your bug report
which was filed against the emacs package:

#572: thing-at-point 'url gets confused if url has paren

It has been closed by [email-masked].

Their explanation is attached below along with your original report.
If this explanation is unsatisfactory and you have not received a
better one in a separate message then please contact [email-masked] by
replying to this email.

-- 
572: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=572
Emacs Bug Tracking System
Contact [email-masked] with problems
>From [email-masked] Thu Aug  7 12:17:25 2008
From: [email-masked]
To: [email-masked]
Subject: commited a fix
Date: Thu, 07 Aug 2008 21:17:09 +0200

Thanks for the thorough bug report!
-- 
Joakim Verona

>From [email-masked] Fri Jul 18 05:42:43 2008
To: [email-masked]
From: xah lee <[email-masked]>
Subject: thing-at-point 'url gets confused if url has paren
Date: Fri, 18 Jul 2008 05:41:38 -0700

(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