unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* 23.0.0; (thing-at-point 'url) returns invalid urls
@ 2007-08-29 18:40 Leo
  2007-08-29 18:51 ` Drew Adams
  2007-08-29 19:37 ` Leo
  0 siblings, 2 replies; 13+ messages in thread
From: Leo @ 2007-08-29 18:40 UTC (permalink / raw)
  To: emacs-pretest-bug


Please describe exactly what actions triggered the bug
and the precise symptoms of the bug:

Put the point in any word but not in a url and eval (thing-at-point
'url) it will returns a url like "http://something", where 'something'
is the word under point.

If Emacs crashed, and you have the Emacs process in the gdb debugger,
please include the output from the following gdb commands:
    `bt full' and `xbacktrace'.
If you would like to further debug the crash, please read the file
/usr/local/packages/emacs/share/emacs/23.0.0/etc/DEBUG for instructions.


In GNU Emacs 23.0.0.8 (i686-pc-linux-gnu, GTK+ Version 2.10.14)
 of 2007-08-29 on sl392.st-edmunds.cam.ac.uk
Windowing system distributor `The X.Org Foundation', version 11.0.10300000
configured using `configure  '--prefix=/usr/local/packages/emacs' '--with-kerberos5' '--enable-locallisppath=/usr/local/share/emacs/site-lisp' '--without-toolkit-scroll-bars' '--with-xft' '--enable-font-backend' '--with-x-toolkit=yes''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_GB.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default-enable-multibyte-characters: t

Major mode: ERC

Minor modes in effect:
  erc-spelling-mode: t
  erc-page-mode: t
  erc-menu-mode: t
  erc-services-mode: t
  erc-autojoin-mode: t
  erc-button-mode: t
  erc-ring-mode: t
  erc-pcomplete-mode: t
  erc-track-mode: t
  erc-track-minor-mode: t
  erc-match-mode: t
  erc-fill-mode: t
  erc-stamp-mode: t
  erc-netsplit-mode: t
  erc-smiley-mode: t
  erc-readonly-mode: t
  erc-scrolltobottom-mode: t
  flyspell-mode: t
  dired-omit-mode: t
  recentf-mode: t
  icomplete-mode: t
  show-paren-mode: t
  savehist-mode: t
  xterm-mouse-mode: t
  delete-selection-mode: t
  global-auto-revert-mode: t
  display-time-mode: t
  minibuffer-indicate-depth-mode: t
  partial-completion-mode: t
  which-function-mode: t
  shell-dirtrack-mode: t
  tooltip-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  global-auto-composition-mode: t
  auto-composition-mode: t
  auto-compression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
t h e SPC b r o w s e r SPC c a n SPC n o t SPC f i 
n d <return> C-x o <tab> <return> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <up> <up> <up> <up> <up> <up> 
<up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> 
<up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> 
<up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> 
<up> <up> <up> <up> <up> <up> C-x o <down> <down> <down> 
<down> <up> <up> <down> <down> <down> <left> <left> 
<left> <left> <left> <left> <left> <left> <left> <left> 
<left> <left> <left> <left> <left> <left> <left> <left> 
<left> <left> <left> <left> <left> <left> <left> C-x 
0 C-x k <return> C-x b <return> i SPC w a n t SPC t 
o SPC a v o i d SPC d <backspace> o p e n SPC m y SPC 
b r o w s e r SPC t o SPC a SPC u r l SPC l i k e SPC 
t h a t <return> <up> <up> <up> <up> <up> <up> <up> 
<up> <up> <down> <right> <right> <right> <right> <right> 
<right> <right> <right> <right> <right> <right> <right> 
<right> <right> <right> <right> <right> <right> <right> 
<right> <right> <right> <right> <right> <right> <right> 
M-: ( t h i n g - a t - p o i <tab> SPC ' u r l <return> 
M-x r e b <tab> <backspace> <backspace> <backspace> 
<backspace> <backspace> <backspace> <backspace> <backspace> 
<backspace> <backspace> <backspace> <backspace> <backspace> 
<backspace> <backspace> <backspace> <backspace> <backspace> 
<backspace> e p <tab> o <tab> r <tab> b <tab> <ret
urn>

Recent messages:
Using try-expand-dabbrev
Type C-x 1 to remove help window.  
Quit
Using try-expand-dabbrev
Using try-expand-list
"http://that"
call-interactively: End of buffer
mouse-2, RET: find function's definition
"http://create"
Loading emacsbug...done

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

* RE: 23.0.0; (thing-at-point 'url) returns invalid urls
  2007-08-29 18:40 23.0.0; (thing-at-point 'url) returns invalid urls Leo
@ 2007-08-29 18:51 ` Drew Adams
  2007-08-29 19:00   ` Leo
  2007-08-29 19:37 ` Leo
  1 sibling, 1 reply; 13+ messages in thread
From: Drew Adams @ 2007-08-29 18:51 UTC (permalink / raw)
  To: emacs-pretest-bug

> Put the point in any word but not in a url and eval (thing-at-point
> 'url) it will returns a url like "http://something", where 'something'
> is the word under point.

That looks good to me. Why do you think it is not a valid URL? 

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

* Re: 23.0.0; (thing-at-point 'url) returns invalid urls
  2007-08-29 18:51 ` Drew Adams
@ 2007-08-29 19:00   ` Leo
  2007-08-29 19:49     ` Tassilo Horn
  0 siblings, 1 reply; 13+ messages in thread
From: Leo @ 2007-08-29 19:00 UTC (permalink / raw)
  To: emacs-devel

On 2007-08-29 19:51 +0100, Drew Adams wrote:
>> Put the point in any word but not in a url and eval (thing-at-point
>> 'url) it will returns a url like "http://something", where 'something'
>> is the word under point.
>
> That looks good to me. Why do you think it is not a valid URL? 

Because a url created by concat "http://" and the word under point is
unlikely to be accessible by a browser.

-- 
Leo <sdl.web AT gmail.com>                         (GPG Key: 9283AA3F)

         Gnus is one component of the Emacs operating system.

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

* Re: 23.0.0; (thing-at-point 'url) returns invalid urls
  2007-08-29 18:40 23.0.0; (thing-at-point 'url) returns invalid urls Leo
  2007-08-29 18:51 ` Drew Adams
@ 2007-08-29 19:37 ` Leo
  1 sibling, 0 replies; 13+ messages in thread
From: Leo @ 2007-08-29 19:37 UTC (permalink / raw)
  To: emacs-devel

On 2007-08-29 19:40 +0100, Leo wrote:
> Put the point in any word but not in a url and eval (thing-at-point
> 'url) it will returns a url like "http://something", where 'something'
> is the word under point.

`ffap-url-at-point' returns NIL.

-- 
Leo <sdl.web AT gmail.com>                         (GPG Key: 9283AA3F)

         Gnus is one component of the Emacs operating system.

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

* Re: 23.0.0; (thing-at-point 'url) returns invalid urls
  2007-08-29 19:00   ` Leo
@ 2007-08-29 19:49     ` Tassilo Horn
  2007-08-29 20:24       ` Leo
  0 siblings, 1 reply; 13+ messages in thread
From: Tassilo Horn @ 2007-08-29 19:49 UTC (permalink / raw)
  To: emacs-devel

Leo <sdl.web@gmail.com> writes:

Hi Leo,

>>> Put the point in any word but not in a url and eval (thing-at-point
>>> 'url) it will returns a url like "http://something", where
>>> 'something' is the word under point.
>>
>> That looks good to me. Why do you think it is not a valid URL?
>
> Because a url created by concat "http://" and the word under point is
> unlikely to be accessible by a browser.

... unless the word is www.google.com or savannah.gnu.org.  So to me the
behavior looks good.  I think it's much better to return an URL that may
not exist than always returning nil if the URL lacks the protocol spec.

Bye,
Tassilo
-- 
People sometimes  ask me if it  is a sin in  the Church of  Emacs to use
vi. Using a free  version of vi is not a sin; it  is a penance. So happy
hacking. (Richard M. Stallman)

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

* Re: 23.0.0; (thing-at-point 'url) returns invalid urls
  2007-08-29 19:49     ` Tassilo Horn
@ 2007-08-29 20:24       ` Leo
  2007-08-29 21:25         ` Davis Herring
  0 siblings, 1 reply; 13+ messages in thread
From: Leo @ 2007-08-29 20:24 UTC (permalink / raw)
  To: emacs-devel

On 2007-08-29 20:49 +0100, Tassilo Horn wrote:
> ... unless the word is www.google.com or savannah.gnu.org.  So to me the
> behavior looks good.  I think it's much better to return an URL that may
> not exist than always returning nil if the URL lacks the protocol spec.

but those examples are easy to parse as they have '.' in them i.e. we
can improve thing-at-point.

-- 
Leo <sdl.web AT gmail.com>                         (GPG Key: 9283AA3F)

         Gnus is one component of the Emacs operating system.

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

* Re: 23.0.0; (thing-at-point 'url) returns invalid urls
  2007-08-29 20:24       ` Leo
@ 2007-08-29 21:25         ` Davis Herring
  2007-08-29 21:41           ` Leo
  0 siblings, 1 reply; 13+ messages in thread
From: Davis Herring @ 2007-08-29 21:25 UTC (permalink / raw)
  To: Leo; +Cc: emacs-devel

>> ... unless the word is www.google.com or savannah.gnu.org.  So to me the
>> behavior looks good.  I think it's much better to return an URL that may
>> not exist than always returning nil if the URL lacks the protocol spec.
>
> but those examples are easy to parse as they have '.' in them i.e. we
> can improve thing-at-point.

Not really.  I'm able to resolve addresses for "localhost" and "hk" (the
gTLD for Hong Kong), as well as a variety of names that are meaningful
only on this network.  If I ask Emacs to interpret any of those names as a
URL, it would be silly of it to reject them and not "fsf.org"!

Davis

-- 
This product is sold by volume, not by mass.  If it appears too dense or
too sparse, it is because mass-energy conversion has occurred during
shipping.

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

* Re: 23.0.0; (thing-at-point 'url) returns invalid urls
  2007-08-29 21:25         ` Davis Herring
@ 2007-08-29 21:41           ` Leo
  2007-08-29 22:08             ` Davis Herring
  0 siblings, 1 reply; 13+ messages in thread
From: Leo @ 2007-08-29 21:41 UTC (permalink / raw)
  To: emacs-devel

On 2007-08-29 22:25 +0100, Davis Herring wrote:
> Not really.  I'm able to resolve addresses for "localhost"

A special case which can be handled.

> and "hk" (the gTLD for Hong Kong), as well as a variety of names that
> are meaningful only on this network. 

Can you give me a specific example?

> If I ask Emacs to interpret any of those names as a URL, it would be
> silly of it to reject them and not "fsf.org"!

However, 99.9% a word under point is not a valid url.

-- 
Leo <sdl.web AT gmail.com>                         (GPG Key: 9283AA3F)

         Gnus is one component of the Emacs operating system.

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

* Re: 23.0.0; (thing-at-point 'url) returns invalid urls
  2007-08-29 21:41           ` Leo
@ 2007-08-29 22:08             ` Davis Herring
  2007-08-29 22:37               ` Drew Adams
  0 siblings, 1 reply; 13+ messages in thread
From: Davis Herring @ 2007-08-29 22:08 UTC (permalink / raw)
  To: Leo; +Cc: emacs-devel

>> and "hk" (the gTLD for Hong Kong), as well as a variety of names that
>> are meaningful only on this network.
>
> Can you give me a specific example?

I just mean the unqualified hostnames of machines on this network.  "www",
"int", "lanleventsext", "phonebook", "financial", etc.

Davis

-- 
This product is sold by volume, not by mass.  If it appears too dense or
too sparse, it is because mass-energy conversion has occurred during
shipping.

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

* RE: 23.0.0; (thing-at-point 'url) returns invalid urls
  2007-08-29 22:08             ` Davis Herring
@ 2007-08-29 22:37               ` Drew Adams
  2007-08-29 22:42                 ` Leo
  0 siblings, 1 reply; 13+ messages in thread
From: Drew Adams @ 2007-08-29 22:37 UTC (permalink / raw)
  To: Emacs-Pretest-Bug

> > Can you give me a specific example?
>
> I just mean the unqualified hostnames of machines on this network.  "www",
> "int", "lanleventsext", "phonebook", "financial", etc.

Yes.

URL syntax is quite variable. See http://www.ietf.org/rfc/rfc3986.txt.

Notice that "path" can be empty (no more slashes after http://, ftp:// or
whatever). This means that a URL with only http:// followed by an
"authority" (such as anythingyouwant) is valid URL syntax.

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.

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.

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

* Re: 23.0.0; (thing-at-point 'url) returns invalid urls
  2007-08-29 22:37               ` Drew Adams
@ 2007-08-29 22:42                 ` Leo
  2007-08-29 23:00                   ` Drew Adams
  2007-08-30  0:33                   ` Thien-Thi Nguyen
  0 siblings, 2 replies; 13+ messages in thread
From: Leo @ 2007-08-29 22:42 UTC (permalink / raw)
  To: emacs-devel; +Cc: emacs-pretest-bug

On 2007-08-29 23:37 +0100, Drew Adams wrote:
> 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

-- 
Leo <sdl.web AT gmail.com>                         (GPG Key: 9283AA3F)

         Gnus is one component of the Emacs operating system.

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

* RE: 23.0.0; (thing-at-point 'url) returns invalid urls
  2007-08-29 22:42                 ` Leo
@ 2007-08-29 23:00                   ` Drew Adams
  2007-08-30  0:33                   ` Thien-Thi Nguyen
  1 sibling, 0 replies; 13+ messages in thread
From: Drew Adams @ 2007-08-29 23:00 UTC (permalink / raw)
  To: emacs-pretest-bug

> > 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.

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

* Re: 23.0.0; (thing-at-point 'url) returns invalid urls
  2007-08-29 22:42                 ` Leo
  2007-08-29 23:00                   ` Drew Adams
@ 2007-08-30  0:33                   ` Thien-Thi Nguyen
  1 sibling, 0 replies; 13+ messages in thread
From: Thien-Thi Nguyen @ 2007-08-30  0:33 UTC (permalink / raw)
  To: Leo; +Cc: emacs-pretest-bug

() Leo <sdl.web@gmail.com>
() Wed, 29 Aug 2007 23:42:24 +0100

   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...

how about adding a variable: `thing-at-point-url-autoprefix-p'.
if nil, consider the case w/o "http://" to be invalid, so
that (thing-at-point 'url) => nil.  if t, do what it does now,
which is (from thingatpt.el 1.43 from cvs) to heuristically
add one of either "ftp://" or "http://".

thi

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

end of thread, other threads:[~2007-08-30  0:33 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-29 18:40 23.0.0; (thing-at-point 'url) returns invalid urls Leo
2007-08-29 18:51 ` Drew Adams
2007-08-29 19:00   ` Leo
2007-08-29 19:49     ` Tassilo Horn
2007-08-29 20:24       ` Leo
2007-08-29 21:25         ` Davis Herring
2007-08-29 21:41           ` Leo
2007-08-29 22:08             ` Davis Herring
2007-08-29 22:37               ` Drew Adams
2007-08-29 22:42                 ` Leo
2007-08-29 23:00                   ` Drew Adams
2007-08-30  0:33                   ` Thien-Thi Nguyen
2007-08-29 19:37 ` Leo

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).