commit 82849f9a20bcc043b23c59905044b7f69d8f54a1 (HEAD, refs/remotes/origin/master) Merge: f0e118d3f67 9ae1c2762d7 Author: Stefan Kangas Date: Wed Dec 7 06:30:51 2022 +0100 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 commit 9ae1c2762d7f42a775e7623d9676ce4f7fa3c8f2 (refs/remotes/origin/emacs-29) Author: Thomas Fitzsimmons Date: Tue Dec 6 21:41:51 2022 -0500 EUDC: Outline deprecation plans in NEWS * etc/NEWS (EUDC): Mention deprecation plans. diff --git a/etc/NEWS b/etc/NEWS index d38ccadba64..dc758f0bc83 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -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 commit f0e118d3f676afe39df29663399d4bbe8f53f208 Author: Juanma Barranquero Date: Wed Dec 7 02:36:41 2022 +0100 * etc/NEWS: Mention new bs option diff --git a/etc/NEWS b/etc/NEWS index 3eeef0ab4c3..fa4fdc4e910 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -49,6 +49,13 @@ This is a string or a list of strings that specifies the Git log switches for shortlogs, such as the one produced by 'C-x v L'. 'vc-git-log-switches' is no longer used for shortlogs. +** bs + +--- +*** New user option 'bs-default-action-list'. +How to display the "*buffer-selection*" buffer can now be configured +with this new option or by setting 'display-buffer-alist'. + * New Modes and Packages in Emacs 30.1 commit e0a057c16b5fcd9ef48159520501b5d5e438c4a9 Author: Juanma Barranquero Date: Wed Dec 7 02:27:06 2022 +0100 * lisp/bs.el: Improve compatibility with previous version * lisp/bs.el (bs-default-action-list): Remove display-buffer-reuse-window. Ask for a minimum height window, not maximum. (bs-show-in-buffer): Create window here, and afterwards make sure it's the only window showing the *bs-selection* buffer. (bs--show-with-configuration): Move window creation to bs-show-in-buffer. diff --git a/lisp/bs.el b/lisp/bs.el index f880f3973a3..d7eed8f661d 100644 --- a/lisp/bs.el +++ b/lisp/bs.el @@ -488,9 +488,8 @@ bs-mode-map "" #'bs-mouse-select "" #'bs-mouse-select-other-frame) -(defcustom bs-default-action-list '((display-buffer-reuse-window - display-buffer-below-selected) - (window-height . bs-max-window-height)) +(defcustom bs-default-action-list '((display-buffer-below-selected) + (window-height . window-min-height)) "Default action list for showing the '*bs-selection*' buffer. This list will be passed to `pop-to-buffer' as its ACTION argument. @@ -1170,7 +1169,18 @@ bs-show-in-buffer configuration `bs-current-configuration'. Set window height, fontify buffer and move point to current buffer." (setq bs-current-list list) - (switch-to-buffer (get-buffer-create "*buffer-selection*")) + (let* ((window-combination-limit 'window-size) + (bs-buf (get-buffer-create "*buffer-selection*")) + (bs-win (progn + (pop-to-buffer bs-buf bs-default-action-list) + (selected-window)))) + ;; Delete other windows showing *buffer-selection*. + ;; Done after pop-to-buffer, instead of just calling delete-windows-on, + ;; to allow display-buffer-reuse(-mode)?-window to be used in ALIST. + (dolist (w (get-buffer-window-list bs-buf 'not t)) + (unless (eq w bs-win) + (with-demoted-errors "Error deleting window: %S" + (delete-window w))))) (bs-mode) (let* ((inhibit-read-only t) (map-fun (lambda (entry) @@ -1442,9 +1452,6 @@ bs--show-with-configuration ;; Only when not in buffer *buffer-selection* ;; we have to set the buffer we started the command (setq bs--buffer-coming-from (current-buffer))) - (let ((window-combination-limit 'window-size)) - (pop-to-buffer (get-buffer-create "*buffer-selection*") - bs-default-action-list)) (bs-show-in-buffer (bs-buffer-list)) (bs-message-without-log "%s" (bs--current-config-message)))) commit de2491cccc2848dbf50b23c08ca94ea1088af073 Author: Juanma Barranquero Date: Wed Dec 7 02:08:28 2022 +0100 ; * lisp/serve.el: Silence unused arg warning in previous commit diff --git a/lisp/server.el b/lisp/server.el index aa62b25a891..c988d3af0e5 100644 --- a/lisp/server.el +++ b/lisp/server.el @@ -1818,7 +1818,7 @@ server-save-buffers-kill-terminal (save-buffers-kill-emacs arg))) (t (error "Invalid client frame"))))) -(defun server-stop-automatically--handle-delete-frame (frame) +(defun server-stop-automatically--handle-delete-frame (_frame) "Handle deletion of FRAME when `server-stop-automatically' is used." (when (and server-stop-automatically (null (cddr (frame-list)))) commit 6acf95cbea6007c1a11e2e7d8e0a535c3cbe2e33 Author: Yuan Fu Date: Tue Dec 6 15:55:14 2022 -0800 Fix admin/notes/tree-sitter/build-module/build.sh (bug#59789) Besides the problem mentioned by Juri, which is fixed by removing -cp tree-sitter-lang.in "tree-sitter-${lang}/src" -cp emacs-module.h "tree-sitter-${lang}/src" (we removed those files in an earlier commit, because they are not used anymore.) Now it also more parameterized and builds typescript and tsx separately. * admin/notes/tree-sitter/build-module/build.sh (topdir) (repo, sourcedir, grammardir): New variables. (Build): Make it parametric. (Copy out): Use absolute path. * admin/notes/tree-sitter/build-module/batch.sh (languages): Add tsx. 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 @@ lang= 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 @@ lang= 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}" commit cc63c086971a36da7341786ea48ee075020a93d5 Author: Stefan Kangas Date: Wed Dec 7 01:02:48 2022 +0100 * doc/misc/eww.texi (Overview): Improve introduction. 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 @@ Top @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 commit bcf4d96db3a61e0d02a584fa9fceb049cdad6fe8 Author: Jim Porter Date: Fri Dec 2 12:15:46 2022 -0800 ; Remove dead code from 'server-stop-automatically--handle-delete-frame' * lisp/server.el (server-stop-automatically--handle-delete-frame): Since 'this-command' is never 'save-buffers-kill-terminal' in this function, we can remove the second 'if' block and it's then-form, leaving only the else-form. Additionally, remove the 'delete-frame' call; it's not necessary, since we just killed Emacs on the prior line. diff --git a/lisp/server.el b/lisp/server.el index 7e713eaecde..aa62b25a891 100644 --- a/lisp/server.el +++ b/lisp/server.el @@ -1820,26 +1820,10 @@ server-save-buffers-kill-terminal (defun server-stop-automatically--handle-delete-frame (frame) "Handle deletion of FRAME when `server-stop-automatically' is used." - (when server-stop-automatically - (if (if (and (processp (frame-parameter frame 'client)) - (eq this-command 'save-buffers-kill-terminal)) - (progn - (dolist (f (frame-list)) - (when (and (eq (frame-parameter frame 'client) - (frame-parameter f 'client)) - (not (eq frame f))) - (set-frame-parameter f 'client nil) - (let ((server-stop-automatically nil)) - (delete-frame f)))) - (if (cddr (frame-list)) - (let ((server-stop-automatically nil)) - (delete-frame frame) - nil) - t)) - (null (cddr (frame-list)))) - (let ((server-stop-automatically nil)) - (save-buffers-kill-emacs) - (delete-frame frame))))) + (when (and server-stop-automatically + (null (cddr (frame-list)))) + (let ((server-stop-automatically nil)) + (save-buffers-kill-emacs)))) (defun server-stop-automatically--maybe-kill-emacs () "Handle closing of Emacs daemon when `server-stop-automatically' is used." commit b8790e320e10daf42feaffac0f40c4b7b34903dd Author: Jostein Kjønigsen Date: Tue Dec 6 09:40:03 2022 +0100 Consistent fontification of using-directives in csharp-ts-mode * lisp/progmodes/csharp-mode.el (csharp-ts-mode--font-lock-settings): New 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 @@ csharp-ts-mode--font-lock-settings :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) commit 5257b9cda43ea6f87843a9dcfad067a1a4c0bb8e Author: Yuan Fu Date: Tue Dec 6 00:26:51 2022 -0800 ; Rename c-ts-fontify-error to c-ts-mode--fontify-error * lisp/progmodes/c-ts-mode.el (c-ts-mode--font-lock-settings) (c-ts-fontify-error): Rename. diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el index 1691a5c31d6..0c66b4959e0 100644 --- a/lisp/progmodes/c-ts-mode.el +++ b/lisp/progmodes/c-ts-mode.el @@ -319,7 +319,7 @@ c-ts-mode--font-lock-settings :language mode :feature 'error - '((ERROR) @c-ts-fontify-error) + '((ERROR) @c-ts-mode--fontify-error) :feature 'escape-sequence :language mode @@ -421,7 +421,7 @@ c-ts-mode--fontify-defun (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'." commit c6b454df339f8b767e23247d48a78749f9e54e1c Author: Yuan Fu Date: Tue Dec 6 00:17:04 2022 -0800 ; Improve docstring of c-ts-mode--fontify-variable * lisp/progmodes/c-ts-mode.el (c-ts-mode--fontify-variable): Improve docstring. diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el index 400af2db19e..1691a5c31d6 100644 --- a/lisp/progmodes/c-ts-mode.el +++ b/lisp/progmodes/c-ts-mode.el @@ -372,8 +372,8 @@ c-ts-mode--fontify-declarator 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)) commit 6187d001f28e65b642dbb5e3001b97c5bdc39918 Author: Yuan Fu Date: Tue Dec 6 00:15:30 2022 -0800 Fontify some keywords in type face in c-ts-mode * lisp/progmodes/c-ts-mode.el (c-ts-mode--keywords): Remove some keywords. (c-ts-mode--type-keywords): New variables. (c-ts-mode--font-lock-settings): New rule. diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el index 1bd093cfa2d..400af2db19e 100644 --- a/lisp/progmodes/c-ts-mode.el +++ b/lisp/progmodes/c-ts-mode.el @@ -169,9 +169,9 @@ c-ts-mode--keywords '("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 @@ c-ts-mode--keywords "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 @@ c-ts-mode--font-lock-settings (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 commit b3847c020835676d5266801573e00aed1967b8e4 Author: Eli Zaretskii Date: Tue Dec 6 19:28:02 2022 +0200 ; Minor cleanup in treesit.c * src/treesit.c (Ftreesit_query_capture) (Ftreesit_parser_set_included_ranges): Minor cleanups. 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 @@ DEFUN ("treesit-parser-set-included-ranges", 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 @@ DEFUN ("treesit-query-capture", /* 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); commit 40af27859e0fc243d1fcfd0ddab4fe1748568c58 Author: Stefan Kangas Date: Tue Dec 6 18:05:08 2022 +0100 ; * lib-src/etags.c (escape_shell_arg_string): Minor doc fix. diff --git a/lib-src/etags.c b/lib-src/etags.c index b76590631d8..a06c236140f 100644 --- a/lib-src/etags.c +++ b/lib-src/etags.c @@ -7722,12 +7722,12 @@ etags_mktmp (void) #if !MSDOS && !defined (DOS_NT) /* - * Adds single quotes around a string, if found single quotes, escaped it. + * 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' + * escape_shell_arg_string ("test.txt") => "'test.txt'" + * escape_shell_arg_string ("'test.txt") => "''\''test.txt'" */ static char * escape_shell_arg_string (char *str) commit 43b7e7efbf4df178bb3fa42a32e90ee34de84d46 Author: Mattias Engdegård Date: Tue Dec 6 17:37:22 2022 +0100 Fix etags builds on non-Windows non-MS-DOS machines * lib-src/etags.c: In this file, MSDOS is always defined but can be either `true` or `false`, so don't used `defined MSDOS` as a condition. diff --git a/lib-src/etags.c b/lib-src/etags.c index 9091257a203..b76590631d8 100644 --- a/lib-src/etags.c +++ b/lib-src/etags.c @@ -401,7 +401,7 @@ #define xrnew(op, n, m) ((op) = xnrealloc (op, n, (m) * sizeof *(op))) static void put_entries (node *); static void cleanup_tags_file (char const * const, char const * const); -#if !defined (MSDOS) && !defined (DOS_NT) +#if !MSDOS && !defined (DOS_NT) static char *escape_shell_arg_string (char *); #endif static void do_move_file (const char *, const char *); @@ -1416,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 \""); @@ -7720,7 +7720,7 @@ etags_mktmp (void) return templt; } -#if !defined (MSDOS) && !defined (DOS_NT) +#if !MSDOS && !defined (DOS_NT) /* * Adds single quotes around a string, if found single quotes, escaped it. * Return a newly-allocated string. commit 7e6d1d1c47196bf1bb5254f5c9014e25bdaf9833 Author: Eli Zaretskii Date: Tue Dec 6 18:13:41 2022 +0200 ; Fix last change in etags.c. diff --git a/lib-src/etags.c b/lib-src/etags.c index ba0092cc637..9091257a203 100644 --- a/lib-src/etags.c +++ b/lib-src/etags.c @@ -401,7 +401,9 @@ #define xrnew(op, n, m) ((op) = xnrealloc (op, n, (m) * sizeof *(op))) static void put_entries (node *); static void cleanup_tags_file (char const * const, char const * const); +#if !defined (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 *); @@ -1714,15 +1716,22 @@ process_file_name (char *file, language *lang) else { #if MSDOS || defined (DOS_NT) - 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); + 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 *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); + 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 inf = (system (cmd) == -1 ? NULL @@ -7711,6 +7720,7 @@ etags_mktmp (void) return templt; } +#if !defined (MSDOS) && !defined (DOS_NT) /* * Adds single quotes around a string, if found single quotes, escaped it. * Return a newly-allocated string. @@ -7723,14 +7733,14 @@ etags_mktmp (void) escape_shell_arg_string (char *str) { char *p = str; - int need_space = 2; /* ' at begin and end */ + int need_space = 2; /* ' at begin and end */ while (*p != '\0') { if (*p == '\'') - need_space += 4; /* ' to '\'', length is 4 */ + need_space += 4; /* ' to '\'', length is 4 */ else - need_space++; + need_space++; p++; } @@ -7739,18 +7749,18 @@ escape_shell_arg_string (char *str) new_str[0] = '\''; new_str[need_space-1] = '\''; - int i = 1; /* skip first byte */ + 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; - } + { + new_str[i+1] = '\\'; + new_str[i+2] = '\''; + new_str[i+3] = '\''; + i += 3; + } i++; p++; @@ -7759,6 +7769,7 @@ escape_shell_arg_string (char *str) new_str[need_space] = '\0'; return new_str; } +#endif static void do_move_file(const char *src_file, const char *dst_file) commit 01a4035c869b91c153af9a9132c87adb7669ea1c Author: Xi Lu Date: Tue Dec 6 15:42:40 2022 +0800 Fix etags local command injection vulnerability * lib-src/etags.c: (escape_shell_arg_string): New function. (process_file_name): Use it to quote file names passed to the shell. (Bug#59817) diff --git a/lib-src/etags.c b/lib-src/etags.c index d1d20858cdd..ba0092cc637 100644 --- a/lib-src/etags.c +++ b/lib-src/etags.c @@ -401,6 +401,7 @@ #define xrnew(op, n, m) ((op) = xnrealloc (op, n, (m) * sizeof *(op))) static void put_entries (node *); static void cleanup_tags_file (char const * const, char const * const); +static char *escape_shell_arg_string (char *); static void do_move_file (const char *, const char *); static char *concat (const char *, const char *, const char *); static char *skip_spaces (char *); @@ -1713,13 +1714,16 @@ 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 +7711,55 @@ etags_mktmp (void) return templt; } +/* + * Adds single quotes around a string, if found single quotes, escaped it. + * 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; +} + static void do_move_file(const char *src_file, const char *dst_file) { commit ed4734405dfbe26d3da7cedc4e4cd599618bf6ee Author: Eli Zaretskii Date: Tue Dec 6 17:15:35 2022 +0200 Avoid crashes in a build --without-modules * src/lread.c (syms_of_lread): Move the definitions of 'dynamic-library-suffixes' outside of the HAVE_MODULES conditional. (Bug#59832) diff --git a/src/lread.c b/src/lread.c index 68bc1431765..51ea3e5b929 100644 --- a/src/lread.c +++ b/src/lread.c @@ -5468,6 +5468,14 @@ syms_of_lread (void) 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 @@ syms_of_lread (void) 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. commit 80df980e4100297942775eae4f89c5ccabe03afc Author: Juanma Barranquero Date: Tue Dec 6 13:44:09 2022 +0100 * lisp/bs.el: Adapt to modern display-buffer-alist window setup * lisp/bs.el (bs--window-config-coming-from): Delete. (bs-default-action-list): New user customizable option. (bs--restore-window-config): Delete. (bs-kill, bs-select, bs-select-other-window) (bs-select-other-frame): Use `quit-window' instead. (bs--show-with-configuration): Use `pop-to-buffer' to display the "*buffer-selection*" buffer. diff --git a/lisp/bs.el b/lisp/bs.el index 1fd31fb3b85..f880f3973a3 100644 --- a/lisp/bs.el +++ b/lisp/bs.el @@ -420,9 +420,6 @@ bs--show-all Non-nil means to show all buffers. Otherwise show buffers defined by current configuration `bs-current-configuration'.") -(defvar bs--window-config-coming-from nil - "Window configuration before starting Buffer Selection Menu.") - (defvar bs--intern-show-never "^ \\|\\*buffer-selection\\*" "Regular expression specifying which buffers never to show. A buffer whose name matches this regular expression will never be @@ -491,7 +488,23 @@ bs-mode-map "" #'bs-mouse-select "" #'bs-mouse-select-other-frame) -;; ---------------------------------------------------------------------- +(defcustom bs-default-action-list '((display-buffer-reuse-window + display-buffer-below-selected) + (window-height . bs-max-window-height)) + "Default action list for showing the '*bs-selection*' buffer. + +This list will be passed to `pop-to-buffer' as its ACTION argument. +It should be a cons cell (FUNCTIONS . ALIST), where FUNCTIONS is +an action function or a list of action functions and ALIST is an +action alist. Each such action function should accept two +arguments: a buffer to display and an alist of the same form as +ALIST. See `display-buffer' for details." + :type display-buffer--action-custom-type + :risky t + :version "30.1" + :group 'bs) + +; ---------------------------------------------------------------------- ;; Functions ;; ---------------------------------------------------------------------- @@ -668,20 +681,11 @@ bs-mode (add-hook 'kill-buffer-hook 'bs--remove-hooks nil t) (add-hook 'change-major-mode-hook 'bs--remove-hooks nil t)) -(defun bs--restore-window-config () - "Restore window configuration on the current frame." - (when bs--window-config-coming-from - (let ((frame (selected-frame))) - (unwind-protect - (set-window-configuration bs--window-config-coming-from) - (select-frame frame))) - (setq bs--window-config-coming-from nil))) - (defun bs-kill () "Let buffer disappear and reset window configuration." (interactive) (bury-buffer (current-buffer)) - (bs--restore-window-config)) + (quit-window)) (defun bs-abort () "Ding and leave Buffer Selection Menu without a selection." @@ -742,7 +746,7 @@ bs-select (interactive) (let ((buffer (bs--current-buffer))) (bury-buffer (current-buffer)) - (bs--restore-window-config) + (quit-window) (switch-to-buffer buffer) (when bs--marked-buffers ;; Some marked buffers for selection @@ -765,7 +769,7 @@ bs-select-other-window (interactive) (let ((buffer (bs--current-buffer))) (bury-buffer (current-buffer)) - (bs--restore-window-config) + (quit-window) (switch-to-buffer-other-window buffer))) (defun bs-tmp-select-other-window () @@ -781,7 +785,7 @@ bs-select-other-frame (interactive) (let ((buffer (bs--current-buffer))) (bury-buffer (current-buffer)) - (bs--restore-window-config) + (quit-window) (switch-to-buffer-other-frame buffer))) (defun bs-mouse-select-other-frame (event) @@ -1438,21 +1442,11 @@ bs--show-with-configuration ;; Only when not in buffer *buffer-selection* ;; we have to set the buffer we started the command (setq bs--buffer-coming-from (current-buffer))) - (let ((liste (bs-buffer-list)) - (active-window (get-window-with-predicate - (lambda (w) - (string= (buffer-name (window-buffer w)) - "*buffer-selection*")) - nil (selected-frame)))) - (if active-window - (select-window active-window) - (bs--restore-window-config) - (setq bs--window-config-coming-from (current-window-configuration)) - (when (> (window-height) 7) - ;; Errors would mess with the window configuration (bug#10882). - (ignore-errors (select-window (split-window-below))))) - (bs-show-in-buffer liste) - (bs-message-without-log "%s" (bs--current-config-message))))) + (let ((window-combination-limit 'window-size)) + (pop-to-buffer (get-buffer-create "*buffer-selection*") + bs-default-action-list)) + (bs-show-in-buffer (bs-buffer-list)) + (bs-message-without-log "%s" (bs--current-config-message)))) (defun bs--configuration-name-for-prefix-arg (prefix) "Convert prefix argument PREFIX to a name of a buffer configuration. commit 70a2eb4a0b315c3e66ab89508c9c62ca8b84ef29 Author: Eli Zaretskii Date: Tue Dec 6 14:41:36 2022 +0200 Fix 'add-display-text-property' when OBJECT is non-nil * lisp/emacs-lisp/subr-x.el (add-display-text-property): Fix the case where OBJECT is not nil. (Bug#59857) * test/lisp/emacs-lisp/subr-x-tests.el (subr-x-test-add-display-text-property): Add test for this case. 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 @@ add-display-text-property (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 @@ add-display-text-property (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/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 @@ subr-x-test-add-display-text-property (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 ())) commit d58d1dd48ac7ae0f0b1a7d129c8a27b4a016d1ca Author: Michael Albinus Date: Tue Dec 6 12:36:15 2022 +0100 Do not run slow tests on EMBA * test/infra/gitlab-ci.yml (.filenotify-gio-template): Do not run scheduled. (build-native-comp-speed1, build-native-comp-speed2): Comment out. * test/lisp/international/ucs-normalize-tests.el (ucs-normalize-part1): Skip also on EMBA. 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/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 @@ ucs-normalize-tests--part1-rule2 (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 commit f803203088c26e8906ae28e9b27cc6afa37fb8cb Author: Po Lu Date: Tue Dec 6 19:30:15 2022 +0800 Work around sample server bug * src/xterm.c (XTring_bell): Catch Access errors from XBell when Emacs is running as an untrusted client. diff --git a/src/xterm.c b/src/xterm.c index ab31f0d93e6..f446d093ef4 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -11251,21 +11251,32 @@ XTflash (struct frame *f) static void XTring_bell (struct frame *f) { - if (FRAME_X_DISPLAY (f)) + struct x_display_info *dpyinfo; + + if (!FRAME_X_DISPLAY (f)) + return; + + dpyinfo = FRAME_DISPLAY_INFO (f); + + if (visible_bell) + XTflash (f); + else { - if (visible_bell) - XTflash (f); - else - { - block_input (); + /* When Emacs is untrusted, Bell requests sometimes generate + Access errors. This is not in the security extension + specification but seems to be a bug in the X consortium XKB + implementation. */ + + block_input (); + x_ignore_errors_for_next_request (dpyinfo); #ifdef HAVE_XKB - XkbBell (FRAME_X_DISPLAY (f), None, 0, None); + XkbBell (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), 0, None); #else - XBell (FRAME_X_DISPLAY (f), 0); + XBell (FRAME_X_DISPLAY (f), 0); #endif - XFlush (FRAME_X_DISPLAY (f)); - unblock_input (); - } + XFlush (FRAME_X_DISPLAY (f)); + x_stop_ignoring_errors (dpyinfo); + unblock_input (); } } commit 9b9b39a2d8979af7430a4e2370ef7857c4a2dbce Author: Mattias Engdegård Date: Tue Dec 6 12:13:18 2022 +0100 Lisp reader undefined behaviour excision * src/lread.c (read_bool_vector, skip_lazy_string): Replace `|` with `||` to explicitly introduce sequence points since the variables, `length` and `nskip`, are mutated more than once. The `|` was just a weak attempt at micro-optimisation in any case; sorry about that. diff --git a/src/lread.c b/src/lread.c index 0a6e4201e40..68bc1431765 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)