From: Glenn Morris <rgm@gnu.org>
To: Mohammed Sadiq <sadiq@sadiqpk.org>
Cc: 28258@debbugs.gnu.org
Subject: bug#28258: 26.0.50; [PATCH] Let file-name-base succeed when buffer-file-name is nil
Date: Tue, 29 Aug 2017 11:54:55 -0400 [thread overview]
Message-ID: <yg1snugyi8.fsf@fencepost.gnu.org> (raw)
In-Reply-To: <87k21o8m8x.fsf@rose> (Mohammed Sadiq's message of "Mon, 28 Aug 2017 07:52:22 +0530")
Mohammed Sadiq wrote:
> * lisp/files.el (file-name-base): Don't fail when buffer-file-name
> is nil.
[...]
> --- a/lisp/files.el
> +++ b/lisp/files.el
> @@ -4467,8 +4467,9 @@ file-name-extension
> (defun file-name-base (&optional filename)
> "Return the base name of the FILENAME: no directory, no extension.
> FILENAME defaults to `buffer-file-name'."
> - (file-name-sans-extension
> - (file-name-nondirectory (or filename (buffer-file-name)))))
> + (let ((filename (or filename (buffer-file-name))))
> + (and filename
> + (file-name-sans-extension (file-name-nondirectory filename)))))
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?
next prev parent reply other threads:[~2017-08-29 15:54 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-28 2:22 bug#28258: 26.0.50; [PATCH] Let file-name-base succeed when buffer-file-name is nil Mohammed Sadiq
2017-08-29 15:54 ` Glenn Morris [this message]
2017-08-29 16:10 ` Mohammed Sadiq
2017-08-29 17:02 ` Glenn Morris
2017-09-18 17:12 ` Philipp Stephani
2017-09-19 0:41 ` Glenn Morris
2017-09-19 8:31 ` Philipp Stephani
2017-09-19 8:46 ` Philipp Stephani
2017-09-24 8:07 ` Philipp Stephani
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=yg1snugyi8.fsf@fencepost.gnu.org \
--to=rgm@gnu.org \
--cc=28258@debbugs.gnu.org \
--cc=sadiq@sadiqpk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.