(file-name-sans-extension): New function <copied from Emacs 20.3.5>.
authormorioka <morioka>
Sun, 14 Feb 1999 15:00:22 +0000 (15:00 +0000)
committermorioka <morioka>
Sun, 14 Feb 1999 15:00:22 +0000 (15:00 +0000)
poe.el

diff --git a/poe.el b/poe.el
index 0e77846..5fdbdcc 100644 (file)
--- 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