From 1eda3d9dc5c1f883b6bdefe1a6072d3c9e2224e7 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Thu, 11 May 2023 16:52:50 +0300 Subject: [PATCH] ; Fix last change * lisp/files.el (safe-local-variable-directories): * doc/lispref/variables.texi (File Local Variables): * doc/emacs/custom.texi (Safe File Variables): Fix wording of documentation in last change. (Bug#61901) --- doc/emacs/custom.texi | 36 +++++++++++++++++++++++------------- doc/lispref/variables.texi | 10 +++++----- lisp/files.el | 5 ++++- 3 files changed, 32 insertions(+), 19 deletions(-) diff --git a/doc/emacs/custom.texi b/doc/emacs/custom.texi index 2ddd39be31f..80490effb6c 100644 --- a/doc/emacs/custom.texi +++ b/doc/emacs/custom.texi @@ -1328,12 +1328,14 @@ pairs in the file, by typing @kbd{i} at the confirmation prompt -- these pairs will thereafter be ignored in this file and in all other files. - For directory-local variable/value pairs -(@pxref{Directory Variables}), typing @kbd{+} at the confirmation -prompt will set all the variable/value pairs, and recognize all -variables in that directory as safe in the future. This option should -only be used for directories whose contents you trust. The @kbd{+} -confirmation prompt option is not available for file-local variables. + When Emacs asks for confirmation for setting directory-local +variables (@pxref{Directory Variables}), typing @kbd{+} at the +confirmation prompt will set all the variables, and also add the +directory to the list in @code{safe-local-variable-directories} +(described below), which will cause Emacs to consider this directory +as safe for loading any directory-local variables in the future. The +@kbd{+} response should only be used for directories whose contents +you trust. @vindex safe-local-variable-values @vindex ignored-local-variable-values @@ -1352,13 +1354,21 @@ Similarly, if you want to record values of risky variables that should be permanently ignored, customize @code{ignored-local-variable-values}. @vindex safe-local-variable-directories - Sometimes it is helpful to always trust risky variables in a certain -directory, and skip the confirmation prompt when directory-local -variables are loaded there. When @kbd{+} is pressed at the risky -variable confirmation prompt, the directory in question is added to -the @samp{safe-local-variable-directories} variable, and risky -directory-local variables there will be loaded without prompting in -the future. If customizing @samp{safe-local-variable-directories} + Sometimes it is helpful to always trust directory-variables in +certain directories, and skip the confirmation prompt when local +variables are loaded from those directories, even if the variables are +risky. The variable @code{safe-local-variable-directories} holds the +list of such directories. The names of the directories in this list +must be full absolute file names, and should end in a slash. If the +variable @code{enable-remote-dir-locals} has a non-@code{nil} value, +the list can include remote directories as well (@pxref{Remote +Files}). + +When @kbd{+} is pressed +at the risky variable confirmation prompt, the directory in question +is added to the @samp{safe-local-variable-directories} variable, and +risky directory-local variables there will be loaded without prompting +in the future. If customizing @samp{safe-local-variable-directories} manually, the directories in this list must be fully-expanded absolute paths that end in a directory separator character. Directory paths may be remote directory paths (@pxref{Remote Files}), if the diff --git a/doc/lispref/variables.texi b/doc/lispref/variables.texi index 52a94db3703..b3a8cd8110c 100644 --- a/doc/lispref/variables.texi +++ b/doc/lispref/variables.texi @@ -1982,11 +1982,11 @@ This is a list of directories where local variables are always enabled. Directory-local variables loaded from these directories, such as the variables in @file{.dir-locals.el}, will be enabled even if they are risky. The directories in this list must be -fully-expanded absolute paths that end in a directory separator -character. They may also be remote directory paths if the -@code{enable-remote-dir-locals} variable is set to @code{t}. -Directory paths in this list are case-sensitive, even if the -filesystem is not. +fully-expanded absolute file names that end in a directory separator +character. They may also be remote directories if the variable +@code{enable-remote-dir-locals} is set non-@code{nil}. Directories in +this list are matched case-sensitively, even if the filesystem is +case-sensitive. @end defvar @defun hack-local-variables &optional handle-mode diff --git a/lisp/files.el b/lisp/files.el index aa01e638c98..35d794f6dcf 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -3700,7 +3700,10 @@ This overrides any `enable-local-variables' setting.") (defcustom safe-local-variable-directories '() "A list of directories where local variables are always enabled. Directory-local variables loaded from these directories, such as the -variables in .dir-locals.el, will be enabled even if they are risky." +variables in .dir-locals.el, will be enabled even if they are risky. +The names of the directories in the list must be absolute, and must +end in a slash. Remote directories can be included if the +variable `enable-remote-dir-locals' is non-nil." :version "30.1" :type '(repeat string) :risky t -- 2.39.2