comparison lispref/files.texi @ 40188:cd1cd95ca64e

(File Name Components): Update the description of file-name-sans-extension and file-name-extension.
author Eli Zaretskii <eliz@gnu.org>
date Mon, 22 Oct 2001 16:12:55 +0000
parents 416c492df7c3
children 87962bf716e3
comparison
equal deleted inserted replaced
40187:85c9805cd237 40188:cd1cd95ca64e
1502 @end defun 1502 @end defun
1503 1503
1504 @defun file-name-sans-extension filename 1504 @defun file-name-sans-extension filename
1505 This function returns @var{filename} minus its ``extension,'' if any. 1505 This function returns @var{filename} minus its ``extension,'' if any.
1506 The extension, in a file name, is the part that starts with the last 1506 The extension, in a file name, is the part that starts with the last
1507 @samp{.} in the last name component. For example, 1507 @samp{.} in the last name component, except if that @samp{.} is the
1508 first character of the file name's last component. For example,
1508 1509
1509 @example 1510 @example
1510 (file-name-sans-extension "foo.lose.c") 1511 (file-name-sans-extension "foo.lose.c")
1511 @result{} "foo.lose" 1512 @result{} "foo.lose"
1512 (file-name-sans-extension "big.hack/foo") 1513 (file-name-sans-extension "big.hack/foo")
1513 @result{} "big.hack/foo" 1514 @result{} "big.hack/foo"
1515 (file-name-sans-extension "/my/home/.emacs")
1516 @result{} "/my/home.emacs"
1517 (file-name-sans-extension "/my/home/.emacs.el")
1518 @result{} "/my/home/.emacs"
1514 @end example 1519 @end example
1515 @end defun 1520 @end defun
1516 1521
1517 @ignore 1522 @ignore
1518 Andrew Innes says that this 1523 Andrew Innes says that this
1531 @end ignore 1536 @end ignore
1532 1537
1533 @defun file-name-extension filename &optional period 1538 @defun file-name-extension filename &optional period
1534 This function returns @var{filename}'s final ``extension,'' if any, 1539 This function returns @var{filename}'s final ``extension,'' if any,
1535 after applying @code{file-name-sans-versions} to remove any 1540 after applying @code{file-name-sans-versions} to remove any
1536 version/backup part. If @var{period} is non-nil, then the returned 1541 version/backup part. It returns @code{nil} for extensionless file
1537 value includes the period that delimits the extension, and if 1542 names such as @file{foo}. If @var{period} is non-nil, then the
1538 @var{filename} has no extension, the value is @code{""}. 1543 returned value includes the period that delimits the extension, and if
1544 @var{filename} has no extension, the value is @code{""}. If the last
1545 component of a file name begins with a @samp{.}, that @samp{.} doesn't
1546 count as the beginning of an extension, so, for example,
1547 @file{.emacs}'s ``extension'' is @code{nil}, not @samp{.emacs}.
1539 @end defun 1548 @end defun
1540 1549
1541 @node Directory Names 1550 @node Directory Names
1542 @comment node-name, next, previous, up 1551 @comment node-name, next, previous, up
1543 @subsection Directory Names 1552 @subsection Directory Names