From 20b5d24c260c2f8d1afcfbabf3e3c1fd27e1fbcf Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Mon, 19 Sep 1994 04:32:41 +0000 Subject: [PATCH] (file-name-sans-extension): New function. --- lisp/files.el | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lisp/files.el b/lisp/files.el index 085682a05a7..bfc4abafa3e 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -1429,6 +1429,19 @@ we do not remove backup version numbers, only true file version numbers." (string-match "~\\'" name) (length name)))))))) +(defun file-name-sans-extension (filename) + "Return FILENAME sans final \"extension\". +The extension, in a file name, is the part that follows the last `.'." + (save-match-data + (let ((file (file-name-sans-versions (file-name-nondirectory filename))) + directory) + (if (string-match "\\.[^.]*\\'" file) + (if (setq directory (file-name-directory filename)) + (expand-file-name (substring file 0 (match-beginning 0)) + directory) + (substring file 0 (match-beginning 0))) + filename)))) + (defun make-backup-file-name (file) "Create the non-numeric backup file name for FILE. This is a separate function so you can redefine it for customization." -- 2.39.5