* way to get the file name except the extension
@ 2009-02-05 5:09 Kiwon Um
2009-02-05 6:03 ` Xah Lee
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Kiwon Um @ 2009-02-05 5:09 UTC (permalink / raw
To: help-gnu-emacs
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? :)
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: way to get the file name except the extension
2009-02-05 5:09 way to get the file name except the extension Kiwon Um
@ 2009-02-05 6:03 ` Xah Lee
2009-02-05 6:45 ` Kiwon Um
2009-02-05 7:27 ` way to get the file name except the extension Johan Andersson
2009-02-05 8:21 ` Sebastian Tennant
2 siblings, 1 reply; 6+ messages in thread
From: Xah Lee @ 2009-02-05 6:03 UTC (permalink / raw
To: help-gnu-emacs
On Feb 4, 9:09 pm, Kiwon Um <um.ki...@gmail.com> 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/
☄
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: way to get the file name except the extension
2009-02-05 6:03 ` Xah Lee
@ 2009-02-05 6:45 ` Kiwon Um
2009-02-05 9:11 ` Time-related functions [Was: way to get the file name except the extension] Juanma Bellón
0 siblings, 1 reply; 6+ messages in thread
From: Kiwon Um @ 2009-02-05 6:45 UTC (permalink / raw
To: help-gnu-emacs
On 2월5일, 오후3시03분, Xah Lee <xah...@gmail.com> wrote:
> On Feb 4, 9:09 pm, Kiwon Um <um.ki...@gmail.com> 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/
>
> ☄
Thanks. It really works well. :
(file-name-sans-extension (buffer-name))
P.s. Is there any good reference point of the manual to manipulate the
time related strings, time, date, month, year, etc, like file name?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: way to get the file name except the extension
2009-02-05 5:09 way to get the file name except the extension Kiwon Um
2009-02-05 6:03 ` Xah Lee
@ 2009-02-05 7:27 ` Johan Andersson
2009-02-05 8:21 ` Sebastian Tennant
2 siblings, 0 replies; 6+ messages in thread
From: Johan Andersson @ 2009-02-05 7:27 UTC (permalink / raw
To: Kiwon Um; +Cc: help-gnu-emacs
[-- Attachment #1: Type: text/plain, Size: 308 bytes --]
(file-name-sans-extension (buffer-name))
On Thu, Feb 5, 2009 at 6:09 AM, Kiwon Um <um.kiwon@gmail.com> 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? :)
>
[-- Attachment #2: Type: text/html, Size: 598 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: way to get the file name except the extension
2009-02-05 5:09 way to get the file name except the extension Kiwon Um
2009-02-05 6:03 ` Xah Lee
2009-02-05 7:27 ` way to get the file name except the extension Johan Andersson
@ 2009-02-05 8:21 ` Sebastian Tennant
2 siblings, 0 replies; 6+ messages in thread
From: Sebastian Tennant @ 2009-02-05 8:21 UTC (permalink / raw
To: help-gnu-emacs
Quoth Kiwon Um <um.kiwon@gmail.com>:
> Hello. I'm a newbie to elisp.
Welcome. You will never look back :)
> I'm wondering a built-in function or lisp codes to get the file name
> except the extension from (buffer-name)
Of course.
(file-name-sans-extension (buffer-name))
A quick way to discover commands is to type:
C-h f <first-few-letters> TAB
(C-h = Ctrl h)
so, to find out about file-* commands type:
C-h f file TAB
and keep pressing TAB to cycle through the numerous results in the
pop-up window.
Add some more letters and type TAB again to narrow your search and when
you've found a command you're interested in type RET.
There's also 'M-x apropos'.
(M-x = Alt-x or ESC-x)
Type 'C-h f apropos RET' to learn about the 'apropos' command.
Sebastian
--
Emacs' AlsaPlayer - Music Without Jolts
Lightweight, full-featured and mindful of your idyllic happiness.
http://home.gna.org/eap
^ permalink raw reply [flat|nested] 6+ messages in thread
* Time-related functions [Was: way to get the file name except the extension]
2009-02-05 6:45 ` Kiwon Um
@ 2009-02-05 9:11 ` Juanma Bellón
0 siblings, 0 replies; 6+ messages in thread
From: Juanma Bellón @ 2009-02-05 9:11 UTC (permalink / raw
To: help-gnu-emacs
> P.s. Is there any good reference point of the manual to manipulate the
> time related strings, time, date, month, year, etc, like file name?
In "39 Operating System Interface" there are 3 sections that probably
contain something for you:
* Time of Day: Getting the current time.
* Time Conversion: Converting a time from numeric form to calendrical data,
and vice versa).
* Time Parsing: Converting a time from numeric form to text and vice versa.
Best regards.
--
Juanma
"Having a smoking section in a restaurant is like
having a peeing section in a swimming pool."
-- Edward Burr
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2009-02-05 9:11 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-05 5:09 way to get the file name except the extension Kiwon Um
2009-02-05 6:03 ` Xah Lee
2009-02-05 6:45 ` Kiwon Um
2009-02-05 9:11 ` Time-related functions [Was: way to get the file name except the extension] Juanma Bellón
2009-02-05 7:27 ` way to get the file name except the extension Johan Andersson
2009-02-05 8:21 ` Sebastian Tennant
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.