emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: 23.0.0; (thing-at-point 'url) returns invalid urls


From: Drew Adams
Subject: RE: 23.0.0; (thing-at-point 'url) returns invalid urls
Date: Wed, 29 Aug 2007 16:00:14 -0700

> > http://anythingyouwant is thus a valid URL, in terms of syntax.
> > Whether or not it links to something is another matter. But you
> > have no guarantee that http://www.google.com links to anything
> > right now, either.
>
> Emacs pick the word under point and add "http://"; to it to form a valid
> i.e. there is a change from invalid to valid that is not...
>
> > If you want validity in terms of live link target and not just URL
> > syntax, then the code would have to actually try the link. Some
> > programs do just that to test URL "validity". In this case, I'd
> > say that that is not what is called for, and Emacs already DTRT.
>
> DTRT

It's not clear to me what you're saying. I think you're saying that you
would prefer that the code return nil, saying that there is no URL at point,
rather than returning a valid URL formed by prepending http:// to the text
at point.

The latter behavior is deliberate; it is a feature. If what is under the
cursor is already a valid URL, then that is returned as is. This includes
URLs with different schemes, not just http. If what is under the cursor is
not a valid URL because it is lacking a scheme, then Emacs prepends the http
scheme. That's the design.

This behavior is similar to that found in most Web browsers and mail
clients: you can type just www.google.com, and http:// is automatically
understood: http://www.google.com.

I think this design is a good one. You might disagree.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]