all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#572: thing-at-point 'url gets confused if url has paren
@ 2008-07-18 12:41 ` xah lee
  2008-08-07 19:25   ` bug#572: marked as done (thing-at-point 'url gets confused if url has paren) Emacs bug Tracking System
  0 siblings, 1 reply; 2+ messages in thread
From: xah lee @ 2008-07-18 12:41 UTC (permalink / raw
  To: bug-gnu-emacs


(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,  
depending on the context the uri is used. Quote: «When a character  
from the reserved set (a "reserved character") has special meaning (a  
"reserved purpose") in a certain context, and a URI scheme says that  
it is necessary to use that character for some other purpose, then  
the character must be percent-encoded.»

But anyhow, practically speaking, often uri will contain parens. e.g.  
Wikipedia has lots of article with url containing paren, and in  
browser they are shown as paren, and this is often copied and pasted  
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
∑ http://xahlee.org/

☄


☄









^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#572: marked as done (thing-at-point 'url gets confused if url has paren)
  2008-07-18 12:41 ` bug#572: thing-at-point 'url gets confused if url has paren xah lee
@ 2008-08-07 19:25   ` Emacs bug Tracking System
  0 siblings, 0 replies; 2+ messages in thread
From: Emacs bug Tracking System @ 2008-08-07 19:25 UTC (permalink / raw
  To: joakim

[-- Attachment #1: Type: text/plain, Size: 817 bytes --]


Your message dated Thu, 07 Aug 2008 21:17:09 +0200
with message-id <m3od443aa2.fsf@verona.se>
and subject line commited a fix
has caused the Emacs bug report #572,
regarding thing-at-point 'url gets confused if url has paren
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact don@donarmstrong.com
immediately.)


-- 
572: http://emacsbugs.donarmstrong.com/cgi-bin/bugreport.cgi?bug=572
Emacs Bug Tracking System
Contact don@donarmstrong.com with problems

[-- Attachment #2: Type: message/rfc822, Size: 4321 bytes --]

From: xah lee <xah@xahlee.org>
To: bug-gnu-emacs@gnu.org
Subject: thing-at-point 'url gets confused if url has paren
Date: Fri, 18 Jul 2008 05:41:38 -0700
Message-ID: <03625014-7638-464D-87AB-773848C25295@xahlee.org>


(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,  
depending on the context the uri is used. Quote: «When a character  
from the reserved set (a "reserved character") has special meaning (a  
"reserved purpose") in a certain context, and a URI scheme says that  
it is necessary to use that character for some other purpose, then  
the character must be percent-encoded.»

But anyhow, practically speaking, often uri will contain parens. e.g.  
Wikipedia has lots of article with url containing paren, and in  
browser they are shown as paren, and this is often copied and pasted  
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
∑ http://xahlee.org/

☄


☄






[-- Attachment #3: Type: message/rfc822, Size: 1073 bytes --]

From: joakim@verona.se
To: 572-done@emacsbugs.donarmstrong.com
Subject: commited a fix
Date: Thu, 07 Aug 2008 21:17:09 +0200
Message-ID: <m3od443aa2.fsf@verona.se>

Thanks for the thorough bug report!
-- 
Joakim Verona


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-08-07 19:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <m3od443aa2.fsf@verona.se>
2008-07-18 12:41 ` bug#572: thing-at-point 'url gets confused if url has paren xah lee
2008-08-07 19:25   ` bug#572: marked as done (thing-at-point 'url gets confused if url has paren) Emacs bug Tracking System

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.