# HG changeset patch # User Richard M. Stallman # Date 779949161 0 # Node ID 25d8b804abd3b739d5c2bcf62d6ad4f2c980cc6a # Parent f7de8b4cb1b8989bcdaece71ce9c8fb36766b9f7 (file-name-sans-extension): New function. diff -r f7de8b4cb1b8 -r 25d8b804abd3 lisp/files.el --- a/lisp/files.el Mon Sep 19 00:18:27 1994 +0000 +++ b/lisp/files.el Mon Sep 19 04:32:41 1994 +0000 @@ -1429,6 +1429,19 @@ (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."