1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-02-04 06:31:13 -08:00

Merge remote-tracking branch 'origin/master' into feature/android

This commit is contained in:
Po Lu 2023-05-12 10:43:52 +08:00
commit 7ac8bcaacc
11 changed files with 109 additions and 20 deletions

View file

@ -1328,6 +1328,15 @@ 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.
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
@cindex risky variable
@ -1344,6 +1353,17 @@ record safe values for risky variables, do it directly by customizing
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 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}).
@vindex enable-local-variables
The variable @code{enable-local-variables} allows you to change the
way Emacs processes local variables. Its default value is @code{t},

View file

@ -1977,6 +1977,18 @@ this can be controlled by using this variable, which is a list of
symbols.
@end defvar
@defvar safe-local-variable-directories
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 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
This function parses, and binds or evaluates as appropriate, any local
variables specified by the contents of the current buffer. The variable

View file

@ -417,6 +417,10 @@ The new functions 'touch-screen-track-tap' and
'touch-screen-track-drag' handle tracking common touch screen gestures
from within a command.
** New variable 'safe-local-variable-directories'.
This variable names directories in which Emacs will treat all
directory-local variables as safe.
** New variable 'inhibit-auto-fill' to temporarily prevent auto-fill.
** Functions and variables to transpose sexps

View file

@ -33,6 +33,7 @@
;;; Customizable variables
(declare-function font-get-system-font "xsettings.c" ())
(declare-function reconsider-frame-font "frame.c" ())
(defvar font-use-system-font)

View file

