[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lispref/files.texi
From: |
Richard M. Stallman |
Subject: |
[Emacs-diffs] Changes to emacs/lispref/files.texi |
Date: |
Sun, 19 Feb 2006 23:39:55 +0000 |
Index: emacs/lispref/files.texi
diff -u emacs/lispref/files.texi:1.89 emacs/lispref/files.texi:1.90
--- emacs/lispref/files.texi:1.89 Mon Feb 6 11:55:09 2006
+++ emacs/lispref/files.texi Sun Feb 19 23:39:55 2006
@@ -1770,6 +1770,32 @@
@end example
@end defun
+ Given a possibly relative file name, you can convert it to an
+absolute name using @code{expand-file-name} (@pxref{File Name
+Expansion}). This function converts absolute file names to relative
+names:
+
address@hidden file-relative-name filename &optional directory
+This function tries to return a relative name that is equivalent to
address@hidden, assuming the result will be interpreted relative to
address@hidden (an absolute directory name or directory file name).
+If @var{directory} is omitted or @code{nil}, it defaults to the
+current buffer's default directory.
+
+On some operating systems, an absolute file name begins with a device
+name. On such systems, @var{filename} has no relative equivalent based
+on @var{directory} if they start with two different device names. In
+this case, @code{file-relative-name} returns @var{filename} in absolute
+form.
+
address@hidden
+(file-relative-name "/foo/bar" "/foo/")
+ @result{} "bar"
+(file-relative-name "/foo/bar" "/hack/")
+ @result{} "../foo/bar"
address@hidden example
address@hidden defun
+
@node Directory Names
@comment node-name, next, previous, up
@subsection Directory Names
@@ -1910,16 +1936,13 @@
be expanded. Expansion also simplifies file names by eliminating
redundancies such as @file{./} and @address@hidden/../}.
-In the next two functions, the @var{directory} argument can be either
-a directory name or a directory file name. @xref{Directory Names}.
-
@defun expand-file-name filename &optional directory
This function converts @var{filename} to an absolute file name. If
@var{directory} is supplied, it is the default directory to start with
if @var{filename} is relative. (The value of @var{directory} should
-itself be an absolute directory name; it may start with @samp{~}.)
-Otherwise, the current buffer's value of @code{default-directory} is
-used. For example:
+itself be an absolute directory name or directory file name; it may
+start with @samp{~}.) Otherwise, the current buffer's value of
address@hidden is used. For example:
@example
@group
@@ -1981,27 +2004,6 @@
indirect calls to @code{expand-file-name}. @xref{Truenames}.
@end defun
address@hidden Emacs 19 feature
address@hidden file-relative-name filename &optional directory
-This function does the inverse of expansion---it tries to return a
-relative name that is equivalent to @var{filename} when interpreted
-relative to @var{directory}. If @var{directory} is omitted or
address@hidden, it defaults to the current buffer's default directory.
-
-On some operating systems, an absolute file name begins with a device
-name. On such systems, @var{filename} has no relative equivalent based
-on @var{directory} if they start with two different device names. In
-this case, @code{file-relative-name} returns @var{filename} in absolute
-form.
-
address@hidden
-(file-relative-name "/foo/bar" "/foo/")
- @result{} "bar"
-(file-relative-name "/foo/bar" "/hack/")
- @result{} "../foo/bar"
address@hidden example
address@hidden defun
-
@defvar default-directory
The value of this buffer-local variable is the default directory for the
current buffer. It should be an absolute directory name; it may start