From: "Drew Adams" <drew.adams@oracle.com>
To: "Emacs-Devel" <emacs-devel@gnu.org>
Subject: RE: [sdl.web@gmail.com: 23.0.0; (thing-at-point 'url) returns invalid urls]
Date: Fri, 31 Aug 2007 16:57:04 -0700 [thread overview]
Message-ID: <BNELLINCGFJLDJIKDGACIEPMCBAA.drew.adams@oracle.com> (raw)
In-Reply-To: <87wsvbie0j.fsf@gnuvola.org>
> That's OK too. I thought people were asking for the ability to
> get only "valid" URLs in the sense of having live
> targets. Isn't that what the initial request was for?
>
> iiuc the initial request was to disambiguate the two cases whereby
> (thing-at-point 'url) when point is on one of:
> something
> http://something
> (both cases return "http://something").
Admittedly, the text of the initial bug report (OP) is not too clear:
>> 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 and other posts seem to suggest that the requested (optional, perhaps)
behavior is to return nil unless the URL under point contains a scheme (e.g.
http://, ftp://). For example, "something" at point and www.google.com at
point would each return nil.
However, other posts seem to suggest that the perceived problem is that
http://something is not a "valid" URL because the target is not (currently
or perhaps usually) live (accessible):
>> Because a url created by concat "http://" and the word under point is
>> unlikely to be accessible by a browser.
Admittedly, it says "is unlikely to be accessible", not "is not accessible".
But the subject line of the thread is "... returns invalid urls". Since the
URLs in question are syntactically valid, and people do sometimes refer to
URLs as "invalid" when their targets are not live, I guessed that
inaccessible target was what was meant.
Putting it all together, it's not clear to me just what those who don't like
the current behavior would prefer.
I like the current behavior, so I don't really care what additional
behaviors are offered. I do hope that the current behavior will be the
default, however. In terms of Thi's patch, this means that the new variable
he introduced has the wrong default value, for me (it is also a defvar, not
a defcustom). The current behavior is better.
What alternative behavior is being requested for each of the following cases
(text under cursor). Return nil? Return the text as is? Return the text with
http:// prepended unless there is already a URL scheme? (The currently
returned text is indicated in parens, when it differs from what is at
point.) Assume that http://nosuchlivetarget does not point to a live target
(now or usually).
a. nosuchlivetarget (http://nosuchlivetarget)
b. http://nosuchlivetarget
c. www.google.com (http:/www.google.com)
d. http://www.google.com
Under the two interpretations above, the result would be #1, #2:
1. "valid" meaning has valid URL syntax that includes a scheme: (a) nil, (b)
http://nosuchlivetarget, (c) nil (d) http://www.google.com.
2. "valid" meaning has a live target (either now or usually): (a) nil, (b)
nil, (c) http:/www.google.com, (d) http:/www.google.com.
3. Stefan's criterion is "likely to be meant as a URL". That might give the
same result as #2, but he rejected link testing as the means. Perhaps,
depending on the heuristic used, the result he expects is this: (a) nil, (b)
http://nosuchlivetarget, (c) http://www.google.com, (d)
http://www.google.com. One could argue that both (b) and (c) are likely to
be meant as URLs. Dunno what the heuristic would be.
4. Thi's patch (with new variable = nil default value) gives this: (a)
nosuchlivetarget, (b) http://nosuchlivetarget, (c) www.google.com, (d)
http://www.google.com.
Thi's patch doesn't seem to fit the OP, regardless of interpretation, since
it returns nil only if the thing at point is not even a simple URL (without
scheme) - for example, when point is over whitespace or punctuation. The OP
clearly wanted nil for "something" (whatever the reason - whether no URL
scheme or inaccessible target).
So what alternative behavior do people want?
next prev parent reply other threads:[~2007-08-31 23:57 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-08-30 7:15 [sdl.web@gmail.com: 23.0.0; (thing-at-point 'url) returns invalid urls] Richard Stallman
2007-08-31 8:32 ` Glenn Morris
2007-08-31 14:42 ` Stefan Monnier
2007-08-31 16:18 ` Drew Adams
2007-08-31 20:27 ` Stefan Monnier
2007-08-31 20:34 ` Drew Adams
2007-08-31 21:35 ` Thien-Thi Nguyen
2007-08-31 23:57 ` Drew Adams [this message]
2007-09-01 19:13 ` Johannes Weiner
2007-09-01 19:59 ` Leo
2007-09-01 20:04 ` Johannes Weiner
2007-09-01 1:57 ` Leo
2007-09-01 16:39 ` Drew Adams
2007-09-01 20:57 ` Leo
2007-09-02 6:39 ` David Kastrup
2007-09-02 19:20 ` Glenn Morris
2007-09-04 22:37 ` Davis Herring
2007-09-03 20:51 ` Stefan Monnier
2007-09-04 22:40 ` Davis Herring
2007-09-01 4:06 ` Richard Stallman
2007-09-01 21:00 ` (thing-at-point 'defun) always returns NIL (was: [sdl.web@gmail.com: 23.0.0; (thing-at-point 'url) returns invalid urls]) Leo
2007-09-01 21:41 ` (thing-at-point 'defun) always returns NIL (was:[sdl.web@gmail.com: " Drew Adams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=BNELLINCGFJLDJIKDGACIEPMCBAA.drew.adams@oracle.com \
--to=drew.adams@oracle.com \
--cc=emacs-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.