🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.bug
Article #87876

file-name-sans-extension

#87876
From: Kevin Rodgers
Date: Mon, 22 Aug 1994 21:37
22 lines
1607 bytes
Mightn't it be useful to provide `file-name-sans-extension' as an
analogue to `file-name-sans-versions'?  Here's a simple implementation
that works for Unix:

(defun file-name-sans-extension (filename)
  "Return FILENAME sans final extension [Unix only]."
  (let ((match-data (match-data))
	(file (file-name-nondirectory filename))
	directory)
    (unwind-protect
	(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)
      (store-match-data match-data))))
-- 
Kevin Rodgers <kevinr@ihs.com>		Project Engineer
Information Handling Services		Electronic Systems Development
15 Inverness Way East, M/S A203		
Englewood CO 80112 USA			(303) 397-2807[voice]/-2620[fax]
Technical Details
Message-ID: <9408222129.AA15941@airedale.ihsyp>
Path: arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!redstone.interpath.net!ddsw1!panix!MathWorks.Com!europa.eng.gtefsd.com!howland.reston.ans.net!math.ohio-state.edu!cis.ohio-state.edu!airedale.ai.mit.EDU!kevinr

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fb2f1,1382cc466d09826f,start
X-Google-Attributes: gidfb2f1,public
X-Google-ArrivalTime: 1994-08-22 15:33:37 PST
Path: arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!redstone.interpath.net!ddsw1!panix!MathWorks.Com!europa.eng.gtefsd.com!howland.reston.ans.net!math.ohio-state.edu!cis.ohio-state.edu!airedale.ai.mit.EDU!kevinr
From: kevinr@airedale.ai.mit.EDU (Kevin Rodgers)
Newsgroups: gnu.emacs.bug
Subject: file-name-sans-extension
Date: 22 Aug 1994 17:37:14 -0400
Organization: GNUs Not Usenet
Lines: 22
Sender: daemon@cis.ohio-state.edu
Approved: bug-gnu-emacs@prep.ai.mit.edu
Distribution: gnu
Message-ID: <9408222129.AA15941@airedale.ihsyp>
Reply-To: Kevin Rodgers <kevinr@ihs.com>