aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/lispref/ChangeLog27
-rw-r--r--doc/lispref/backups.texi14
-rw-r--r--doc/lispref/commands.texi27
-rw-r--r--doc/lispref/compile.texi63
-rw-r--r--doc/lispref/customize.texi18
-rw-r--r--doc/lispref/elisp.texi3
-rw-r--r--doc/lispref/files.texi499
-rw-r--r--doc/lispref/minibuf.texi6
-rw-r--r--doc/lispref/variables.texi21
-rw-r--r--etc/NEWS7
10 files changed, 373 insertions, 312 deletions
diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog
index 124ee8fe1dd..454e716a5bf 100644
--- a/doc/lispref/ChangeLog
+++ b/doc/lispref/ChangeLog
@@ -1,3 +1,30 @@
12014-01-05 Chong Yidong <cyd@gnu.org>
2
3 * backups.texi (Making Backups): Document backup-buffer change.
4
5 * files.texi (Visiting Files): Copyedits.
6 (Testing Accessibility): Mention ACLs. Move file-modes here from
7 File Attributes.
8 (Truenames): Move file-equal-p here from Kinds of Files.
9 (File Attributes): Move file-newer-than-file-p here from Testing
10 Accessibility.
11 (Extended Attributes): New node. Add file-extended-attributes.
12 (Changing Files): Document set-file-extended-attributes.
13
14 * commands.texi (Defining Commands): Document the interactive-form
15 property more carefully. Document interactive-only.
16
17 * compile.texi (Compiler Errors): Copyedits. Note that the
18 details for byte-compile-warnings are in its docstring.
19
20 * minibuf.texi (Minibuffer Contents): Remove obsolete function
21 minibuffer-completion-contents.
22
23 * variables.texi (Defining Variables): Note that defvar acts
24 always on the dynamic value.
25
26 * customize.texi (Variable Definitions): Likewise.
27
12014-01-05 Paul Eggert <eggert@cs.ucla.edu> 282014-01-05 Paul Eggert <eggert@cs.ucla.edu>
2 29
3 Document vconcat and the empty vector (Bug#16246). 30 Document vconcat and the empty vector (Bug#16246).
diff --git a/doc/lispref/backups.texi b/doc/lispref/backups.texi
index ac3a81931c1..83ffb2f95e4 100644
--- a/doc/lispref/backups.texi
+++ b/doc/lispref/backups.texi
@@ -57,13 +57,15 @@ buffer, if appropriate. It is called by @code{save-buffer} before
57saving the buffer the first time. 57saving the buffer the first time.
58 58
59If a backup was made by renaming, the return value is a cons cell of 59If a backup was made by renaming, the return value is a cons cell of
60the form (@var{modes} @var{context} @var{backupname}), where 60the form (@var{modes} @var{extra-alist} @var{backupname}), where
61@var{modes} are the mode bits of the original file, as returned by 61@var{modes} are the mode bits of the original file, as returned by
62@code{file-modes} (@pxref{File Attributes,, Other Information about 62@code{file-modes} (@pxref{Testing Accessibility}), @var{extra-alist}
63Files}), @var{context} is a list describing the original file's 63is an alist describing the original file's extended attributes, as
64SELinux context (@pxref{File Attributes}), and @var{backupname} is the 64returned by @code{file-extended-attributes} (@pxref{Extended
65name of the backup. In all other cases, that is, if a backup was made 65Attributes}), and @var{backupname} is the name of the backup.
66by copying or if no backup was made, this function returns @code{nil}. 66
67In all other cases (i.e., if a backup was made by copying or if no
68backup was made), this function returns @code{nil}.
67@end defun 69@end defun
68 70
69@defvar buffer-backed-up 71@defvar buffer-backed-up
diff --git a/doc/lispref/commands.texi b/doc/lispref/commands.texi
index a118e9132a3..f9476e5e34c 100644
--- a/doc/lispref/commands.texi
+++ b/doc/lispref/commands.texi
@@ -108,13 +108,26 @@ command does.
108 108
109 The special form @code{interactive} turns a Lisp function into a 109 The special form @code{interactive} turns a Lisp function into a
110command. The @code{interactive} form must be located at top-level in 110command. The @code{interactive} form must be located at top-level in
111the function body (usually as the first form in the body), or in the 111the function body, usually as the first form in the body; this applies
112@code{interactive-form} property of the function symbol. When the 112to both lambda expressions (@pxref{Lambda Expressions}) and
113@code{interactive} form is located in the function body, it does 113@code{defun} forms (@pxref{Defining Functions}). This form does
114nothing when actually executed. Its presence serves as a flag, which 114nothing during the actual execution of the function; its presence
115tells the Emacs command loop that the function can be called 115serves as a flag, telling the Emacs command loop that the function can
116interactively. The argument of the @code{interactive} form controls 116be called interactively. The argument of the @code{interactive} form
117the reading of arguments for an interactive call. 117specifies how the arguments for an interactive call should be read.
118
119@cindex @code{interactive-form} property
120 Alternatively, an @code{interactive} form may be specified in a
121function symbol's @code{interactive-form} property. A non-@code{nil}
122value for this property takes precedence over any @code{interactive}
123form in the function body itself. This feature is seldom used.
124
125@cindex @code{interactive-only} property
126 Sometimes, a named command is only intended to be called
127interactively, never directly from Lisp. In that case, give it a
128non-@code{nil} @code{interactive-only} property. In that case, the
129byte compiler will print a warning message if the command is called
130from Lisp.
118 131
119@menu 132@menu
120* Using Interactive:: General rules for @code{interactive}. 133* Using Interactive:: General rules for @code{interactive}.
diff --git a/doc/lispref/compile.texi b/doc/lispref/compile.texi
index 85c9ac5f73c..fe492df1d94 100644
--- a/doc/lispref/compile.texi
+++ b/doc/lispref/compile.texi
@@ -430,29 +430,35 @@ to what @code{eval-when-compile} does.
430@section Compiler Errors 430@section Compiler Errors
431@cindex compiler errors 431@cindex compiler errors
432 432
433 Byte compilation outputs all errors and warnings into the buffer 433 Error and warning messages from byte compilation are printed in a
434@file{*Compile-Log*}. The messages include file names and line 434buffer named @file{*Compile-Log*}. These messages include file names
435numbers that identify the location of the problem. The usual Emacs 435and line numbers identifying the location of the problem. The usual
436commands for operating on compiler diagnostics work properly on these 436Emacs commands for operating on compiler output can be used on these
437messages. 437messages.
438 438
439 When an error is due to invalid syntax in the program, the byte 439 When an error is due to invalid syntax in the program, the byte
440compiler might get confused about the errors' exact location. One way 440compiler might get confused about the errors' exact location. One way
441to investigate is to switch to the buffer @w{@file{ *Compiler Input*}}. 441to investigate is to switch to the buffer @w{@file{ *Compiler
442(This buffer name starts with a space, so it does not show up in 442Input*}}. (This buffer name starts with a space, so it does not show
443@kbd{M-x list-buffers}.) This buffer contains the program being 443up in the Buffer Menu.) This buffer contains the program being
444compiled, and point shows how far the byte compiler was able to read; 444compiled, and point shows how far the byte compiler was able to read;
445the cause of the error might be nearby. @xref{Syntax Errors}, for 445the cause of the error might be nearby. @xref{Syntax Errors}, for
446some tips for locating syntax errors. 446some tips for locating syntax errors.
447 447
448 When the byte compiler warns about functions that were used but not 448 A common type of warning issued by the byte compiler is for
449defined, it always reports the line number for the end of the file, 449functions and variables that were used but not defined. Such warnings
450not the locations where the missing functions were called. To find 450report the line number for the end of the file, not the locations
451the latter, you must search for the function names. 451where the missing functions or variables were used; to find these, you
452must search the file manually.
452 453
453 You can suppress the compiler warning for calling an undefined 454 If you are sure that a warning message about a missing function or
454function @var{func} by conditionalizing the function call on an 455variable is unjustified, there are several ways to suppress it:
455@code{fboundp} test, like this: 456
457@itemize @bullet
458@item
459You can suppress the warning for a specific call to a function
460@var{func} by conditionalizing it on an @code{fboundp} test, like
461this:
456 462
457@example 463@example
458(if (fboundp '@var{func}) ...(@var{func} ...)...) 464(if (fboundp '@var{func}) ...(@var{func} ...)...)
@@ -463,14 +469,10 @@ The call to @var{func} must be in the @var{then-form} of the
463@code{if}, and @var{func} must appear quoted in the call to 469@code{if}, and @var{func} must appear quoted in the call to
464@code{fboundp}. (This feature operates for @code{cond} as well.) 470@code{fboundp}. (This feature operates for @code{cond} as well.)
465 471
466 You can tell the compiler that a function is defined using 472@item
467@code{declare-function} (@pxref{Declaring Functions}). Likewise, you 473Likewise, you can suppress the warning for a specific use of a
468can tell the compiler that a variable is defined using @code{defvar} 474variable @var{variable} by conditionalizing it on a @code{boundp}
469with no initial value. 475test:
470
471 You can suppress the compiler warning for a specific use of an
472undefined variable @var{variable} by conditionalizing its use on a
473@code{boundp} test, like this:
474 476
475@example 477@example
476(if (boundp '@var{variable}) ...@var{variable}...) 478(if (boundp '@var{variable}) ...@var{variable}...)
@@ -481,7 +483,17 @@ The reference to @var{variable} must be in the @var{then-form} of the
481@code{if}, and @var{variable} must appear quoted in the call to 483@code{if}, and @var{variable} must appear quoted in the call to
482@code{boundp}. 484@code{boundp}.
483 485
484 You can suppress any and all compiler warnings within a certain 486@item
487You can tell the compiler that a function is defined using
488@code{declare-function}. @xref{Declaring Functions}.
489
490@item
491Likewise, you can tell the compiler that a variable is defined using
492@code{defvar} with no initial value. (Note that this marks the
493variable as special.) @xref{Defining Variables}.
494@end itemize
495
496 You can also suppress any and all compiler warnings within a certain
485expression using the construct @code{with-no-warnings}: 497expression using the construct @code{with-no-warnings}:
486 498
487@c This is implemented with a defun, but conceptually it is 499@c This is implemented with a defun, but conceptually it is
@@ -497,8 +509,9 @@ possible piece of code, to avoid missing possible warnings other than
497one you intend to suppress. 509one you intend to suppress.
498@end defspec 510@end defspec
499 511
500 More precise control of warnings is possible by setting the variable 512 Byte compiler warnings can be controlled more precisely by setting
501@code{byte-compile-warnings}. 513the variable @code{byte-compile-warnings}. See its documentation
514string for details.
502 515
503@node Byte-Code Objects 516@node Byte-Code Objects
504@section Byte-Code Function Objects 517@section Byte-Code Function Objects
diff --git a/doc/lispref/customize.texi b/doc/lispref/customize.texi
index 1e54a7fa444..4b0a0a9ba2c 100644
--- a/doc/lispref/customize.texi
+++ b/doc/lispref/customize.texi
@@ -287,13 +287,17 @@ customizable variable). You should not quote @var{option}.
287 287
288The argument @var{standard} is an expression that specifies the 288The argument @var{standard} is an expression that specifies the
289standard value for @var{option}. Evaluating the @code{defcustom} form 289standard value for @var{option}. Evaluating the @code{defcustom} form
290evaluates @var{standard}, but does not necessarily install the 290evaluates @var{standard}, but does not necessarily bind the option to
291standard value. If @var{option} already has a default value, 291that value. If @var{option} already has a default value, it is left
292@code{defcustom} does not change it. If the user has saved a 292unchanged. If the user has already saved a customization for
293customization for @var{option}, @code{defcustom} installs the user's 293@var{option}, the user's customized value is installed as the default
294customized value as @var{option}'s default value. If neither of those 294value. Otherwise, the result of evaluating @var{standard} is
295cases applies, @code{defcustom} installs the result of evaluating 295installed as the default value.
296@var{standard} as the default value. 296
297Like @code{defvar}, this macro marks @code{option} as a special
298variable, meaning that it should always be dynamically bound. If
299@var{option} is already lexically bound, that lexical binding remains
300in effect until the binding construct exits. @xref{Variable Scoping}.
297 301
298The expression @var{standard} can be evaluated at various other times, 302The expression @var{standard} can be evaluated at various other times,
299too---whenever the customization facility needs to know @var{option}'s 303too---whenever the customization facility needs to know @var{option}'s
diff --git a/doc/lispref/elisp.texi b/doc/lispref/elisp.texi
index 94c06a130b1..9681c3c42a3 100644
--- a/doc/lispref/elisp.texi
+++ b/doc/lispref/elisp.texi
@@ -951,7 +951,8 @@ Information about Files
951* Testing Accessibility:: Is a given file readable? Writable? 951* Testing Accessibility:: Is a given file readable? Writable?
952* Kinds of Files:: Is it a directory? A symbolic link? 952* Kinds of Files:: Is it a directory? A symbolic link?
953* Truenames:: Eliminating symbolic links from a file name. 953* Truenames:: Eliminating symbolic links from a file name.
954* File Attributes:: How large is it? Any other names? Etc. 954* File Attributes:: File sizes, modification times, etc.
955* Extended Attributes:: Extended file attributes for access control.
955* Locating Files:: How to find a file in standard places. 956* Locating Files:: How to find a file in standard places.
956 957
957File Names 958File Names
diff --git a/doc/lispref/files.texi b/doc/lispref/files.texi
index 8f2ca0ccf8d..076c91c0c58 100644
--- a/doc/lispref/files.texi
+++ b/doc/lispref/files.texi
@@ -7,21 +7,21 @@
7@chapter Files 7@chapter Files
8 8
9 This chapter describes the Emacs Lisp functions and variables to 9 This chapter describes the Emacs Lisp functions and variables to
10find, create, view, save, and otherwise work with files and file 10find, create, view, save, and otherwise work with files and
11directories. A few other file-related functions are described in 11directories. A few other file-related functions are described in
12@ref{Buffers}, and those related to backups and auto-saving are 12@ref{Buffers}, and those related to backups and auto-saving are
13described in @ref{Backups and Auto-Saving}. 13described in @ref{Backups and Auto-Saving}.
14 14
15 Many of the file functions take one or more arguments that are file 15 Many of the file functions take one or more arguments that are file
16names. A file name is actually a string. Most of these functions 16names. A file name is a string. Most of these functions expand file
17expand file name arguments by calling @code{expand-file-name}, so that 17name arguments using the function @code{expand-file-name}, so that
18@file{~} is handled correctly, as are relative file names (including 18@file{~} is handled correctly, as are relative file names (including
19@samp{../}). @xref{File Name Expansion}. 19@file{../}). @xref{File Name Expansion}.
20 20
21 In addition, certain @dfn{magic} file names are handled specially. 21 In addition, certain @dfn{magic} file names are handled specially.
22For example, when a remote file name is specified, Emacs accesses the 22For example, when a remote file name is specified, Emacs accesses the
23file over the network via an appropriate protocol (@pxref{Remote 23file over the network via an appropriate protocol. @xref{Remote
24Files,, Remote Files, emacs, The GNU Emacs Manual}). This handling is 24Files,, Remote Files, emacs, The GNU Emacs Manual}. This handling is
25done at a very low level, so you may assume that all the functions 25done at a very low level, so you may assume that all the functions
26described in this chapter accept magic file names as file name 26described in this chapter accept magic file names as file name
27arguments, except where noted. @xref{Magic File Names}, for details. 27arguments, except where noted. @xref{Magic File Names}, for details.
@@ -58,22 +58,21 @@ done, we say that the buffer is @dfn{visiting} that file, and call the
58file ``the visited file'' of the buffer. 58file ``the visited file'' of the buffer.
59 59
60 A file and a buffer are two different things. A file is information 60 A file and a buffer are two different things. A file is information
61recorded permanently in the computer (unless you delete it). A buffer, 61recorded permanently in the computer (unless you delete it). A
62on the other hand, is information inside of Emacs that will vanish at 62buffer, on the other hand, is information inside of Emacs that will
63the end of the editing session (or when you kill the buffer). Usually, 63vanish at the end of the editing session (or when you kill the
64a buffer contains information that you have copied from a file; then we 64buffer). When a buffer is visiting a file, it contains information
65say the buffer is visiting that file. The copy in the buffer is what 65copied from the file. The copy in the buffer is what you modify with
66you modify with editing commands. Such changes to the buffer do not 66editing commands. Changes to the buffer do not change the file; to
67change the file; therefore, to make the changes permanent, you must 67make the changes permanent, you must @dfn{save} the buffer, which
68@dfn{save} the buffer, which means copying the altered buffer contents 68means copying the altered buffer contents back into the file.
69back into the file. 69
70 70 Despite the distinction between files and buffers, people often
71 In spite of the distinction between files and buffers, people often 71refer to a file when they mean a buffer and vice-versa. Indeed, we
72refer to a file when they mean a buffer and vice-versa. Indeed, we say, 72say, ``I am editing a file'', rather than, ``I am editing a buffer
73``I am editing a file'', rather than, ``I am editing a buffer that I 73that I will soon save as a file of the same name''. Humans do not
74will soon save as a file of the same name''. Humans do not usually need 74usually need to make the distinction explicit. When dealing with a
75to make the distinction explicit. When dealing with a computer program, 75computer program, however, it is good to keep the distinction in mind.
76however, it is good to keep the distinction in mind.
77 76
78@menu 77@menu
79* Visiting Functions:: The usual interface functions for visiting. 78* Visiting Functions:: The usual interface functions for visiting.
@@ -507,9 +506,9 @@ Name}).
507@section Reading from Files 506@section Reading from Files
508@cindex reading from files 507@cindex reading from files
509 508
510 You can copy a file from the disk and insert it into a buffer 509 To copy the contents of a file into a buffer, use the function
511using the @code{insert-file-contents} function. Don't use the user-level 510@code{insert-file-contents}. (Don't use the command
512command @code{insert-file} in a Lisp program, as that sets the mark. 511@code{insert-file} in a Lisp program, as that sets the mark.)
513 512
514@defun insert-file-contents filename &optional visit beg end replace 513@defun insert-file-contents filename &optional visit beg end replace
515This function inserts the contents of file @var{filename} into the 514This function inserts the contents of file @var{filename} into the
@@ -769,26 +768,24 @@ for its usual definition is in @file{userlock.el}.
769@section Information about Files 768@section Information about Files
770@cindex file, information about 769@cindex file, information about
771 770
772 The functions described in this section all operate on strings that 771 This section describes the functions for retrieving various types of
773designate file names. With a few exceptions, all the functions have 772information about files (or directories or symbolic links), such as
774names that begin with the word @samp{file}. These functions all 773whether a file is readable or writable, and its size. These functions
775return information about actual files or directories, so their 774all take arguments which are file names. Except where noted, these
776arguments must all exist as actual files or directories unless 775arguments need to specify existing files, or an error is signaled.
777otherwise noted.
778 776
779@cindex file names, trailing whitespace 777@cindex file names, trailing whitespace
780@cindex trailing blanks in file names 778@cindex trailing blanks in file names
781Be careful with file names that end in blanks: some filesystems 779 Be careful with file names that end in spaces. On some filesystems
782(notably, MS-Windows) will ignore trailing whitespace in file names, 780(notably, MS-Windows), trailing whitespace characters in file names
783and return information about the file after stripping those blanks 781are silently and automatically ignored.
784from the name, not about the file whose name you passed to the
785functions described in this section.
786 782
787@menu 783@menu
788* Testing Accessibility:: Is a given file readable? Writable? 784* Testing Accessibility:: Is a given file readable? Writable?
789* Kinds of Files:: Is it a directory? A symbolic link? 785* Kinds of Files:: Is it a directory? A symbolic link?
790* Truenames:: Eliminating symbolic links from a file name. 786* Truenames:: Eliminating symbolic links from a file name.
791* File Attributes:: How large is it? Any other names? Etc. 787* File Attributes:: File sizes, modification times, etc.
788* Extended Attributes:: Extended file attributes for access control.
792* Locating Files:: How to find a file in standard places. 789* Locating Files:: How to find a file in standard places.
793@end menu 790@end menu
794 791
@@ -797,10 +794,16 @@ functions described in this section.
797@cindex accessibility of a file 794@cindex accessibility of a file
798@cindex file accessibility 795@cindex file accessibility
799 796
800 These functions test for permission to access a file in specific 797 These functions test for permission to access a file for reading,
801ways. Unless explicitly stated otherwise, they recursively follow 798writing, or execution. Unless explicitly stated otherwise, they
802symbolic links for their file name arguments, at all levels (at the 799recursively follow symbolic links for their file name arguments, at
803level of the file itself and at all levels of parent directories). 800all levels (at the level of the file itself and at all levels of
801parent directories).
802
803 On some operating systems, more complex sets of access permissions
804can be specified, via mechanisms such as Access Control Lists (ACLs).
805@xref{Extended Attributes}, for how to query and set those
806permissions.
804 807
805@defun file-exists-p filename 808@defun file-exists-p filename
806This function returns @code{t} if a file named @var{filename} appears 809This function returns @code{t} if a file named @var{filename} appears
@@ -810,9 +813,8 @@ true if the file exists and you have execute permission on the
810containing directories, regardless of the permissions of the file 813containing directories, regardless of the permissions of the file
811itself.) 814itself.)
812 815
813If the file does not exist, or if fascist access control policies 816If the file does not exist, or if access control policies prevent you
814prevent you from finding the attributes of the file, this function 817from finding its attributes, this function returns @code{nil}.
815returns @code{nil}.
816 818
817Directories are files, so @code{file-exists-p} returns @code{t} when 819Directories are files, so @code{file-exists-p} returns @code{t} when
818given a directory name. However, symbolic links are treated 820given a directory name. However, symbolic links are treated
@@ -823,24 +825,8 @@ name only if the target file exists.
823@defun file-readable-p filename 825@defun file-readable-p filename
824This function returns @code{t} if a file named @var{filename} exists 826This function returns @code{t} if a file named @var{filename} exists
825and you can read it. It returns @code{nil} otherwise. 827and you can read it. It returns @code{nil} otherwise.
826
827@example
828@group
829(file-readable-p "files.texi")
830 @result{} t
831@end group
832@group
833(file-exists-p "/usr/spool/mqueue")
834 @result{} t
835@end group
836@group
837(file-readable-p "/usr/spool/mqueue")
838 @result{} nil
839@end group
840@end example
841@end defun 828@end defun
842 829
843@c Emacs 19 feature
844@defun file-executable-p filename 830@defun file-executable-p filename
845This function returns @code{t} if a file named @var{filename} exists and 831This function returns @code{t} if a file named @var{filename} exists and
846you can execute it. It returns @code{nil} otherwise. On Unix and 832you can execute it. It returns @code{nil} otherwise. On Unix and
@@ -856,27 +842,18 @@ file exists and you can write it. It is creatable if it does not exist,
856but the specified directory does exist and you can write in that 842but the specified directory does exist and you can write in that
857directory. 843directory.
858 844
859In the third example below, @file{foo} is not writable because the 845In the example below, @file{foo} is not writable because the parent
860parent directory does not exist, even though the user could create such 846directory does not exist, even though the user could create such a
861a directory. 847directory.
862 848
863@example 849@example
864@group 850@group
865(file-writable-p "~/foo")
866 @result{} t
867@end group
868@group
869(file-writable-p "/foo")
870 @result{} nil
871@end group
872@group
873(file-writable-p "~/no-such-dir/foo") 851(file-writable-p "~/no-such-dir/foo")
874 @result{} nil 852 @result{} nil
875@end group 853@end group
876@end example 854@end example
877@end defun 855@end defun
878 856
879@c Emacs 19 feature
880@defun file-accessible-directory-p dirname 857@defun file-accessible-directory-p dirname
881This function returns @code{t} if you have permission to open existing 858This function returns @code{t} if you have permission to open existing
882files in the directory whose name as a file is @var{dirname}; 859files in the directory whose name as a file is @var{dirname};
@@ -885,16 +862,13 @@ The value of @var{dirname} may be either a directory name (such as
885@file{/foo/}) or the file name of a file which is a directory 862@file{/foo/}) or the file name of a file which is a directory
886(such as @file{/foo}, without the final slash). 863(such as @file{/foo}, without the final slash).
887 864
888Example: after the following, 865For example, from the following we deduce that any attempt to read a
866file in @file{/foo/} will give an error:
889 867
890@example 868@example
891(file-accessible-directory-p "/foo") 869(file-accessible-directory-p "/foo")
892 @result{} nil 870 @result{} nil
893@end example 871@end example
894
895@noindent
896we can deduce that any attempt to read a file in @file{/foo/} will
897give an error.
898@end defun 872@end defun
899 873
900@defun access-file filename string 874@defun access-file filename string
@@ -917,39 +891,59 @@ replace @var{filename} with its target. However, it does recursively
917follow symbolic links at all levels of parent directories. 891follow symbolic links at all levels of parent directories.
918@end defun 892@end defun
919 893
920@defun file-newer-than-file-p filename1 filename2 894@defun file-modes filename
921@cindex file age 895@cindex mode bits
922@cindex file modification time 896@cindex file permissions
923This function returns @code{t} if the file @var{filename1} is 897@cindex permissions, file
924newer than file @var{filename2}. If @var{filename1} does not 898@cindex file modes
925exist, it returns @code{nil}. If @var{filename1} does exist, but 899This function returns the @dfn{mode bits} of @var{filename}---an
926@var{filename2} does not, it returns @code{t}. 900integer summarizing its read, write, and execution permissions.
901Symbolic links in @var{filename} are recursively followed at all
902levels. If the file does not exist, the return value is @code{nil}.
927 903
928In the following example, assume that the file @file{aug-19} was written 904@xref{File permissions,,, coreutils, The @sc{gnu} @code{Coreutils}
929on the 19th, @file{aug-20} was written on the 20th, and the file 905Manual}, for a description of mode bits. For example, if the
930@file{no-file} doesn't exist at all. 906low-order bit is 1, the file is executable by all users; if the
907second-lowest-order bit is 1, the file is writable by all users; etc.
908The highest possible value is 4095 (7777 octal), meaning that everyone
909has read, write, and execute permission, the @acronym{SUID} bit is set
910for both others and group, and the sticky bit is set.
911
912@xref{Changing Files}, for the @code{set-file-modes} function, which
913can be used to set these permissions.
931 914
932@example 915@example
933@group 916@group
934(file-newer-than-file-p "aug-19" "aug-20") 917(file-modes "~/junk/diffs")
935 @result{} nil 918 @result{} 492 ; @r{Decimal integer.}
936@end group 919@end group
937@group 920@group
938(file-newer-than-file-p "aug-20" "aug-19") 921(format "%o" 492)
939 @result{} t 922 @result{} "754" ; @r{Convert to octal.}
940@end group 923@end group
924
941@group 925@group
942(file-newer-than-file-p "aug-19" "no-file") 926(set-file-modes "~/junk/diffs" #o666)
943 @result{} t 927 @result{} nil
944@end group 928@end group
929
945@group 930@group
946(file-newer-than-file-p "no-file" "aug-19") 931$ ls -l diffs
947 @result{} nil 932-rw-rw-rw- 1 lewis lewis 3063 Oct 30 16:00 diffs
948@end group 933@end group
949@end example 934@end example
950 935
951You can use @code{file-attributes} to get a file's last modification 936@cindex MS-DOS and file modes
952time as a list of four integers. @xref{File Attributes}. 937@cindex file modes and MS-DOS
938@strong{MS-DOS note:} On MS-DOS, there is no such thing as an
939``executable'' file mode bit. So @code{file-modes} considers a file
940executable if its name ends in one of the standard executable
941extensions, such as @file{.com}, @file{.bat}, @file{.exe}, and some
942others. Files that begin with the Unix-standard @samp{#!} signature,
943such as shell and Perl scripts, are also considered executable.
944Directories are also reported as executable, for compatibility with
945Unix. These conventions are also followed by @code{file-attributes}
946(@pxref{File Attributes}).
953@end defun 947@end defun
954 948
955@node Kinds of Files 949@node Kinds of Files
@@ -987,8 +981,6 @@ If the file @var{filename} is not a symbolic link (or there is no such file),
987 @result{} "/pub/bin" 981 @result{} "/pub/bin"
988@end group 982@end group
989@end example 983@end example
990
991@c !!! file-symlink-p: should show output of ls -l for comparison
992@end defun 984@end defun
993 985
994The next two functions recursively follow symbolic links at 986The next two functions recursively follow symbolic links at
@@ -1029,21 +1021,6 @@ a regular file (not a directory, named pipe, terminal, or
1029other I/O device). 1021other I/O device).
1030@end defun 1022@end defun
1031 1023
1032@defun file-equal-p file1 file2
1033This function returns @code{t} if the files @var{file1} and
1034@var{file2} name the same file. If @var{file1} or @var{file2} does
1035not exist, the return value is unspecified.
1036@end defun
1037
1038@defun file-in-directory-p file dir
1039This function returns @code{t} if @var{file} is a file in directory
1040@var{dir}, or in a subdirectory of @var{dir}. It also returns
1041@code{t} if @var{file} and @var{dir} are the same directory. It
1042compares the @code{file-truename} values of the two directories
1043(@pxref{Truenames}). If @var{dir} does not name an existing
1044directory, the return value is @code{nil}.
1045@end defun
1046
1047@node Truenames 1024@node Truenames
1048@subsection Truenames 1025@subsection Truenames
1049@cindex truename (of file) 1026@cindex truename (of file)
@@ -1066,14 +1043,14 @@ This function does not expand environment variables. Only
1066substitute-in-file-name}. 1043substitute-in-file-name}.
1067 1044
1068If you may need to follow symbolic links preceding @samp{..}@: 1045If you may need to follow symbolic links preceding @samp{..}@:
1069appearing as a name component, you should make sure to call 1046appearing as a name component, call @code{file-truename} without prior
1070@code{file-truename} without prior direct or indirect calls to 1047direct or indirect calls to @code{expand-file-name}. Otherwise, the
1071@code{expand-file-name}, as otherwise the file name component 1048file name component immediately preceding @samp{..} will be
1072immediately preceding @samp{..} will be ``simplified away'' before 1049``simplified away'' before @code{file-truename} is called. To
1073@code{file-truename} is called. To eliminate the need for a call to 1050eliminate the need for a call to @code{expand-file-name},
1074@code{expand-file-name}, @code{file-truename} handles @samp{~} in the 1051@code{file-truename} handles @samp{~} in the same way that
1075same way that @code{expand-file-name} does. @xref{File Name 1052@code{expand-file-name} does. @xref{File Name Expansion,, Functions
1076Expansion,, Functions that Expand Filenames}. 1053that Expand Filenames}.
1077@end defun 1054@end defun
1078 1055
1079@defun file-chase-links filename &optional limit 1056@defun file-chase-links filename &optional limit
@@ -1102,70 +1079,61 @@ we would have:
1102 @result{} "/home/foo/hello" 1079 @result{} "/home/foo/hello"
1103@end example 1080@end example
1104 1081
1105 @xref{Buffer File Name}, for related information. 1082@defun file-equal-p file1 file2
1083This function returns @code{t} if the files @var{file1} and
1084@var{file2} name the same file. This is similar to comparing their
1085truenames, except that remote file names are also handled in an
1086appropriate manner. If @var{file1} or @var{file2} does not exist, the
1087return value is unspecified.
1088@end defun
1089
1090@defun file-in-directory-p file dir
1091This function returns @code{t} if @var{file} is a file in directory
1092@var{dir}, or in a subdirectory of @var{dir}. It also returns
1093@code{t} if @var{file} and @var{dir} are the same directory. It
1094compares the truenames of the two directories. If @var{dir} does not
1095name an existing directory, the return value is @code{nil}.
1096@end defun
1106 1097
1107@node File Attributes 1098@node File Attributes
1108@subsection Other Information about Files 1099@subsection File Attributes
1100@cindex file attributes
1109 1101
1110 This section describes the functions for getting detailed 1102 This section describes the functions for getting detailed
1111information about a file, other than its contents. This information 1103information about a file, including the owner and group numbers, the
1112includes the mode bits that control access permissions, the owner and 1104number of names, the inode number, the size, and the times of access
1113group numbers, the number of names, the inode number, the size, and 1105and modification.
1114the times of access and modification.
1115 1106
1116@defun file-modes filename 1107@defun file-newer-than-file-p filename1 filename2
1117@cindex file permissions 1108@cindex file age
1118@cindex permissions, file 1109@cindex file modification time
1119@cindex file attributes 1110This function returns @code{t} if the file @var{filename1} is
1120@cindex file modes 1111newer than file @var{filename2}. If @var{filename1} does not
1121This function returns the @dfn{mode bits} describing the @dfn{file 1112exist, it returns @code{nil}. If @var{filename1} does exist, but
1122permissions} of @var{filename}, as an integer. It recursively follows 1113@var{filename2} does not, it returns @code{t}.
1123symbolic links in @var{filename} at all levels. If @var{filename}
1124does not exist, the return value is @code{nil}.
1125 1114
1126@xref{File permissions,,, coreutils, The @sc{gnu} @code{Coreutils} 1115In the following example, assume that the file @file{aug-19} was written
1127Manual}, for a description of mode bits. If the low-order bit is 1, 1116on the 19th, @file{aug-20} was written on the 20th, and the file
1128then the file is executable by all users, if the second-lowest-order 1117@file{no-file} doesn't exist at all.
1129bit is 1, then the file is writable by all users, etc. The highest
1130value returnable is 4095 (7777 octal), meaning that everyone has read,
1131write, and execute permission, that the @acronym{SUID} bit is set for
1132both others and group, and that the sticky bit is set.
1133 1118
1134@example 1119@example
1135@group 1120@group
1136(file-modes "~/junk/diffs") 1121(file-newer-than-file-p "aug-19" "aug-20")
1137 @result{} 492 ; @r{Decimal integer.} 1122 @result{} nil
1138@end group 1123@end group
1139@group 1124@group
1140(format "%o" 492) 1125(file-newer-than-file-p "aug-20" "aug-19")
1141 @result{} "754" ; @r{Convert to octal.} 1126 @result{} t
1142@end group 1127@end group
1143
1144@group 1128@group
1145(set-file-modes "~/junk/diffs" #o666) 1129(file-newer-than-file-p "aug-19" "no-file")
1146 @result{} nil 1130 @result{} t
1147@end group 1131@end group
1148
1149@group 1132@group
1150$ ls -l diffs 1133(file-newer-than-file-p "no-file" "aug-19")
1151-rw-rw-rw- 1 lewis lewis 3063 Oct 30 16:00 diffs 1134 @result{} nil
1152@end group 1135@end group
1153@end example 1136@end example
1154
1155@xref{Changing Files}, for functions that change file permissions,
1156such as @code{set-file-modes}.
1157
1158@cindex MS-DOS and file modes
1159@cindex file modes and MS-DOS
1160@strong{MS-DOS note:} On MS-DOS, there is no such thing as an
1161``executable'' file mode bit. So @code{file-modes} considers a file
1162executable if its name ends in one of the standard executable
1163extensions, such as @file{.com}, @file{.bat}, @file{.exe}, and some
1164others. Files that begin with the Unix-standard @samp{#!} signature,
1165such as shell and Perl scripts, are also considered executable.
1166Directories are also reported as executable, for compatibility with
1167Unix. These conventions are also followed by @code{file-attributes},
1168below.
1169@end defun 1137@end defun
1170 1138
1171 If the @var{filename} argument to the next two functions is a 1139 If the @var{filename} argument to the next two functions is a
@@ -1173,31 +1141,6 @@ symbolic link, then these function do @emph{not} replace it with its
1173target. However, they both recursively follow symbolic links at all 1141target. However, they both recursively follow symbolic links at all
1174levels of parent directories. 1142levels of parent directories.
1175 1143
1176@defun file-nlinks filename
1177This function returns the number of names (i.e., hard links) that
1178file @var{filename} has. If the file does not exist, this function
1179returns @code{nil}. Note that symbolic links have no effect on this
1180function, because they are not considered to be names of the files
1181they link to.
1182
1183@example
1184@group
1185$ ls -l foo*
1186-rw-rw-rw- 2 rms rms 4 Aug 19 01:27 foo
1187-rw-rw-rw- 2 rms rms 4 Aug 19 01:27 foo1
1188@end group
1189
1190@group
1191(file-nlinks "foo")
1192 @result{} 2
1193@end group
1194@group
1195(file-nlinks "doesnt-exist")
1196 @result{} nil
1197@end group
1198@end example
1199@end defun
1200
1201@defun file-attributes filename &optional id-format 1144@defun file-attributes filename &optional id-format
1202@anchor{Definition of file-attributes} 1145@anchor{Definition of file-attributes}
1203This function returns a list of attributes of file @var{filename}. If 1146This function returns a list of attributes of file @var{filename}. If
@@ -1339,52 +1282,99 @@ is on the file-system device whose number is 1014478468.
1339@end table 1282@end table
1340@end defun 1283@end defun
1341 1284
1342@cindex SELinux context 1285@defun file-nlinks filename
1343 SELinux is a Linux kernel feature which provides more sophisticated 1286This function returns the number of names (i.e., hard links) that
1344file access controls than ordinary ``Unix-style'' file permissions. 1287file @var{filename} has. If the file does not exist, this function
1345If Emacs has been compiled with SELinux support on a system with 1288returns @code{nil}. Note that symbolic links have no effect on this
1346SELinux enabled, you can use the function @code{file-selinux-context} 1289function, because they are not considered to be names of the files
1347to retrieve a file's SELinux security context. For the function 1290they link to.
1348@code{set-file-selinux-context}, see @ref{Changing Files}.
1349 1291
1350@defun file-selinux-context filename 1292@example
1351This function returns the SELinux security context of the file 1293@group
1352@var{filename}. This return value is a list of the form 1294$ ls -l foo*
1353@code{(@var{user} @var{role} @var{type} @var{range})}, whose elements 1295-rw-rw-rw- 2 rms rms 4 Aug 19 01:27 foo
1354are the context's user, role, type, and range respectively, as Lisp 1296-rw-rw-rw- 2 rms rms 4 Aug 19 01:27 foo1
1355strings. See the SELinux documentation for details about what these 1297@end group
1356actually mean.
1357 1298
1358If the file does not exist or is inaccessible, or if the system does 1299@group
1359not support SELinux, or if Emacs was not compiled with SELinux 1300(file-nlinks "foo")
1360support, then the return value is @code{(nil nil nil nil)}. 1301 @result{} 2
1302@end group
1303@group
1304(file-nlinks "doesnt-exist")
1305 @result{} nil
1306@end group
1307@end example
1361@end defun 1308@end defun
1362 1309
1310@node Extended Attributes
1311@subsection Extended File Attributes
1312@cindex extended file attributes
1313
1314On some operating systems, each file can be associated with arbitrary
1315@dfn{extended file attributes}. At present, Emacs supports querying
1316and setting two specific sets of extended file attributes: Access
1317Control Lists (ACLs) and SELinux contexts. These extended file
1318attributes are used, on some systems, to impose more sophisticated
1319file access controls than the basic ``Unix-style'' permissions
1320discussed in the previous sections.
1321
1363@cindex access control list 1322@cindex access control list
1364@cindex ACL entries 1323@cindex ACL entries
1365 If Emacs has been compiled with @dfn{ACL} (access control list) 1324@cindex SELinux context
1366support, you can use the function @code{file-acl} to retrieve a file's 1325 A detailed explanation of ACLs and SELinux is beyond the scope of
1367ACL entries. The interface implementation is platform-specific; on 1326this manual. For our purposes, each file can be associated with an
1368GNU/Linux and BSD, Emacs uses the POSIX ACL interface, while on 1327@dfn{ACL}, which specifies its properties under an ACL-based file
1369MS-Windows Emacs emulates the POSIX ACL interface with native file 1328control system, and/or an @dfn{SELinux context}, which specifies its
1370security APIs. 1329properties under the SELinux system.
1371 1330
1372@defun file-acl filename 1331@defun file-acl filename
1373This function returns the ACL entries of the file @var{filename}. The 1332This function returns the ACL for the file @var{filename}. The exact
1374return value is a platform-dependent object containing some 1333Lisp representation of the ACL is unspecified (and may change in
1375representation of the ACL entries. Don't use it for anything except 1334future Emacs versions), but it is the same as what @code{set-file-acl}
1376passing it to the @code{set-file-acl} function (@pxref{Changing Files, 1335takes for its @var{acl} argument (@pxref{Changing Files}).
1377set-file-acl}).
1378 1336
1379If the file does not exist or is inaccessible, or if Emacs was unable to 1337The underlying ACL implementation is platform-specific; on GNU/Linux
1380determine the ACL entries, then the return value is @code{nil}. The 1338and BSD, Emacs uses the POSIX ACL interface, while on MS-Windows Emacs
1381latter can happen for local files if Emacs was not compiled with ACL 1339emulates the POSIX ACL interface with native file security APIs.
1382support, or for remote files if the file handler returns nil for the 1340
1383file's ACL entries. 1341If Emacs was not compiled with ACL support, or the file does not exist
1342or is inaccessible, or Emacs was unable to determine the ACL entries
1343for any other reason, then the return value is @code{nil}.
1344@end defun
1345
1346@defun file-selinux-context filename
1347This function returns the SELinux context of the file @var{filename},
1348as a list of the form @code{(@var{user} @var{role} @var{type}
1349@var{range})}. The list elements are the context's user, role, type,
1350and range respectively, as Lisp strings; see the SELinux documentation
1351for details about what these actually mean. The return value has the
1352same form as what @code{set-file-selinux-context} takes for its
1353@var{context} argument (@pxref{Changing Files}).
1354
1355If Emacs was not compiled with SELinux support, or the file does not
1356exist or is inaccessible, or if the system does not support SELinux,
1357then the return value is @code{(nil nil nil nil)}.
1358@end defun
1359
1360@defun file-extended-attributes filename
1361This function returns an alist of the Emacs-recognized extended
1362attributes of file @var{filename}. Currently, it serves as a
1363convenient way to retrieve both the ACL and SELinux context; you can
1364then call the function @code{set-file-extended-attributes}, with the
1365returned alist as its second argument, to apply the same file access
1366attributes to another file (@pxref{Changing Files}).
1367
1368One of the elements is @code{(acl . @var{acl})}, where @var{acl} has
1369the same form returned by @code{file-acl}.
1370
1371Another element is @code{(selinux-context . @var{context})}, where
1372@var{context} is the SELinux context, in the same form returned by
1373@code{file-selinux-context}.
1384@end defun 1374@end defun
1385 1375
1386@node Locating Files 1376@node Locating Files
1387@subsection How to Locate Files in Standard Places 1377@subsection Locating Files in Standard Places
1388@cindex locate file in path 1378@cindex locate file in path
1389@cindex find file in path 1379@cindex find file in path
1390 1380
@@ -1571,10 +1561,11 @@ file. This works only on some operating systems, and only if you have
1571the correct permissions to do so. 1561the correct permissions to do so.
1572 1562
1573If the optional argument @var{preserve-permissions} is non-@code{nil}, 1563If the optional argument @var{preserve-permissions} is non-@code{nil},
1574this function copies the file's permissions, such as its file modes, 1564this function copies the file modes (or ``permissions''), as well as
1575its SELinux context, and ACL entries (@pxref{File Attributes}). 1565its Access Control List and SELinux context (if any).
1576Otherwise, if the destination is created its file permission bits are 1566@xref{Information about Files}. Otherwise, if the destination is
1577those of the source, masked by the default file permissions. 1567created its file permission bits are those of the source, masked by
1568the default file permissions.
1578@end deffn 1569@end deffn
1579 1570
1580@deffn Command make-symbolic-link filename newname &optional ok-if-exists 1571@deffn Command make-symbolic-link filename newname &optional ok-if-exists
@@ -1616,7 +1607,7 @@ See also @code{delete-directory} in @ref{Create/Delete Dirs}.
1616@cindex permissions, file 1607@cindex permissions, file
1617@cindex file modes, setting 1608@cindex file modes, setting
1618@deffn Command set-file-modes filename mode 1609@deffn Command set-file-modes filename mode
1619This function sets the @dfn{file mode} (or @dfn{file permissions}) of 1610This function sets the @dfn{file mode} (or @dfn{permissions}) of
1620@var{filename} to @var{mode}. It recursively follows symbolic links 1611@var{filename} to @var{mode}. It recursively follows symbolic links
1621at all levels for @var{filename}. 1612at all levels for @var{filename}.
1622 1613
@@ -1705,25 +1696,31 @@ time and must be in the format returned by @code{current-time}
1705(@pxref{Time of Day}). 1696(@pxref{Time of Day}).
1706@end defun 1697@end defun
1707 1698
1699@defun set-file-extended-attributes filename attribute-alist
1700This function sets the Emacs-recognized extended file attributes for
1701@code{filename}. The second argument @var{attribute-alist} should be
1702an alist of the same form returned by @code{file-extended-attributes}.
1703@xref{Extended Attributes}.
1704@end defun
1705
1708@defun set-file-selinux-context filename context 1706@defun set-file-selinux-context filename context
1709This function sets the SELinux security context of the file 1707This function sets the SELinux security context for @var{filename} to
1710@var{filename} to @var{context}. @xref{File Attributes}, for a brief 1708@var{context}. The @var{context} argument should be a list
1711description of SELinux contexts. The @var{context} argument should be 1709@code{(@var{user} @var{role} @var{type} @var{range})}, where each
1712a list @code{(@var{user} @var{role} @var{type} @var{range})}, like the 1710element is a string. @xref{Extended Attributes}.
1713return value of @code{file-selinux-context}. The function returns 1711
1714@code{t} if it succeeds to set the SELinux security context of 1712The function returns @code{t} if it succeeds in setting the SELinux
1715@var{filename}, @code{nil} otherwise. The function does nothing and 1713context of @var{filename}. It returns @code{nil} if the context was
1716returns @code{nil} if SELinux is disabled, or if Emacs was compiled 1714not set (e.g., if SELinux is disabled, or if Emacs was compiled
1717without SELinux support. 1715without SELinux support).
1718@end defun 1716@end defun
1719 1717
1720@defun set-file-acl filename acl-string 1718@defun set-file-acl filename acl
1721This function sets the ACL entries of the file @var{filename} to 1719This function sets the Access Control List for @var{filename} to
1722@var{acl-string}. @xref{File Attributes}, for a brief description of 1720@var{acl}. The @var{acl} argument should have the same form returned
1723ACLs. The @var{acl-string} argument should be a string containing the 1721by the function @code{file-acl}. @xref{Extended Attributes}.
1724textual representation of the desired ACL entries as returned by 1722
1725@code{file-acl} (@pxref{File Attributes, file-acl}). The function 1723The function returns @code{t} if it successfully sets the ACL of
1726returns @code{t} if it succeeds to set the ACL entries of
1727@var{filename}, @code{nil} otherwise. 1724@var{filename}, @code{nil} otherwise.
1728@end defun 1725@end defun
1729 1726
diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi
index 0e58816ecf3..e32922eef68 100644
--- a/doc/lispref/minibuf.texi
+++ b/doc/lispref/minibuf.texi
@@ -2224,12 +2224,6 @@ This is like @code{minibuffer-contents}, except that it does not copy text
2224properties, just the characters themselves. @xref{Text Properties}. 2224properties, just the characters themselves. @xref{Text Properties}.
2225@end defun 2225@end defun
2226 2226
2227@defun minibuffer-completion-contents
2228This is like @code{minibuffer-contents}, except that it returns only
2229the contents before point. That is the part that completion commands
2230operate on. @xref{Minibuffer Completion}.
2231@end defun
2232
2233@defun delete-minibuffer-contents 2227@defun delete-minibuffer-contents
2234This function erases the editable contents of the minibuffer (that is, 2228This function erases the editable contents of the minibuffer (that is,
2235everything except the prompt), if a minibuffer is current. Otherwise, 2229everything except the prompt), if a minibuffer is current. Otherwise,
diff --git a/doc/lispref/variables.texi b/doc/lispref/variables.texi
index a80a6c0b1e3..dbeebcc6ee6 100644
--- a/doc/lispref/variables.texi
+++ b/doc/lispref/variables.texi
@@ -416,18 +416,23 @@ explicitly in the @code{defvar} form. The variable is marked as
416@dfn{special}, meaning that it should always be dynamically bound 416@dfn{special}, meaning that it should always be dynamically bound
417(@pxref{Variable Scoping}). 417(@pxref{Variable Scoping}).
418 418
419If @var{symbol} is void and @var{value} is specified, @code{defvar} 419If @var{value} is specified, and @var{symbol} is void (i.e., it has no
420evaluates @var{value} and sets @var{symbol} to the result. But if 420dynamically bound value; @pxref{Void Variables}), then @var{value} is
421@var{symbol} already has a value (i.e., it is not void), @var{value} 421evaluated and @var{symbol} is set to the result. But if @var{symbol}
422is not even evaluated, and @var{symbol}'s value remains unchanged. If 422is not void, @var{value} is not evaluated, and @var{symbol}'s value is
423@var{value} is omitted, the value of @var{symbol} is not changed in 423left unchanged. If @var{value} is omitted, the value of @var{symbol}
424any case. 424is not changed in any case.
425 425
426If @var{symbol} has a buffer-local binding in the current buffer, 426If @var{symbol} has a buffer-local binding in the current buffer,
427@code{defvar} operates on the default value, which is buffer-independent, 427@code{defvar} acts on the default value, which is buffer-independent,
428not the current (buffer-local) binding. It sets the default value if 428rather than the buffer-local binding. It sets the default value if
429the default value is void. @xref{Buffer-Local Variables}. 429the default value is void. @xref{Buffer-Local Variables}.
430 430
431If @var{symbol} is already lexically bound (e.g., if the @code{defvar}
432form occurs in a @code{let} form with lexical binding enabled), then
433@code{defvar} sets the dynamic value. The lexical binding remains in
434effect until its binding construct exits. @xref{Variable Scoping}.
435
431When you evaluate a top-level @code{defvar} form with @kbd{C-M-x} in 436When you evaluate a top-level @code{defvar} form with @kbd{C-M-x} in
432Emacs Lisp mode (@code{eval-defun}), a special feature of 437Emacs Lisp mode (@code{eval-defun}), a special feature of
433@code{eval-defun} arranges to set the variable unconditionally, without 438@code{eval-defun} arranges to set the variable unconditionally, without
diff --git a/etc/NEWS b/etc/NEWS
index 801f5b8ed20..6f2b80f0bf7 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -904,6 +904,7 @@ low-level libraries gfilenotify.c, inotify.c or w32notify.c.
904** `(input-pending-p)' no longer runs other timers which are ready to 904** `(input-pending-p)' no longer runs other timers which are ready to
905run. The new optional CHECK-TIMERS param allows for the prior behavior. 905run. The new optional CHECK-TIMERS param allows for the prior behavior.
906 906
907+++
907** `defvar' and `defcustom' in a let-binding affect the "external" default. 908** `defvar' and `defcustom' in a let-binding affect the "external" default.
908 909
909--- 910---
@@ -958,6 +959,7 @@ special-forms any more.
958when lexical binding is enabled. Previously, VAR was bound to nil, 959when lexical binding is enabled. Previously, VAR was bound to nil,
959which often led to spurious unused-variable warnings. 960which often led to spurious unused-variable warnings.
960 961
962+++
961** The return value of `backup-buffer' has changed. 963** The return value of `backup-buffer' has changed.
962The second argument is no longer an SELinux context, instead it is an 964The second argument is no longer an SELinux context, instead it is an
963alist of extended attributes as returned by the new function 965alist of extended attributes as returned by the new function
@@ -1083,6 +1085,7 @@ displaying the buffer in a window.
1083*** `string-remove-prefix' 1085*** `string-remove-prefix'
1084*** `string-remove-suffix' 1086*** `string-remove-suffix'
1085 1087
1088+++
1086** Obsoleted functions: 1089** Obsoleted functions:
1087*** `log10' 1090*** `log10'
1088*** `dont-compile' 1091*** `dont-compile'
@@ -1100,8 +1103,10 @@ The few hooks that used with-wrapper-hook are replaced as follows:
1100*** `completion-in-region-function' obsoletes `completion-in-region-functions'. 1103*** `completion-in-region-function' obsoletes `completion-in-region-functions'.
1101*** `filter-buffer-substring-function' obsoletes `filter-buffer-substring-functions'. 1104*** `filter-buffer-substring-function' obsoletes `filter-buffer-substring-functions'.
1102 1105
1106+++
1103** `byte-compile-interactive-only-functions' is now obsolete. 1107** `byte-compile-interactive-only-functions' is now obsolete.
1104It has been replaced by the symbol property 'interactive-only. 1108To specify that a command should only be called interactively, give it
1109a non-nil `interactive-only' property.
1105 1110
1106+++ 1111+++
1107** `split-string' now takes an optional argument TRIM. 1112** `split-string' now takes an optional argument TRIM.