aboutsummaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorAnders Lindgren2015-10-28 12:13:18 +0100
committerAnders Lindgren2015-10-28 12:13:18 +0100
commite69f7770611d85e130806763a46db7e212bc952f (patch)
tree96bdd02003f21cea72a604d8f14a06ff99cd9744 /doc
parent0392e241b844487261d4dfcccc9a442793e0a868 (diff)
parentcc587a3539612d250d222363b18d15258e33f82a (diff)
downloademacs-e69f7770611d85e130806763a46db7e212bc952f.tar.gz
emacs-e69f7770611d85e130806763a46db7e212bc952f.zip
Merge branch 'master' of /Volumes/HD2/build/emacs-git-ssh
Diffstat (limited to 'doc')
-rw-r--r--doc/lispref/files.texi50
-rw-r--r--doc/lispref/os.texi45
2 files changed, 67 insertions, 28 deletions
diff --git a/doc/lispref/files.texi b/doc/lispref/files.texi
index ca8abe54ace..65a97a46699 100644
--- a/doc/lispref/files.texi
+++ b/doc/lispref/files.texi
@@ -2038,32 +2038,35 @@ forward slash (@samp{/}) character.
2038@node Directory Names 2038@node Directory Names
2039@subsection Directory Names 2039@subsection Directory Names
2040@cindex directory name 2040@cindex directory name
2041@cindex directory file name
2041@cindex file name of directory 2042@cindex file name of directory
2042 2043
2043 A @dfn{directory name} is the name of a directory. A directory is 2044 A @dfn{directory name} is the name of a directory. A directory is
2044actually a kind of file, so it has a file name, which is related to 2045actually a kind of file, so it has a file name (called the
2045the directory name but not identical to it. (This is not quite the 2046@dfn{directory file name}, which is related to the directory name but
2046same as the usual Unix terminology.) These two different names for 2047not identical to it. (This is not quite the same as the usual Unix
2047the same entity are related by a syntactic transformation. On GNU and 2048terminology.) These two different names for the same entity are
2048Unix systems, this is simple: a directory name ends in a slash, 2049related by a syntactic transformation. On GNU and Unix systems, this
2049whereas the directory's name as a file lacks that slash. On MS-DOS 2050is simple: a directory name ends in a slash, whereas the directory
2050the relationship is more complicated. 2051file name lacks that slash. On MS-DOS the relationship is more
2051 2052complicated.
2052 The difference between a directory name and its name as a file is 2053
2054 The difference between directory name and directory file name is
2053subtle but crucial. When an Emacs variable or function argument is 2055subtle but crucial. When an Emacs variable or function argument is
2054described as being a directory name, a file name of a directory is not 2056described as being a directory name, a directory file name is not
2055acceptable. When @code{file-name-directory} returns a string, that is 2057acceptable. When @code{file-name-directory} returns a string, that is
2056always a directory name. 2058always a directory name.
2057 2059
2058 The following two functions convert between directory names and file 2060 The following two functions convert between directory names and
2059names. They do nothing special with environment variable substitutions 2061directory file names. They do nothing special with environment
2060such as @samp{$HOME}, and the constructs @samp{~}, @samp{.} and @samp{..}. 2062variable substitutions such as @samp{$HOME}, and the constructs
2063@samp{~}, @samp{.} and @samp{..}.
2061 2064
2062@defun file-name-as-directory filename 2065@defun file-name-as-directory filename
2063This function returns a string representing @var{filename} in a form 2066This function returns a string representing @var{filename} in a form
2064that the operating system will interpret as the name of a directory. On 2067that the operating system will interpret as the name of a directory (a
2065most systems, this means appending a slash to the string (if it does not 2068directory name). On most systems, this means appending a slash to the
2066already end in one). 2069string (if it does not already end in one).
2067 2070
2068@example 2071@example
2069@group 2072@group
@@ -2074,10 +2077,10 @@ already end in one).
2074@end defun 2077@end defun
2075 2078
2076@defun directory-file-name dirname 2079@defun directory-file-name dirname
2077This function returns a string representing @var{dirname} in a form that 2080This function returns a string representing @var{dirname} in a form
2078the operating system will interpret as the name of a file. On most 2081that the operating system will interpret as the name of a file (a
2079systems, this means removing the final slash (or backslash) from the 2082directory file name). On most systems, this means removing the final
2080string. 2083slash (or backslash) from the string.
2081 2084
2082@example 2085@example
2083@group 2086@group
@@ -2119,6 +2122,13 @@ Don't try concatenating a slash by hand, as in
2119because this is not portable. Always use 2122because this is not portable. Always use
2120@code{file-name-as-directory}. 2123@code{file-name-as-directory}.
2121 2124
2125 To avoid the issues mentioned above, or if the @var{dirname} value
2126might be nil (for example, from an element of @code{load-path}), use:
2127
2128@example
2129(expand-file-name @var{relfile} @var{dirname})
2130@end example
2131
2122 To convert a directory name to its abbreviation, use this 2132 To convert a directory name to its abbreviation, use this
2123function: 2133function:
2124 2134
diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi
index 0160de82086..7050df86a18 100644
--- a/doc/lispref/os.texi
+++ b/doc/lispref/os.texi
@@ -2697,6 +2697,11 @@ watch library. Otherwise, the actions @code{deleted} and
2697(rename-file "/tmp/foo" "/tmp/bla") 2697(rename-file "/tmp/foo" "/tmp/bla")
2698 @result{} Event (35025468 renamed "/tmp/foo" "/tmp/bla") 2698 @result{} Event (35025468 renamed "/tmp/foo" "/tmp/bla")
2699@end group 2699@end group
2700
2701@group
2702(delete-file "/tmp/bla")
2703 @result{} Event (35025468 deleted "/tmp/bla")
2704@end group
2700@end example 2705@end example
2701@end defun 2706@end defun
2702 2707
@@ -2718,15 +2723,15 @@ also makes it invalid.
2718 2723
2719@example 2724@example
2720@group 2725@group
2721(setq desc (file-notify-add-watch 2726(make-directory "/tmp/foo")
2722 "/tmp/foo" '(change) 'my-notify-callback)) 2727 @result{} nil
2723 @result{} 35025468
2724@end group 2728@end group
2725 2729
2726@group 2730@group
2727(write-region "foo" nil "/tmp/foo") 2731(setq desc
2728 @result{} Event (35025468 created "/tmp/foo") 2732 (file-notify-add-watch
2729 Event (35025468 changed "/tmp/foo") 2733 "/tmp/foo" '(change) 'my-notify-callback))
2734 @result{} 35025468
2730@end group 2735@end group
2731 2736
2732@group 2737@group
@@ -2735,8 +2740,32 @@ also makes it invalid.
2735@end group 2740@end group
2736 2741
2737@group 2742@group
2738(delete-file "/tmp/foo") 2743(write-region "bla" nil "/tmp/foo/bla")
2739 @result{} Event (35025468 deleted "/tmp/foo") 2744 @result{} Event (35025468 created "/tmp/foo/.#bla")
2745 Event (35025468 created "/tmp/foo/bla")
2746 Event (35025468 changed "/tmp/foo/bla")
2747 Event (35025468 changed "/tmp/foo/.#bla")
2748@end group
2749
2750@group
2751;; Deleting a file in the directory doesn't invalidate the watch.
2752(delete-file "/tmp/foo/bla")
2753 @result{} Event (35025468 deleted "/tmp/foo/bla")
2754@end group
2755
2756@group
2757(write-region "bla" nil "/tmp/foo/bla")
2758 @result{} Event (35025468 created "/tmp/foo/.#bla")
2759 Event (35025468 created "/tmp/foo/bla")
2760 Event (35025468 changed "/tmp/foo/bla")
2761 Event (35025468 changed "/tmp/foo/.#bla")
2762@end group
2763
2764@group
2765;; Deleting the directory invalidates the watch.
2766(delete-directory "/tmp/foo" 'recursive)
2767 @result{} Event (35025468 deleted "/tmp/foo/bla")
2768 Event (35025468 deleted "/tmp/foo")
2740 Event (35025468 stopped "/tmp/foo") 2769 Event (35025468 stopped "/tmp/foo")
2741@end group 2770@end group
2742 2771