1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-02-08 20:58:58 +00:00

(file-name-sans-extension): New function.

This commit is contained in:
Richard M. Stallman 1994-09-19 04:32:41 +00:00
parent 64a49ca7b1
commit 20b5d24c26

View File

@ -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."