Closed akoehn closed 8 years ago
I don't think it should return backup files. It uses file-name-sans-versions
, so the versions should not be there. You mean they are? Can you provide an example?
Sure: (f-ext? "foo.md~" "md")
yields t.
As far as I can see, f-ext
does not use file-name-sans-versions
but is a wrapper forfile-name-extension
and f-ext?
uses f-ext
, propagating this behaviour.
Sure:
(f-ext? "foo.md~" "md")
yields t.
I'm not really sure what I like best here. Outside of Emacs it would make sense to return nil
, but inside Emacs maybe it does make sense to return t
as the backup files are special. Not sure where I stand on this really... 😕
The function file-name-extension
uses file-name-sans-versions
in turn.
I would keep it as is, since you can easily use s-ends-with
if you are interested in the exact ending.
the doc string of file-name-extension
contains this:
The extension, in a file name, is the part that follows the last ‘.’, excluding version numbers and backup suffixes
You could add that to the documentation and maybe also add a pointer to s-ends-with
if the user wants a different behaviour. If you are using f
, you already require s
.
Closing in favour of https://github.com/rejeep/f.el/pull/61 @akoehn Can you take a look?
Currently, f-ext is described as follows:
However, it uses
file-name-extension
, which strips version numbers and backup suffixes. It would be nice if that fact could be mentioned as well. I fell for that today, becausewill also return all backup files (ending in "md~")