Subject: bug#28258: 26.0.50; [PATCH] Let file-name-base succeed when buffer-file-name is nil

From: Mohammed Sadiq <[email-masked]>
Date: Tue, 29 Aug 2017 21:40:31 +0530 (IST)

> On August 29, 2017 at 9:24 PM Glenn Morris <[email-masked]> wrote:

> Hi, and thanks for the patch.
> IIUC: file-name-base currently errors when called with no applicable
> file name, and you want it to instead return nil? This seems rather
> unusual for an Emacs file-related function. I would have thought this
> unlikely to be applied, but maybe you could explain why you want it?

The signature of `file-name-base' is (file-name-base &optional FILENAME).
That is, the FILENAME argument is optional. So I believe it shouldn't
be an error to not give the optional argument. And so calling the function
in a buffer with no file associated shouldn't be an error. I'm not sure
if my assertion is right.

Feel free to do what it is felt to be right. :)