This patch adds a safe way to set a filename's extension. It sanitizes the input so that both these cases do the expected thing: ELISP> (file-name-set-extension "jack.scss" "css") "jack.css" ELISP> (file-name-set-extension "jack.scss" ".css") "jack.css" Note that if we're trying to be safe with errors, nils, and empty strings, it's not sufficient to just `(concat (file-name-sans-extension file) "." extension)`. Cheers!