>>>> "Hrvoje" == Hrvoje Niksic
<hniksic(a)srce.hr> writes:
Hrvoje> Jens-Ulrik Petersen <petersen(a)kurims.kyoto-u.ac.jp>
Hrvoje> writes:
>
> `file-name-sans-extension' looks like a good thing. Except:
>
> (file-name-sans-extension ".emacs") => ""
>
> which looks like a bug to me?
Hrvoje> It's not a bug in `file-name-sans-extension' (IMHO), but I
Hrvoje> see what you mean...
I beg to differ: I think scsh gets this right
---- from the Scsh manual -----------------------8<--- cut here -------------
(file-name-extension {fname}) -> string Procedure
Return the file-name's extension.
(file-name-extension "main.c") => ".c"
(file-name-extension "main.c.old") => ".old"
(file-name-extension "/usr/shivers") => ""
Weird cases:
(file-name-extension "foo.") => "."
(file-name-extension "foo..") => "."
Dot files are not extensions:
(file-name-extension "/usr/shivers/.login") => ""
(file-name-sans-extension {fname}) -> string Procedure
Return everything but the extension.
(file-name-sans-extension "main.c") => "main"
(file-name-sans-extension "main.c.old") => "main.c"
(file-name-sans-extension "/usr/shivers") => "/usr/shivers"
Weird cases:
(file-name-sans-extension "foo.") => "foo"
(file-name-sans-extension "foo..") => "foo."
Dot files are not extensions:
(file-name-sans-extension "/usr/shivers/.login")
=> "/usr/shivers/.login"
Note that appending the results of `file-name-extension' and
`file-name-sans-extension' in all cases produces the original file-name.
---- End of included text -------------------------8<--- and here -------------
A leading dot should never be considered to be an extension
separator. I can't think of any example where
(file-name-sans-extension ".file") => "" would be useful.
If we can agree on this, I volunteer to send in a patch.
--
Jens-Ulrik Holger Petersen <
http://www.kurims.kyoto-u.ac.jp/~petersen/>
Research Institute for Mathematical Sciences, Kyoto University