diff options
| author | Po Lu | 2023-05-12 10:43:52 +0800 |
|---|---|---|
| committer | Po Lu | 2023-05-12 10:43:52 +0800 |
| commit | 7ac8bcaacc1f3dbbda3febe09dde6d18a2d69729 (patch) | |
| tree | 0f793adca34d302415ccb31b945b6c1084425724 | |
| parent | 140c5bffc6441e6cee9ba60af114392729239abe (diff) | |
| parent | 30501083f2ff24ee1291a68e83c65b89c644f44b (diff) | |
| download | emacs-7ac8bcaacc1f3dbbda3febe09dde6d18a2d69729.tar.gz emacs-7ac8bcaacc1f3dbbda3febe09dde6d18a2d69729.zip | |
Merge remote-tracking branch 'origin/master' into feature/android
| -rw-r--r-- | doc/emacs/custom.texi | 20 | ||||
| -rw-r--r-- | doc/lispref/variables.texi | 12 | ||||
| -rw-r--r-- | etc/NEWS | 4 | ||||
| -rw-r--r-- | lisp/dynamic-setting.el | 1 | ||||
| -rw-r--r-- | lisp/files.el | 37 | ||||
| -rw-r--r-- | lisp/net/soap-client.el | 13 | ||||
| -rw-r--r-- | lisp/progmodes/prog-mode.el | 1 | ||||
| -rw-r--r-- | lisp/term/haiku-win.el | 3 | ||||
| -rw-r--r-- | lisp/x-dnd.el | 3 | ||||
| -rw-r--r-- | src/lread.c | 14 | ||||
| -rw-r--r-- | test/lisp/files-tests.el | 21 |
11 files changed, 109 insertions, 20 deletions
diff --git a/doc/emacs/custom.texi b/doc/emacs/custom.texi index 87290734cc9..d8abf81c75f 100644 --- a/doc/emacs/custom.texi +++ b/doc/emacs/custom.texi | |||
| @@ -1328,6 +1328,15 @@ pairs in the file, by typing @kbd{i} at the confirmation prompt -- | |||
| 1328 | these pairs will thereafter be ignored in this file and in all other | 1328 | these pairs will thereafter be ignored in this file and in all other |
| 1329 | files. | 1329 | files. |
| 1330 | 1330 | ||
| 1331 | When Emacs asks for confirmation for setting directory-local | ||
| 1332 | variables (@pxref{Directory Variables}), typing @kbd{+} at the | ||
| 1333 | confirmation prompt will set all the variables, and also add the | ||
| 1334 | directory to the list in @code{safe-local-variable-directories} | ||
| 1335 | (described below), which will cause Emacs to consider this directory | ||
| 1336 | as safe for loading any directory-local variables in the future. The | ||
| 1337 | @kbd{+} response should only be used for directories whose contents | ||
| 1338 | you trust. | ||
| 1339 | |||
| 1331 | @vindex safe-local-variable-values | 1340 | @vindex safe-local-variable-values |
| 1332 | @vindex ignored-local-variable-values | 1341 | @vindex ignored-local-variable-values |
| 1333 | @cindex risky variable | 1342 | @cindex risky variable |
| @@ -1344,6 +1353,17 @@ record safe values for risky variables, do it directly by customizing | |||
| 1344 | Similarly, if you want to record values of risky variables that should | 1353 | Similarly, if you want to record values of risky variables that should |
| 1345 | be permanently ignored, customize @code{ignored-local-variable-values}. | 1354 | be permanently ignored, customize @code{ignored-local-variable-values}. |
| 1346 | 1355 | ||
| 1356 | @vindex safe-local-variable-directories | ||
| 1357 | Sometimes it is helpful to always trust directory-variables in | ||
| 1358 | certain directories, and skip the confirmation prompt when local | ||
| 1359 | variables are loaded from those directories, even if the variables are | ||
| 1360 | risky. The variable @code{safe-local-variable-directories} holds the | ||
| 1361 | list of such directories. The names of the directories in this list | ||
| 1362 | must be full absolute file names, and should end in a slash. If the | ||
| 1363 | variable @code{enable-remote-dir-locals} has a non-@code{nil} value, | ||
| 1364 | the list can include remote directories as well (@pxref{Remote | ||
| 1365 | Files}). | ||
| 1366 | |||
| 1347 | @vindex enable-local-variables | 1367 | @vindex enable-local-variables |
| 1348 | The variable @code{enable-local-variables} allows you to change the | 1368 | The variable @code{enable-local-variables} allows you to change the |
| 1349 | way Emacs processes local variables. Its default value is @code{t}, | 1369 | way Emacs processes local variables. Its default value is @code{t}, |
diff --git a/doc/lispref/variables.texi b/doc/lispref/variables.texi index eadb5c36de6..b3a8cd8110c 100644 --- a/doc/lispref/variables.texi +++ b/doc/lispref/variables.texi | |||
| @@ -1977,6 +1977,18 @@ this can be controlled by using this variable, which is a list of | |||
| 1977 | symbols. | 1977 | symbols. |
| 1978 | @end defvar | 1978 | @end defvar |
| 1979 | 1979 | ||
| 1980 | @defvar safe-local-variable-directories | ||
| 1981 | This is a list of directories where local variables are always | ||
| 1982 | enabled. Directory-local variables loaded from these directories, | ||
| 1983 | such as the variables in @file{.dir-locals.el}, will be enabled even | ||
| 1984 | if they are risky. The directories in this list must be | ||
| 1985 | fully-expanded absolute file names that end in a directory separator | ||
| 1986 | character. They may also be remote directories if the variable | ||
| 1987 | @code{enable-remote-dir-locals} is set non-@code{nil}. Directories in | ||
| 1988 | this list are matched case-sensitively, even if the filesystem is | ||
| 1989 | case-sensitive. | ||
| 1990 | @end defvar | ||
| 1991 | |||
| 1980 | @defun hack-local-variables &optional handle-mode | 1992 | @defun hack-local-variables &optional handle-mode |
| 1981 | This function parses, and binds or evaluates as appropriate, any local | 1993 | This function parses, and binds or evaluates as appropriate, any local |
| 1982 | variables specified by the contents of the current buffer. The variable | 1994 | variables specified by the contents of the current buffer. The variable |
| @@ -417,6 +417,10 @@ The new functions 'touch-screen-track-tap' and | |||
| 417 | 'touch-screen-track-drag' handle tracking common touch screen gestures | 417 | 'touch-screen-track-drag' handle tracking common touch screen gestures |
| 418 | from within a command. | 418 | from within a command. |
| 419 | 419 | ||
| 420 | ** New variable 'safe-local-variable-directories'. | ||
| 421 | This variable names directories in which Emacs will treat all | ||
| 422 | directory-local variables as safe. | ||
| 423 | |||
| 420 | ** New variable 'inhibit-auto-fill' to temporarily prevent auto-fill. | 424 | ** New variable 'inhibit-auto-fill' to temporarily prevent auto-fill. |
| 421 | 425 | ||
| 422 | ** Functions and variables to transpose sexps | 426 | ** Functions and variables to transpose sexps |
diff --git a/lisp/dynamic-setting.el b/lisp/dynamic-setting.el index 9ce09657345..ebe25ab9c75 100644 --- a/lisp/dynamic-setting.el +++ b/lisp/dynamic-setting.el | |||
| @@ -33,6 +33,7 @@ | |||
| 33 | ;;; Customizable variables | 33 | ;;; Customizable variables |
| 34 | 34 | ||
| 35 | (declare-function font-get-system-font "xsettings.c" ()) | 35 | (declare-function font-get-system-font "xsettings.c" ()) |
| 36 | (declare-function reconsider-frame-font "frame.c" ()) | ||
| 36 | 37 | ||
| 37 | (defvar font-use-system-font) | 38 | (defvar font-use-system-font) |
| 38 | 39 | ||
diff --git a/lisp/files.el b/lisp/files.el index ada37d2e9e5..9fdae107068 100644 --- a/lisp/files.el +++ b/lisp/files.el | |||
| @@ -681,7 +681,8 @@ The command \\[normal-mode], when used interactively, | |||
| 681 | always obeys file local variable specifications and the -*- line, | 681 | always obeys file local variable specifications and the -*- line, |
| 682 | and ignores this variable. | 682 | and ignores this variable. |
| 683 | 683 | ||
| 684 | Also see the `permanently-enabled-local-variables' variable." | 684 | Also see the `permanently-enabled-local-variables' and |
| 685 | `safe-local-variable-directories' variables." | ||
| 685 | :risky t | 686 | :risky t |
| 686 | :type '(choice (const :tag "Query Unsafe" t) | 687 | :type '(choice (const :tag "Query Unsafe" t) |
| 687 | (const :tag "Safe Only" :safe) | 688 | (const :tag "Safe Only" :safe) |
| @@ -3696,6 +3697,18 @@ variable to set.") | |||
| 3696 | "A list of file-local variables that are always enabled. | 3697 | "A list of file-local variables that are always enabled. |
| 3697 | This overrides any `enable-local-variables' setting.") | 3698 | This overrides any `enable-local-variables' setting.") |
| 3698 | 3699 | ||
| 3700 | (defcustom safe-local-variable-directories '() | ||
| 3701 | "A list of directories where local variables are always enabled. | ||
| 3702 | Directory-local variables loaded from these directories, such as the | ||
| 3703 | variables in .dir-locals.el, will be enabled even if they are risky. | ||
| 3704 | The names of the directories in the list must be absolute, and must | ||
| 3705 | end in a slash. Remote directories can be included if the | ||
| 3706 | variable `enable-remote-dir-locals' is non-nil." | ||
| 3707 | :version "30.1" | ||
| 3708 | :type '(repeat string) | ||
| 3709 | :risky t | ||
| 3710 | :group 'find-file) | ||
| 3711 | |||
| 3699 | (defun hack-local-variables-confirm (all-vars unsafe-vars risky-vars dir-name) | 3712 | (defun hack-local-variables-confirm (all-vars unsafe-vars risky-vars dir-name) |
| 3700 | "Get confirmation before setting up local variable values. | 3713 | "Get confirmation before setting up local variable values. |
| 3701 | ALL-VARS is the list of all variables to be set up. | 3714 | ALL-VARS is the list of all variables to be set up. |
| @@ -3734,7 +3747,11 @@ n -- to ignore the local variables list.") | |||
| 3734 | ! -- to apply the local variables list, and permanently mark these | 3747 | ! -- to apply the local variables list, and permanently mark these |
| 3735 | values (*) as safe (in the future, they will be set automatically.) | 3748 | values (*) as safe (in the future, they will be set automatically.) |
| 3736 | i -- to ignore the local variables list, and permanently mark these | 3749 | i -- to ignore the local variables list, and permanently mark these |
| 3737 | values (*) as ignored\n\n") | 3750 | values (*) as ignored" |
| 3751 | (if dir-name " | ||
| 3752 | + -- to apply the local variables list, and trust all directory-local | ||
| 3753 | variables in this directory\n\n" | ||
| 3754 | "\n\n")) | ||
| 3738 | (insert "\n\n")) | 3755 | (insert "\n\n")) |
| 3739 | (dolist (elt all-vars) | 3756 | (dolist (elt all-vars) |
| 3740 | (cond ((member elt unsafe-vars) | 3757 | (cond ((member elt unsafe-vars) |
| @@ -3758,7 +3775,11 @@ i -- to ignore the local variables list, and permanently mark these | |||
| 3758 | (pop-to-buffer buf '(display-buffer--maybe-at-bottom)) | 3775 | (pop-to-buffer buf '(display-buffer--maybe-at-bottom)) |
| 3759 | (let* ((exit-chars '(?y ?n ?\s)) | 3776 | (let* ((exit-chars '(?y ?n ?\s)) |
| 3760 | (prompt (format "Please type %s%s: " | 3777 | (prompt (format "Please type %s%s: " |
| 3761 | (if offer-save "y, n, ! or i" "y or n") | 3778 | (if offer-save |
| 3779 | (if dir-name | ||
| 3780 | "y, n, !, i, +" | ||
| 3781 | "y, n, !, i") | ||
| 3782 | "y or n") | ||
| 3762 | (if (< (line-number-at-pos (point-max)) | 3783 | (if (< (line-number-at-pos (point-max)) |
| 3763 | (window-body-height)) | 3784 | (window-body-height)) |
| 3764 | "" | 3785 | "" |
| @@ -3766,8 +3787,13 @@ i -- to ignore the local variables list, and permanently mark these | |||
| 3766 | char) | 3787 | char) |
| 3767 | (when offer-save | 3788 | (when offer-save |
| 3768 | (push ?i exit-chars) | 3789 | (push ?i exit-chars) |
| 3769 | (push ?! exit-chars)) | 3790 | (push ?! exit-chars) |
| 3791 | (when dir-name | ||
| 3792 | (push ?+ exit-chars))) | ||
| 3770 | (setq char (read-char-choice prompt exit-chars)) | 3793 | (setq char (read-char-choice prompt exit-chars)) |
| 3794 | (when (and offer-save dir-name (= char ?+)) | ||
| 3795 | (customize-push-and-save 'safe-local-variable-directories | ||
| 3796 | (list dir-name))) | ||
| 3771 | (when (and offer-save | 3797 | (when (and offer-save |
| 3772 | (or (= char ?!) (= char ?i)) | 3798 | (or (= char ?!) (= char ?i)) |
| 3773 | unsafe-vars) | 3799 | unsafe-vars) |
| @@ -3776,7 +3802,7 @@ i -- to ignore the local variables list, and permanently mark these | |||
| 3776 | 'safe-local-variable-values | 3802 | 'safe-local-variable-values |
| 3777 | 'ignored-local-variable-values) | 3803 | 'ignored-local-variable-values) |
| 3778 | unsafe-vars)) | 3804 | unsafe-vars)) |
| 3779 | (prog1 (memq char '(?! ?\s ?y)) | 3805 | (prog1 (memq char '(?! ?\s ?y ?+)) |
| 3780 | (quit-window t))))))) | 3806 | (quit-window t))))))) |
| 3781 | 3807 | ||
| 3782 | (defconst hack-local-variable-regexp | 3808 | (defconst hack-local-variable-regexp |
| @@ -3908,6 +3934,7 @@ DIR-NAME is the name of the associated directory. Otherwise it is nil." | |||
| 3908 | (null unsafe-vars) | 3934 | (null unsafe-vars) |
| 3909 | (null risky-vars)) | 3935 | (null risky-vars)) |
| 3910 | (memq enable-local-variables '(:all :safe)) | 3936 | (memq enable-local-variables '(:all :safe)) |
| 3937 | (member dir-name safe-local-variable-directories) | ||
| 3911 | (hack-local-variables-confirm all-vars unsafe-vars | 3938 | (hack-local-variables-confirm all-vars unsafe-vars |
| 3912 | risky-vars dir-name)) | 3939 | risky-vars dir-name)) |
| 3913 | (dolist (elt all-vars) | 3940 | (dolist (elt all-vars) |
diff --git a/lisp/net/soap-client.el b/lisp/net/soap-client.el index e4b8bbd9cb5..866b33decc6 100644 --- a/lisp/net/soap-client.el +++ b/lisp/net/soap-client.el | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | ;; Author: Alexandru Harsanyi <AlexHarsanyi@gmail.com> | 5 | ;; Author: Alexandru Harsanyi <AlexHarsanyi@gmail.com> |
| 6 | ;; Author: Thomas Fitzsimmons <fitzsim@fitzsim.org> | 6 | ;; Author: Thomas Fitzsimmons <fitzsim@fitzsim.org> |
| 7 | ;; Created: December, 2009 | 7 | ;; Created: December, 2009 |
| 8 | ;; Version: 3.2.1 | 8 | ;; Version: 3.2.2 |
| 9 | ;; Keywords: soap, web-services, comm, hypermedia | 9 | ;; Keywords: soap, web-services, comm, hypermedia |
| 10 | ;; Package: soap-client | 10 | ;; Package: soap-client |
| 11 | ;; URL: https://github.com/alex-hhh/emacs-soap-client | 11 | ;; URL: https://github.com/alex-hhh/emacs-soap-client |
| @@ -717,9 +717,12 @@ representing leap seconds." | |||
| 717 | second) | 717 | second) |
| 718 | minute hour day month year second-fraction datatype time-zone) | 718 | minute hour day month year second-fraction datatype time-zone) |
| 719 | (let ((time | 719 | (let ((time |
| 720 | (encode-time (list | 720 | ;; Continue calling encode-time the old way, for backward |
| 721 | (if new-decode-time new-decode-time-second second) | 721 | ;; compatibility in GNU ELPA. |
| 722 | minute hour day month year nil nil time-zone)))) | 722 | (apply |
| 723 | #'encode-time (list | ||
| 724 | (if new-decode-time new-decode-time-second second) | ||
| 725 | minute hour day month year nil nil time-zone)))) | ||
| 723 | (if new-decode-time | 726 | (if new-decode-time |
| 724 | (with-no-warnings (decode-time time nil t)) | 727 | (with-no-warnings (decode-time time nil t)) |
| 725 | (decode-time time)))))) | 728 | (decode-time time)))))) |
| @@ -946,7 +949,7 @@ This is a specialization of `soap-encode-attributes' for | |||
| 946 | (t nil))) | 949 | (t nil))) |
| 947 | 950 | ||
| 948 | (defun soap-type-is-array? (type) | 951 | (defun soap-type-is-array? (type) |
| 949 | "Return t if TYPE defines an ARRAY." | 952 | "Return t if TYPE is an ARRAY." |
| 950 | (and (soap-xs-complex-type-p type) | 953 | (and (soap-xs-complex-type-p type) |
| 951 | (eq (soap-xs-complex-type-indicator type) 'array))) | 954 | (eq (soap-xs-complex-type-indicator type) 'array))) |
| 952 | 955 | ||
diff --git a/lisp/progmodes/prog-mode.el b/lisp/progmodes/prog-mode.el index 7a53399ad14..16497097061 100644 --- a/lisp/progmodes/prog-mode.el +++ b/lisp/progmodes/prog-mode.el | |||
| @@ -36,6 +36,7 @@ | |||
| 36 | (declare-function treesit-available-p "treesit.c") | 36 | (declare-function treesit-available-p "treesit.c") |
| 37 | (declare-function treesit-parser-list "treesit.c") | 37 | (declare-function treesit-parser-list "treesit.c") |
| 38 | (declare-function treesit-node-type "treesit.c") | 38 | (declare-function treesit-node-type "treesit.c") |
| 39 | (declare-function treesit-node-at "treesit.c") | ||
| 39 | 40 | ||
| 40 | (defgroup prog-mode nil | 41 | (defgroup prog-mode nil |
| 41 | "Generic programming mode, from which others derive." | 42 | "Generic programming mode, from which others derive." |
diff --git a/lisp/term/haiku-win.el b/lisp/term/haiku-win.el index ae5a2f2fc6b..50c9cb5b9d4 100644 --- a/lisp/term/haiku-win.el +++ b/lisp/term/haiku-win.el | |||
| @@ -36,6 +36,9 @@ | |||
| 36 | (require 'menu-bar) | 36 | (require 'menu-bar) |
| 37 | (require 'fontset) | 37 | (require 'fontset) |
| 38 | (require 'dnd) | 38 | (require 'dnd) |
| 39 | ;; For when building a --without-x configuration, where this is not | ||
| 40 | ;; preloaded. | ||
| 41 | (eval-when-compile (require 'mwheel)) | ||
| 39 | 42 | ||
| 40 | (add-to-list 'display-format-alist '(".*" . haiku)) | 43 | (add-to-list 'display-format-alist '(".*" . haiku)) |
| 41 | 44 | ||
diff --git a/lisp/x-dnd.el b/lisp/x-dnd.el index acfbbed9677..b87fc97f8fd 100644 --- a/lisp/x-dnd.el +++ b/lisp/x-dnd.el | |||
| @@ -31,6 +31,9 @@ | |||
| 31 | ;;; Code: | 31 | ;;; Code: |
| 32 | 32 | ||
| 33 | (require 'dnd) | 33 | (require 'dnd) |
| 34 | ;; For when building a --without-x configuration, where this is not | ||
| 35 | ;; preloaded. | ||
| 36 | (eval-when-compile (require 'mwheel)) | ||
| 34 | 37 | ||
| 35 | ;;; Customizable variables | 38 | ;;; Customizable variables |
| 36 | (defcustom x-dnd-test-function #'x-dnd-default-test-function | 39 | (defcustom x-dnd-test-function #'x-dnd-default-test-function |
diff --git a/src/lread.c b/src/lread.c index fe48e614393..1d49e7ae6cd 100644 --- a/src/lread.c +++ b/src/lread.c | |||
| @@ -2883,12 +2883,6 @@ character_name_to_code (char const *name, ptrdiff_t name_len, | |||
| 2883 | Unicode 9.0.0 the maximum is 83, so this should be safe. */ | 2883 | Unicode 9.0.0 the maximum is 83, so this should be safe. */ |
| 2884 | enum { UNICODE_CHARACTER_NAME_LENGTH_BOUND = 200 }; | 2884 | enum { UNICODE_CHARACTER_NAME_LENGTH_BOUND = 200 }; |
| 2885 | 2885 | ||
| 2886 | static AVOID | ||
| 2887 | invalid_escape_syntax_error (void) | ||
| 2888 | { | ||
| 2889 | error ("Invalid escape character syntax"); | ||
| 2890 | } | ||
| 2891 | |||
| 2892 | /* Read a character escape sequence, assuming we just read a backslash | 2886 | /* Read a character escape sequence, assuming we just read a backslash |
| 2893 | and one more character (next_char). */ | 2887 | and one more character (next_char). */ |
| 2894 | static int | 2888 | static int |
| @@ -2920,7 +2914,7 @@ read_char_escape (Lisp_Object readcharfun, int next_char) | |||
| 2920 | 2914 | ||
| 2921 | case '\n': | 2915 | case '\n': |
| 2922 | /* ?\LF is an error; it's probably a user mistake. */ | 2916 | /* ?\LF is an error; it's probably a user mistake. */ |
| 2923 | error ("Invalid escape character syntax"); | 2917 | error ("Invalid escape char syntax: \\<newline>"); |
| 2924 | 2918 | ||
| 2925 | /* \M-x etc: set modifier bit and parse the char to which it applies, | 2919 | /* \M-x etc: set modifier bit and parse the char to which it applies, |
| 2926 | allowing for chains such as \M-\S-\A-\H-\s-\C-q. */ | 2920 | allowing for chains such as \M-\S-\A-\H-\s-\C-q. */ |
| @@ -2944,7 +2938,7 @@ read_char_escape (Lisp_Object readcharfun, int next_char) | |||
| 2944 | } | 2938 | } |
| 2945 | else | 2939 | else |
| 2946 | /* \M, \S, \H, \A not followed by a hyphen is an error. */ | 2940 | /* \M, \S, \H, \A not followed by a hyphen is an error. */ |
| 2947 | invalid_escape_syntax_error (); | 2941 | error ("Invalid escape char syntax: \\%c not followed by -", c); |
| 2948 | } | 2942 | } |
| 2949 | modifiers |= mod; | 2943 | modifiers |= mod; |
| 2950 | c1 = READCHAR; | 2944 | c1 = READCHAR; |
| @@ -2964,7 +2958,7 @@ read_char_escape (Lisp_Object readcharfun, int next_char) | |||
| 2964 | { | 2958 | { |
| 2965 | int c1 = READCHAR; | 2959 | int c1 = READCHAR; |
| 2966 | if (c1 != '-') | 2960 | if (c1 != '-') |
| 2967 | invalid_escape_syntax_error (); | 2961 | error ("Invalid escape char syntax: \\%c not followed by -", c); |
| 2968 | } | 2962 | } |
| 2969 | FALLTHROUGH; | 2963 | FALLTHROUGH; |
| 2970 | /* The prefixes \C- and \^ are equivalent. */ | 2964 | /* The prefixes \C- and \^ are equivalent. */ |
| @@ -3029,7 +3023,7 @@ read_char_escape (Lisp_Object readcharfun, int next_char) | |||
| 3029 | } | 3023 | } |
| 3030 | 3024 | ||
| 3031 | if (count == 0) | 3025 | if (count == 0) |
| 3032 | invalid_escape_syntax_error (); | 3026 | error ("Invalid escape char syntax: \\x not followed by hex digit"); |
| 3033 | if (count < 3 && i >= 0x80) | 3027 | if (count < 3 && i >= 0x80) |
| 3034 | i = BYTE8_TO_CHAR (i); | 3028 | i = BYTE8_TO_CHAR (i); |
| 3035 | modifiers |= i & CHAR_MODIFIER_MASK; | 3029 | modifiers |= i & CHAR_MODIFIER_MASK; |
diff --git a/test/lisp/files-tests.el b/test/lisp/files-tests.el index aadb60e1de7..e87bb3cfa0a 100644 --- a/test/lisp/files-tests.el +++ b/test/lisp/files-tests.el | |||
| @@ -166,6 +166,27 @@ form.") | |||
| 166 | (hack-local-variables) | 166 | (hack-local-variables) |
| 167 | (should (eq lexical-binding nil))))) | 167 | (should (eq lexical-binding nil))))) |
| 168 | 168 | ||
| 169 | (ert-deftest files-tests-safe-local-variable-directories () | ||
| 170 | ;; safe-local-variable-directories should be risky, | ||
| 171 | ;; so use it as an arbitrary risky variable. | ||
| 172 | (let ((test-alist '((safe-local-variable-directories . "some_val"))) | ||
| 173 | (fakedir "/test1/test2/") | ||
| 174 | (enable-local-eval t)) | ||
| 175 | (with-temp-buffer | ||
| 176 | (setq safe-local-variable-directories (list fakedir)) | ||
| 177 | (hack-local-variables-filter test-alist fakedir) | ||
| 178 | (should (equal file-local-variables-alist test-alist))) | ||
| 179 | (with-temp-buffer | ||
| 180 | (setq safe-local-variable-directories (list fakedir)) | ||
| 181 | (setq noninteractive t) | ||
| 182 | (hack-local-variables-filter test-alist "wrong") | ||
| 183 | (should-not (equal file-local-variables-alist test-alist))) | ||
| 184 | (with-temp-buffer | ||
| 185 | (setq safe-local-variable-directories '()) | ||
| 186 | (setq noninteractive t) | ||
| 187 | (hack-local-variables-filter test-alist fakedir) | ||
| 188 | (should-not (equal file-local-variables-alist test-alist))))) | ||
| 189 | |||
| 169 | (defvar files-test-bug-18141-file | 190 | (defvar files-test-bug-18141-file |
| 170 | (ert-resource-file "files-bug18141.el.gz") | 191 | (ert-resource-file "files-bug18141.el.gz") |
| 171 | "Test file for bug#18141.") | 192 | "Test file for bug#18141.") |