[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 82849f9a20b: Merge from origin/emacs-29
From: |
Stefan Kangas |
Subject: |
master 82849f9a20b: Merge from origin/emacs-29 |
Date: |
Wed, 7 Dec 2022 00:46:29 -0500 (EST) |
branch: master
commit 82849f9a20bcc043b23c59905044b7f69d8f54a1
Merge: f0e118d3f67 9ae1c2762d7
Author: Stefan Kangas <stefankangas@gmail.com>
Commit: Stefan Kangas <stefankangas@gmail.com>
Merge from origin/emacs-29
9ae1c2762d7 EUDC: Outline deprecation plans in NEWS
6acf95cbea6 Fix admin/notes/tree-sitter/build-module/build.sh (bug#59...
cc63c086971 * doc/misc/eww.texi (Overview): Improve introduction.
b8790e320e1 Consistent fontification of using-directives in csharp-ts...
5257b9cda43 ; Rename c-ts-fontify-error to c-ts-mode--fontify-error
c6b454df339 ; Improve docstring of c-ts-mode--fontify-variable
6187d001f28 Fontify some keywords in type face in c-ts-mode
b3847c02083 ; Minor cleanup in treesit.c
40af27859e0 ; * lib-src/etags.c (escape_shell_arg_string): Minor doc ...
43b7e7efbf4 Fix etags builds on non-Windows non-MS-DOS machines
7e6d1d1c471 ; Fix last change in etags.c.
01a4035c869 Fix etags local command injection vulnerability
ed4734405df Avoid crashes in a build --without-modules
70a2eb4a0b3 Fix 'add-display-text-property' when OBJECT is non-nil
d58d1dd48ac Do not run slow tests on EMBA
9b9b39a2d89 Lisp reader undefined behaviour excision
# Conflicts:
# etc/NEWS
---
admin/notes/tree-sitter/build-module/batch.sh | 1 +
admin/notes/tree-sitter/build-module/build.sh | 56 ++++++++++---------
doc/misc/eww.texi | 12 +++-
etc/NEWS.29 | 20 +++++++
lib-src/etags.c | 76 ++++++++++++++++++++++++--
lisp/emacs-lisp/subr-x.el | 5 +-
lisp/progmodes/c-ts-mode.el | 21 ++++---
lisp/progmodes/csharp-mode.el | 5 +-
src/lread.c | 20 +++----
src/treesit.c | 10 ++--
test/infra/gitlab-ci.yml | 22 ++++----
test/lisp/emacs-lisp/subr-x-tests.el | 11 +++-
test/lisp/international/ucs-normalize-tests.el | 3 +-
13 files changed, 187 insertions(+), 75 deletions(-)
diff --git a/admin/notes/tree-sitter/build-module/batch.sh
b/admin/notes/tree-sitter/build-module/batch.sh
index deed18978a1..d45f37f4b64 100755
--- a/admin/notes/tree-sitter/build-module/batch.sh
+++ b/admin/notes/tree-sitter/build-module/batch.sh
@@ -12,6 +12,7 @@ languages=(
'python'
'rust'
'typescript'
+ 'tsx'
)
for language in "${languages[@]}"
diff --git a/admin/notes/tree-sitter/build-module/build.sh
b/admin/notes/tree-sitter/build-module/build.sh
index 102ab310fa0..a71ccaa4edb 100755
--- a/admin/notes/tree-sitter/build-module/build.sh
+++ b/admin/notes/tree-sitter/build-module/build.sh
@@ -1,6 +1,7 @@
#!/bin/bash
lang=$1
+topdir="$PWD"
if [ $(uname) == "Darwin" ]
then
@@ -11,24 +12,33 @@ fi
echo "Building ${lang}"
-# Retrieve sources.
-git clone "https://github.com/tree-sitter/tree-sitter-${lang}.git" \
+### Retrieve sources
+
+repo="tree-sitter-${lang}"
+sourcedir="tree-sitter-${lang}/src"
+grammardir="tree-sitter-${lang}"
+
+case "${lang}" in
+ "typescript")
+ sourcedir="tree-sitter-typescript/typescript/src"
+ grammardir="tree-sitter-typescript/typescript"
+ ;;
+ "tsx")
+ repo="tree-sitter-typescript"
+ sourcedir="tree-sitter-typescript/tsx/src"
+ grammardir="tree-sitter-typescript/tsx"
+ ;;
+esac
+
+git clone "https://github.com/tree-sitter/${repo}.git" \
--depth 1 --quiet
-if [ "${lang}" == "typescript" ]
-then
- lang="typescript/tsx"
-fi
-cp tree-sitter-lang.in "tree-sitter-${lang}/src"
-cp emacs-module.h "tree-sitter-${lang}/src"
-cp "tree-sitter-${lang}/grammar.js" "tree-sitter-${lang}/src"
-cd "tree-sitter-${lang}/src"
+cp "${grammardir}"/grammar.js "${sourcedir}"
+# We have to go into the source directory to compile, because some
+# C files referes to files like "../../common/scanner.h".
+cd "${sourcedir}"
-if [ "${lang}" == "typescript/tsx" ]
-then
- lang="tsx"
-fi
+### Build
-# Build.
cc -c -I. parser.c
# Compile scanner.c.
if test -f scanner.c
@@ -48,15 +58,9 @@ else
cc -fPIC -shared *.o -o "libtree-sitter-${lang}.${soext}"
fi
-# Copy out.
-
-if [ "${lang}" == "typescript" ]
-then
- cp "libtree-sitter-${lang}.${soext}" ..
- cd ..
-fi
+### Copy out
-mkdir -p ../../dist
-cp "libtree-sitter-${lang}.${soext}" ../../dist
-cd ../../
-rm -rf "tree-sitter-${lang}"
+mkdir -p "${topdir}/dist"
+cp "libtree-sitter-${lang}.${soext}" "${topdir}/dist"
+cd "${topdir}"
+rm -rf "${repo}"
diff --git a/doc/misc/eww.texi b/doc/misc/eww.texi
index 1060cd805ab..7b32f04aa84 100644
--- a/doc/misc/eww.texi
+++ b/doc/misc/eww.texi
@@ -67,9 +67,15 @@ Indices
@node Overview
@chapter Overview
-@dfn{EWW}, the Emacs Web Wowser, is a web browser for GNU Emacs. It
-can load, parse, and display various web pages using @dfn{shr.el}.
-However, a GNU Emacs with @code{libxml2} support is required.
+
+@dfn{EWW}, the Emacs Web Wowser, is a web browser for GNU Emacs that
+provides a simple, no-frills experience that focuses on readability.
+It loads, parses, and displays web pages using @dfn{shr.el}. It can
+display images inline, if Emacs was built with image support, but
+there is no support for CSS or JavaScript.
+
+To use EWW, you need to use an Emacs built with @code{libxml2}
+support.
@node Basics
@chapter Basic Usage
diff --git a/etc/NEWS.29 b/etc/NEWS.29
index d38ccadba64..dc758f0bc83 100644
--- a/etc/NEWS.29
+++ b/etc/NEWS.29
@@ -1996,6 +1996,26 @@ It narrows to the current node.
** EUDC
++++
+*** Deprecations planned for next release.
+After Emacs 29.1, some aspects of EUDC will be deprecated. The goal
+of these deprecations is to simplify EUDC server configuration by
+making 'eudc-server-hotlist' the only place to add servers. There
+will not be a need to set the server using the 'eudc-set-server'
+function. Instead, the 'eudc-server-hotlist' variable should be
+customized to have an entry for the server. The plan is to obsolete
+the 'eudc-hotlist' editor since Customize is sufficient for changing
+'eudc-server-hotlist'. How the 'eudc-server' variable works in this
+context is to-be-determined; it can't be removed, because that would
+break compatibility, but it may become synchronized with
+'eudc-server-hotlist' so that 'eudc-server' is always equal to (first
+eudc-server-hotlist). The first entry in 'eudc-server-hotlist' is the
+first server tried by 'eudc-expand-try-all'. The hotlist
+simplification will allow 'eudc-query-form' to show a drop down of
+possible servers, instead of requiring a call to 'eudc-set-server'
+like it does in this release. The default value of
+'eudc-ignore-options-file' will be changed from nil to t.
+
+++
*** New user option 'eudc-ignore-options-file' that defaults to nil.
The 'eudc-ignore-options-file' user option can be configured to ignore
diff --git a/lib-src/etags.c b/lib-src/etags.c
index d1d20858cdd..a06c236140f 100644
--- a/lib-src/etags.c
+++ b/lib-src/etags.c
@@ -401,6 +401,9 @@ static void invalidate_nodes (fdesc *, node **);
static void put_entries (node *);
static void cleanup_tags_file (char const * const, char const * const);
+#if !MSDOS && !defined (DOS_NT)
+static char *escape_shell_arg_string (char *);
+#endif
static void do_move_file (const char *, const char *);
static char *concat (const char *, const char *, const char *);
static char *skip_spaces (char *);
@@ -1413,7 +1416,7 @@ main (int argc, char **argv)
setenv ("LC_COLLATE", "C", 1);
setenv ("LC_ALL", "C", 1); */
char *cmd = xmalloc (8 * strlen (tagfile) + sizeof "sort -u -o '' ''");
-#if defined WINDOWSNT || defined MSDOS
+#if defined WINDOWSNT || MSDOS
/* Quote "like this". No need to escape the quotes in the file name,
since it is not allowed in file names on these systems. */
char *z = stpcpy (cmd, "sort -u -o \"");
@@ -1713,13 +1716,23 @@ process_file_name (char *file, language *lang)
else
{
#if MSDOS || defined (DOS_NT)
- char *cmd1 = concat (compr->command, " \"", real_name);
- char *cmd = concat (cmd1, "\" > ", tmp_name);
+ int buf_len =
+ strlen (compr->command)
+ + strlen (" \"\" > \"\"") + strlen (real_name)
+ + strlen (tmp_name) + 1;
+ char *cmd = xmalloc (buf_len);
+ snprintf (cmd, buf_len, "%s \"%s\" > \"%s\"",
+ compr->command, real_name, tmp_name);
#else
- char *cmd1 = concat (compr->command, " '", real_name);
- char *cmd = concat (cmd1, "' > ", tmp_name);
+ char *new_real_name = escape_shell_arg_string (real_name);
+ char *new_tmp_name = escape_shell_arg_string (tmp_name);
+ int buf_len =
+ strlen (compr->command) + strlen (" > ") + strlen (new_real_name)
+ + strlen (new_tmp_name) + 1;
+ char *cmd = xmalloc (buf_len);
+ snprintf (cmd, buf_len, "%s %s > %s",
+ compr->command, new_real_name, new_tmp_name);
#endif
- free (cmd1);
inf = (system (cmd) == -1
? NULL
: fopen (tmp_name, "r" FOPEN_BINARY));
@@ -7707,6 +7720,57 @@ etags_mktmp (void)
return templt;
}
+#if !MSDOS && !defined (DOS_NT)
+/*
+ * Add single quotes around a string, and escape any single quotes.
+ * Return a newly-allocated string.
+ *
+ * For example:
+ * escape_shell_arg_string ("test.txt") => "'test.txt'"
+ * escape_shell_arg_string ("'test.txt") => "''\''test.txt'"
+ */
+static char *
+escape_shell_arg_string (char *str)
+{
+ char *p = str;
+ int need_space = 2; /* ' at begin and end */
+
+ while (*p != '\0')
+ {
+ if (*p == '\'')
+ need_space += 4; /* ' to '\'', length is 4 */
+ else
+ need_space++;
+
+ p++;
+ }
+
+ char *new_str = xnew (need_space + 1, char);
+ new_str[0] = '\'';
+ new_str[need_space-1] = '\'';
+
+ int i = 1; /* skip first byte */
+ p = str;
+ while (*p != '\0')
+ {
+ new_str[i] = *p;
+ if (*p == '\'')
+ {
+ new_str[i+1] = '\\';
+ new_str[i+2] = '\'';
+ new_str[i+3] = '\'';
+ i += 3;
+ }
+
+ i++;
+ p++;
+ }
+
+ new_str[need_space] = '\0';
+ return new_str;
+}
+#endif
+
static void
do_move_file(const char *src_file, const char *dst_file)
{
diff --git a/lisp/emacs-lisp/subr-x.el b/lisp/emacs-lisp/subr-x.el
index 18087bc937f..0486baba83c 100644
--- a/lisp/emacs-lisp/subr-x.el
+++ b/lisp/emacs-lisp/subr-x.el
@@ -370,7 +370,8 @@ this defaults to the current buffer."
(min end (point-max)))))
(if (not (setq disp (get-text-property sub-start 'display object)))
;; No old properties in this range.
- (put-text-property sub-start sub-end 'display (list prop value))
+ (put-text-property sub-start sub-end 'display (list prop value)
+ object)
;; We have old properties.
(let ((vector nil))
;; Make disp into a list.
@@ -390,7 +391,7 @@ this defaults to the current buffer."
(when vector
(setq disp (seq-into disp 'vector)))
;; Finally update the range.
- (put-text-property sub-start sub-end 'display disp)))
+ (put-text-property sub-start sub-end 'display disp object)))
(setq sub-start sub-end))))
;;;###autoload
diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el
index 1bd093cfa2d..0c66b4959e0 100644
--- a/lisp/progmodes/c-ts-mode.el
+++ b/lisp/progmodes/c-ts-mode.el
@@ -169,9 +169,9 @@ MODE is either `c' or `cpp'."
'("break" "case" "const" "continue"
"default" "do" "else" "enum"
"extern" "for" "goto" "if" "inline"
- "long" "register" "return" "short"
- "signed" "sizeof" "static" "struct"
- "switch" "typedef" "union" "unsigned"
+ "register" "return"
+ "sizeof" "static" "struct"
+ "switch" "typedef" "union"
"volatile" "while")))
(if (eq mode 'cpp)
(append c-keywords
@@ -188,6 +188,10 @@ MODE is either `c' or `cpp'."
"xor" "xor_eq"))
(append '("auto") c-keywords))))
+(defvar c-ts-mode--type-keywords
+ '("long" "short" "signed" "unsigned")
+ "Keywords that should be considered as part of a type.")
+
(defvar c-ts-mode--operators
'("=" "-" "*" "/" "+" "%" "~" "|" "&" "^" "<<" ">>" "->"
"." "<" "<=" ">=" ">" "==" "!=" "!" "&&" "||" "-="
@@ -263,7 +267,8 @@ MODE is either `c' or `cpp'."
(qualified_identifier
scope: (namespace_identifier) @font-lock-type-face)
- (operator_cast) type: (type_identifier) @font-lock-type-face)))
+ (operator_cast) type: (type_identifier) @font-lock-type-face))
+ [,@c-ts-mode--type-keywords] @font-lock-type-face)
:language mode
:feature 'definition
@@ -314,7 +319,7 @@ MODE is either `c' or `cpp'."
:language mode
:feature 'error
- '((ERROR) @c-ts-fontify-error)
+ '((ERROR) @c-ts-mode--fontify-error)
:feature 'escape-sequence
:language mode
@@ -367,8 +372,8 @@ For NODE, OVERRIDE, START, END, and ARGS, see
override start end))))
(defun c-ts-mode--fontify-variable (node override start end &rest _)
- "Fontify an identifier node.
-Fontify it if NODE is not a function identifier. For NODE,
+ "Fontify an identifier node if it is a variable.
+Don't fontify if it is a function identifier. For NODE,
OVERRIDE, START, END, and ARGS, see `treesit-font-lock-rules'."
(when (not (equal (treesit-node-type
(treesit-node-parent node))
@@ -416,7 +421,7 @@ This function corrects the fontification on the colon in
(treesit-node-start arg) (treesit-node-end arg)
'default override start end))))))
-(defun c-ts-fontify-error (node override start end &rest _)
+(defun c-ts-mode--fontify-error (node override start end &rest _)
"Fontify the error nodes.
For NODE, OVERRIDE, START, and END, see
`treesit-font-lock-rules'."
diff --git a/lisp/progmodes/csharp-mode.el b/lisp/progmodes/csharp-mode.el
index 054dabfed07..bdddb46e727 100644
--- a/lisp/progmodes/csharp-mode.el
+++ b/lisp/progmodes/csharp-mode.el
@@ -748,8 +748,11 @@ compilation and evaluation time conflicts."
:language 'c-sharp
:feature 'definition
:override t
- '((qualified_name (identifier) @font-lock-variable-name-face)
+ '((qualified_name (identifier) @font-lock-type-face)
(using_directive (identifier) @font-lock-type-face)
+ (using_directive (name_equals
+ (identifier) @font-lock-type-face
+ ["="] @default-face))
(enum_declaration (identifier) @font-lock-type-face)
(enum_member_declaration (identifier) @font-lock-variable-name-face)
diff --git a/src/lread.c b/src/lread.c
index 0a6e4201e40..51ea3e5b929 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -3375,7 +3375,7 @@ read_bool_vector (Lisp_Object readcharfun)
break;
}
if (INT_MULTIPLY_WRAPV (length, 10, &length)
- | INT_ADD_WRAPV (length, c - '0', &length))
+ || INT_ADD_WRAPV (length, c - '0', &length))
invalid_syntax ("#&", readcharfun);
}
@@ -3421,7 +3421,7 @@ skip_lazy_string (Lisp_Object readcharfun)
break;
}
if (INT_MULTIPLY_WRAPV (nskip, 10, &nskip)
- | INT_ADD_WRAPV (nskip, c - '0', &nskip))
+ || INT_ADD_WRAPV (nskip, c - '0', &nskip))
invalid_syntax ("#@", readcharfun);
digits++;
if (digits == 2 && nskip == 0)
@@ -5468,6 +5468,14 @@ to the specified file name if a suffix is allowed or
required. */);
Vload_suffixes =
Fcons (build_pure_c_string (MODULES_SECONDARY_SUFFIX), Vload_suffixes);
#endif
+#endif
+ DEFVAR_LISP ("module-file-suffix", Vmodule_file_suffix,
+ doc: /* Suffix of loadable module file, or nil if modules are
not supported. */);
+#ifdef HAVE_MODULES
+ Vmodule_file_suffix = build_pure_c_string (MODULES_SUFFIX);
+#else
+ Vmodule_file_suffix = Qnil;
+#endif
DEFVAR_LISP ("dynamic-library-suffixes", Vdynamic_library_suffixes,
doc: /* A list of suffixes for loadable dynamic libraries. */);
@@ -5477,14 +5485,6 @@ to the specified file name if a suffix is allowed or
required. */);
Fcons (build_pure_c_string (DYNAMIC_LIB_SUFFIX),
Vdynamic_library_suffixes);
-#endif
- DEFVAR_LISP ("module-file-suffix", Vmodule_file_suffix,
- doc: /* Suffix of loadable module file, or nil if modules are
not supported. */);
-#ifdef HAVE_MODULES
- Vmodule_file_suffix = build_pure_c_string (MODULES_SUFFIX);
-#else
- Vmodule_file_suffix = Qnil;
-#endif
DEFVAR_LISP ("load-file-rep-suffixes", Vload_file_rep_suffixes,
doc: /* List of suffixes that indicate representations of \
the same file.
diff --git a/src/treesit.c b/src/treesit.c
index 343054ed53e..9926806612a 100644
--- a/src/treesit.c
+++ b/src/treesit.c
@@ -1501,9 +1501,9 @@ buffer. */)
for (int idx = 0; !NILP (ranges); idx++, ranges = XCDR (ranges))
{
Lisp_Object range = XCAR (ranges);
- EMACS_INT beg_byte = buf_charpos_to_bytepos (buffer,
+ ptrdiff_t beg_byte = buf_charpos_to_bytepos (buffer,
XFIXNUM (XCAR (range)));
- EMACS_INT end_byte = buf_charpos_to_bytepos (buffer,
+ ptrdiff_t end_byte = buf_charpos_to_bytepos (buffer,
XFIXNUM (XCDR (range)));
/* Shouldn't violate assertion since we just checked for
buffer size at the beginning of this function. */
@@ -2507,10 +2507,8 @@ the query. */)
/* Set query range. */
if (!NILP (beg) && !NILP (end))
{
- EMACS_INT beg_byte = buf_charpos_to_bytepos (current_buffer,
- XFIXNUM (beg));
- EMACS_INT end_byte = buf_charpos_to_bytepos (current_buffer,
- XFIXNUM (end));
+ ptrdiff_t beg_byte = CHAR_TO_BYTE (XFIXNUM (beg));
+ ptrdiff_t end_byte = CHAR_TO_BYTE (XFIXNUM (end));
/* We never let tree-sitter run on buffers too large, so these
assertion should never hit. */
eassert (beg_byte - visible_beg <= UINT32_MAX);
diff --git a/test/infra/gitlab-ci.yml b/test/infra/gitlab-ci.yml
index e034430edce..64b47eb7e47 100644
--- a/test/infra/gitlab-ci.yml
+++ b/test/infra/gitlab-ci.yml
@@ -155,7 +155,7 @@ default:
.filenotify-gio-template:
rules:
- if: '$CI_PIPELINE_SOURCE == "web"'
- - if: '$CI_PIPELINE_SOURCE == "schedule"'
+ # - if: '$CI_PIPELINE_SOURCE == "schedule"'
changes:
- "**.in"
- lisp/autorevert.el
@@ -252,17 +252,17 @@ build-native-comp-speed0:
variables:
target: emacs-native-comp-speed0
-build-native-comp-speed1:
- stage: native-comp-images
- extends: [.job-template, .build-template, .native-comp-template]
- variables:
- target: emacs-native-comp-speed1
+# build-native-comp-speed1:
+# stage: native-comp-images
+# extends: [.job-template, .build-template, .native-comp-template]
+# variables:
+# target: emacs-native-comp-speed1
-build-native-comp-speed2:
- stage: native-comp-images
- extends: [.job-template, .build-template, .native-comp-template]
- variables:
- target: emacs-native-comp-speed2
+# build-native-comp-speed2:
+# stage: native-comp-images
+# extends: [.job-template, .build-template, .native-comp-template]
+# variables:
+# target: emacs-native-comp-speed2
test-native-comp-speed0:
stage: native-comp
diff --git a/test/lisp/emacs-lisp/subr-x-tests.el
b/test/lisp/emacs-lisp/subr-x-tests.el
index 7a3efe9db62..e80d2e17e8d 100644
--- a/test/lisp/emacs-lisp/subr-x-tests.el
+++ b/test/lisp/emacs-lisp/subr-x-tests.el
@@ -707,7 +707,16 @@
(should (equal (get-text-property 2 'display) '(raise 0.5)))
(should (equal (get-text-property 5 'display)
[(raise 0.5) (height 2.0)]))
- (should (equal (get-text-property 9 'display) '(raise 0.5)))))
+ (should (equal (get-text-property 9 'display) '(raise 0.5))))
+ (with-temp-buffer
+ (should (equal (let ((str "some useless string"))
+ (add-display-text-property 4 8 'height 2.0 str)
+ (add-display-text-property 2 12 'raise 0.5 str)
+ str)
+ #("some useless string"
+ 2 4 (display (raise 0.5))
+ 4 8 (display ((raise 0.5) (height 2.0)))
+ 8 12 (display (raise 0.5)))))))
(ert-deftest subr-x-named-let ()
(let ((funs ()))
diff --git a/test/lisp/international/ucs-normalize-tests.el
b/test/lisp/international/ucs-normalize-tests.el
index 8d7ac5eb8b1..380140308aa 100644
--- a/test/lisp/international/ucs-normalize-tests.el
+++ b/test/lisp/international/ucs-normalize-tests.el
@@ -255,7 +255,8 @@ Must be called with `ucs-normalize-tests--norm-buf' as
current buffer."
(ert-deftest ucs-normalize-part1 ()
:tags '(:expensive-test)
- (skip-unless (not (getenv "EMACS_HYDRA_CI"))) ; SLOW ~ 1800s
+ (skip-unless (not (or (getenv "EMACS_HYDRA_CI")
+ (getenv "EMACS_EMBA_CI")))) ; SLOW ~ 1800s
;; This takes a long time, so make sure we're compiled.
(dolist (fun '(ucs-normalize-tests--part1-rule2
ucs-normalize-tests--rule1-failing-for-partX