@ -681,7 +681,8 @@ The command \\[normal-mode], when used interactively,
always obeys file local variable specifications and the -*- line,
and ignores this variable.
Also see the `permanently-enabled-local-variables' variable."
Also see the `permanently-enabled-local-variables' and
`safe-local-variable-directories' variables."
:risky t
:type '(choice (const :tag "Query Unsafe" t)
(const :tag "Safe Only" :safe)
@ -3696,6 +3697,18 @@ variable to set.")
"A list of file-local variables that are always enabled.
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.
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
:group 'find-file)
(defun hack-local-variables-confirm (all-vars unsafe-vars risky-vars dir-name)
"Get confirmation before setting up local variable values.
ALL-VARS is the list of all variables to be set up.
@ -3734,7 +3747,11 @@ n -- to ignore the local variables list.")
! -- to apply the local variables list, and permanently mark these
values (*) as safe (in the future, they will be set automatically.)
i -- to ignore the local variables list, and permanently mark these
values (*) as ignored\n\n")
values (*) as ignored"
(if dir-name "
+ -- to apply the local variables list, and trust all directory-local
variables in this directory\n\n"
"\n\n"))
(insert "\n\n"))
(dolist (elt all-vars)
(cond ((member elt unsafe-vars)
@ -3758,7 +3775,11 @@ i -- to ignore the local variables list, and permanently mark these
(pop-to-buffer buf '(display-buffer--maybe-at-bottom))
(let* ((exit-chars '(?y ?n ?\s))
(prompt (format "Please type %s%s: "
(if offer-save "y, n, ! or i" "y or n")
(if offer-save
(if dir-name
"y, n, !, i, +"
"y, n, !, i")
"y or n")
(if (< (line-number-at-pos (point-max))
(window-body-height))
""
@ -3766,8 +3787,13 @@ i -- to ignore the local variables list, and permanently mark these
char)
(when offer-save
(push ?i exit-chars)
(push ?! exit-chars))
(push ?! exit-chars)
(when dir-name
(push ?+ exit-chars)))
(setq char (read-char-choice prompt exit-chars))
(when (and offer-save dir-name (= char ?+))
(customize-push-and-save 'safe-local-variable-directories
(list dir-name)))
(when (and offer-save
(or (= char ?!) (= char ?i))
unsafe-vars)
@ -3776,7 +3802,7 @@ i -- to ignore the local variables list, and permanently mark these
'safe-local-variable-values
'ignored-local-variable-values)
unsafe-vars))
(prog1 (memq char '(?! ?\s ?y))
(prog1 (memq char '(?! ?\s ?y ?+))
(quit-window t)))))))
(defconst hack-local-variable-regexp
@ -3908,6 +3934,7 @@ DIR-NAME is the name of the associated directory. Otherwise it is nil."
(null unsafe-vars)
(null risky-vars))
(memq enable-local-variables '(:all :safe))
(member dir-name safe-local-variable-directories)
(hack-local-variables-confirm all-vars unsafe-vars
risky-vars dir-name))
(dolist (elt all-vars)

View file

@ -5,7 +5,7 @@
;; Author: Alexandru Harsanyi <AlexHarsanyi@gmail.com>
;; Author: Thomas Fitzsimmons <fitzsim@fitzsim.org>
;; Created: December, 2009
;; Version: 3.2.1
;; Version: 3.2.2
;; Keywords: soap, web-services, comm, hypermedia
;; Package: soap-client
;; URL: https://github.com/alex-hhh/emacs-soap-client
@ -717,9 +717,12 @@ representing leap seconds."
second)
minute hour day month year second-fraction datatype time-zone)
(let ((time
(encode-time (list
(if new-decode-time new-decode-time-second second)
minute hour day month year nil nil time-zone))))
;; Continue calling encode-time the old way, for backward
;; compatibility in GNU ELPA.
(apply
#'encode-time (list
(if new-decode-time new-decode-time-second second)
minute hour day month year nil nil time-zone))))
(if new-decode-time
(with-no-warnings (decode-time time nil t))
(decode-time time))))))
@ -946,7 +949,7 @@ This is a specialization of `soap-encode-attributes' for
(t nil)))
(defun soap-type-is-array? (type)
"Return t if TYPE defines an ARRAY."
"Return t if TYPE is an ARRAY."
(and (soap-xs-complex-type-p type)
(eq (soap-xs-complex-type-indicator type) 'array)))

View file

@ -36,6 +36,7 @@
(declare-function treesit-available-p "treesit.c")
(declare-function treesit-parser-list "treesit.c")
(declare-function treesit-node-type "treesit.c")
(declare-function treesit-node-at "treesit.c")
(defgroup prog-mode nil
"Generic programming mode, from which others derive."

View file

@ -36,6 +36,9 @@
(require 'menu-bar)
(require 'fontset)
(require 'dnd)
;; For when building a --without-x configuration, where this is not
;; preloaded.
(eval-when-compile (require 'mwheel))
(add-to-list 'display-format-alist '(".*" . haiku))

View file

@ -31,6 +31,9 @@
;;; Code:
(require 'dnd)
;; For when building a --without-x configuration, where this is not
;; preloaded.
(eval-when-compile (require 'mwheel))
;;; Customizable variables
(defcustom x-dnd-test-function #'x-dnd-default-test-function

View file

@ -2883,12 +2883,6 @@ character_name_to_code (char const *name, ptrdiff_t name_len,
Unicode 9.0.0 the maximum is 83, so this should be safe. */
enum { UNICODE_CHARACTER_NAME_LENGTH_BOUND = 200 };
static AVOID
invalid_escape_syntax_error (void)
{
error ("Invalid escape character syntax");
}
/* Read a character escape sequence, assuming we just read a backslash
and one more character (next_char). */
static int
@ -2920,7 +2914,7 @@ read_char_escape (Lisp_Object readcharfun, int next_char)
case '\n':
/* ?\LF is an error; it's probably a user mistake. */
error ("Invalid escape character syntax");
error ("Invalid escape char syntax: \\<newline>");
/* \M-x etc: set modifier bit and parse the char to which it applies,
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)
}
else
/* \M, \S, \H, \A not followed by a hyphen is an error. */
invalid_escape_syntax_error ();
error ("Invalid escape char syntax: \\%c not followed by -", c);
}
modifiers |= mod;
c1 = READCHAR;
@ -2964,7 +2958,7 @@ read_char_escape (Lisp_Object readcharfun, int next_char)
{
int c1 = READCHAR;
if (c1 != '-')
invalid_escape_syntax_error ();
error ("Invalid escape char syntax: \\%c not followed by -", c);
}
FALLTHROUGH;
/* The prefixes \C- and \^ are equivalent. */
@ -3029,7 +3023,7 @@ read_char_escape (Lisp_Object readcharfun, int next_char)
}
if (count == 0)
invalid_escape_syntax_error ();
error ("Invalid escape char syntax: \\x not followed by hex digit");
if (count < 3 && i >= 0x80)
i = BYTE8_TO_CHAR (i);
modifiers |= i & CHAR_MODIFIER_MASK;

View file

@ -166,6 +166,27 @@ form.")
(hack-local-variables)
(should (eq lexical-binding nil)))))
(ert-deftest files-tests-safe-local-variable-directories ()
;; safe-local-variable-directories should be risky,
;; so use it as an arbitrary risky variable.
(let ((test-alist '((safe-local-variable-directories . "some_val")))
(fakedir "/test1/test2/")
(enable-local-eval t))
(with-temp-buffer
(setq safe-local-variable-directories (list fakedir))
(hack-local-variables-filter test-alist fakedir)
(should (equal file-local-variables-alist test-alist)))
(with-temp-buffer
(setq safe-local-variable-directories (list fakedir))
(setq noninteractive t)
(hack-local-variables-filter test-alist "wrong")
(should-not (equal file-local-variables-alist test-alist)))
(with-temp-buffer
(setq safe-local-variable-directories '())
(setq noninteractive t)
(hack-local-variables-filter test-alist fakedir)
(should-not (equal file-local-variables-alist test-alist)))))
(defvar files-test-bug-18141-file
(ert-resource-file "files-bug18141.el.gz")
"Test file for bug#18141.")