diff options
| author | Richard M. Stallman | 1994-09-19 04:32:41 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 1994-09-19 04:32:41 +0000 |
| commit | 20b5d24c260c2f8d1afcfbabf3e3c1fd27e1fbcf (patch) | |
| tree | d9c06e40f17f5b1f80dee895dab38dfed83ea3c9 | |
| parent | 64a49ca7b18fd0791a14bb02a2ac8ce082511fb8 (diff) | |
| download | emacs-20b5d24c260c2f8d1afcfbabf3e3c1fd27e1fbcf.tar.gz emacs-20b5d24c260c2f8d1afcfbabf3e3c1fd27e1fbcf.zip | |
(file-name-sans-extension): New function.
| -rw-r--r-- | lisp/files.el | 13 |
1 files changed, 13 insertions, 0 deletions
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." | |||
| 1429 | (string-match "~\\'" name) | 1429 | (string-match "~\\'" name) |
| 1430 | (length name)))))))) | 1430 | (length name)))))))) |
| 1431 | 1431 | ||
| 1432 | (defun file-name-sans-extension (filename) | ||
| 1433 | "Return FILENAME sans final \"extension\". | ||
| 1434 | The extension, in a file name, is the part that follows the last `.'." | ||
| 1435 | (save-match-data | ||
| 1436 | (let ((file (file-name-sans-versions (file-name-nondirectory filename))) | ||
| 1437 | directory) | ||
| 1438 | (if (string-match "\\.[^.]*\\'" file) | ||
| 1439 | (if (setq directory (file-name-directory filename)) | ||
| 1440 | (expand-file-name (substring file 0 (match-beginning 0)) | ||
| 1441 | directory) | ||
| 1442 | (substring file 0 (match-beginning 0))) | ||
| 1443 | filename)))) | ||
| 1444 | |||
| 1432 | (defun make-backup-file-name (file) | 1445 | (defun make-backup-file-name (file) |
| 1433 | "Create the non-numeric backup file name for FILE. | 1446 | "Create the non-numeric backup file name for FILE. |
| 1434 | This is a separate function so you can redefine it for customization." | 1447 | This is a separate function so you can redefine it for customization." |