|
|
The (thing-at-point 'filename) does not consider parenthesis as part
of the file name.
Should it consider paren as part of the file name?
Detail:
Today, many file name may contain parenthesis.
In particular, i think Wikipedia is starting to use paren extensively
in its files.
e.g.
http://en.wikipedia.org/wiki/Image:Hypatia_(Charles_William_Mitchell).jpg
en.wikipedia.org/wiki/Haskell_">http://en.wikipedia.org/wiki/Haskell_(programming_language)
and most other programing langs will have a url name something like
“xyz_(programming_language)”
So, whene these files are saved to disk, e.g.
Hypatia_(Charles_William_Mitchell).jpg
then (thing-at-point 'filename) will fail because it considers paren
as a boundary.
Here's a quick test code:
(defun xx ()
"test"
(interactive)
(let
(img-file-path bounds myResult)
(setq img-file-path (thing-at-point 'filename))
(setq bounds (bounds-of-thing-at-point 'filename))
(setq myResult (file-name-nondirectory img-file-path))
(insert myResult)
))
test it by putting cursor on the following line and call xx.
Hypatia_(Charles_William_Mitchell).jpg
So, i guess the question is whether it occures more often where paren
is part of the file name, or paren is the delimiter of a text that
contains the file name.
What do you guys think?
------------------------------
also, would it be a good idea to add “double-quoted-text” and “single-
quoted-text” to part of the thing collection for thing-at-point?
-- Function: thing-at-point thing
Return the THING around or next to point, as a string.
The argument THING is a symbol which specifies a kind of
syntactic
entity. Possibilities include `symbol', `list', `sexp', `defun',
`filename', `url', `word', `sentence', `whitespace', `line',
`page', and others.
Xah
∑ xahlee.org/">http://xahlee.org/
☄
|
|