rejeep / f.el

Modern API for working with files and directories in Emacs
GNU General Public License v3.0
680 stars 68 forks source link

Adds f-swap-ext #38

Closed phillord closed 9 years ago

phillord commented 9 years ago

Given a file name, replaces the extension with another.

I might be the only person in the world to need this, but I (would) use this a lot. Not sure if I have done the readme properly.

coveralls commented 9 years ago

Coverage Status

Coverage increased (+0.04%) to 97.45% when pulling 5da30e0e19584bfbdfb69de5638c26fdab2f5670 on phillord:feature/swap-extension into 7c675dd0d4396bbb3b0c77cd37da9a2b52500dc0 on rejeep:master.

coveralls commented 9 years ago

Coverage Status

Coverage increased (+0.04%) to 97.45% when pulling 5da30e0e19584bfbdfb69de5638c26fdab2f5670 on phillord:feature/swap-extension into 7c675dd0d4396bbb3b0c77cd37da9a2b52500dc0 on rejeep:master.

rejeep commented 9 years ago

I don't like the "empty" case here. The name of the function is to "swap the extension", so I think the API should require another. To remove the extension, simply use f-no-ext.

phillord commented 9 years ago

In a sense, I agree with you. However, I didn't like

 (f-swap-ext "hello.txt" ""); => "hello."

either. For me, this result is counter intuitive also, as a "." at the end of the a file name appears broken (even if it is technically valid). And it seemed to me that both swapping and removing an extension is a reasonable thing to want to do a number of paths in a single operation.

I'm not totally attached to it, though, and is not necessary for my use case. If you would prefer an error condition with "" or nil, I can stick that it. Silently removing the extension with a "." I would dislike.

coveralls commented 9 years ago

Coverage Status

Coverage increased (+0.04%) to 97.45% when pulling dde676d3e404659826e80ccff153d02076497fe0 on phillord:feature/swap-extension into 7c675dd0d4396bbb3b0c77cd37da9a2b52500dc0 on rejeep:master.

coveralls commented 9 years ago

Coverage Status

Coverage increased (+0.04%) to 97.45% when pulling dde676d3e404659826e80ccff153d02076497fe0 on phillord:feature/swap-extension into 7c675dd0d4396bbb3b0c77cd37da9a2b52500dc0 on rejeep:master.

phillord commented 9 years ago

Added this now. And fixed the tests which weren't testing!

rejeep commented 9 years ago

Could you also update the docs!?

phillord commented 9 years ago

oops

Johan Andersson notifications@github.com writes:

Could you also update the docs!?


Reply to this email directly or view it on GitHub: https://github.com/rejeep/f.el/pull/38#issuecomment-73237696

Phillip Lord, Phone: +44 (0) 191 208 7827 Lecturer in Bioinformatics, Email: phillip.lord@newcastle.ac.uk School of Computing Science, http://homepages.cs.ncl.ac.uk/phillip.lord Room 914 Claremont Tower, skype: russet_apples Newcastle University, twitter: phillord NE1 7RU

coveralls commented 9 years ago

Coverage Status

Coverage increased (+0.04%) to 97.45% when pulling a10c3ccf4936905142e118d3e7604ba447302251 on phillord:feature/swap-extension into 7c675dd0d4396bbb3b0c77cd37da9a2b52500dc0 on rejeep:master.

phillord commented 9 years ago

Bump!

rejeep commented 9 years ago

Thanks, merged! Skipped updating the version number though as I will release v0.18 soon.