From 58967d4ba4497a5c2656c01ee4b5b3088cb628d2 Mon Sep 17 00:00:00 2001 From: morioka Date: Sun, 14 Feb 1999 15:00:22 +0000 Subject: [PATCH] (file-name-sans-extension): New function . --- poe.el | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/poe.el b/poe.el index 0e77846..5fdbdcc 100644 --- a/poe.el +++ b/poe.el @@ -220,6 +220,19 @@ The value is actually the element of LIST whose cdr equals KEY." (setq list (cdr list))) )) +(defun-maybe 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)))) + (defmacro-maybe make-local-hook (hook)) ;; They are not Emacs features -- 1.7.10.4