help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: way to get the file name except the extension


From: Xah Lee
Subject: Re: way to get the file name except the extension
Date: Wed, 4 Feb 2009 22:03:19 -0800 (PST)
User-agent: G2/1.0

On Feb 4, 9:09 pm, Kiwon Um <address@hidden> wrote:
> Hello. I'm a newbie to elisp.
>
> I'm wondering a built-in function or lisp codes to get the file name
> except the extension from (buffer-name):
> TestCode.cpp -> TestCode
>
> Any advise? :)

easy.

you want file-name-sans-extension and file-name-nondirectory.

of langs i know that i've used extensively for processing file and dir
names, namely Python and Perl, none comes as easy to use as the funcs
provided in elisp.

you can get file dir name, file name, file suffix, strip suffix,
create dir including non existing parent dir, convert from full path
to relative path, etc, all built in in elisp with a simple function.

• File Names - GNU Emacs Lisp Reference Manual
  http://xahlee.org/elisp/File-Names.html

  Xah
∑ http://xahlee.org/

reply via email to

[Prev in Thread] Current Thread [Next in Thread]