From 1800350b186864130e16c8618cbcb072c564637e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20M=C3=BChlbacher?= Date: Tue, 19 May 2026 11:18:36 +0000 Subject: [PATCH 01/14] Avoid compilation-mode matching rust as gnu * lisp/progmodes/compile.el (compilation-error-regexp-alist-alist): Put 'rust' before 'gnu' to avoid a mismatch since the " |" has become optional (bug#81075). Copyright-paperwork-exempt: yes --- lisp/progmodes/compile.el | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index aaad8622c95..fbcdc6b5124 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el @@ -421,6 +421,20 @@ of[ \t]+\"?\\([a-zA-Z]?:?[^\":\n]+\\)\"?:" 3 2 nil (1)) nil (1 compilation-error-face)) + ;; This must precede the `gnu' rule or the latter would match instead. + (rust + ,(rx bol (or (group-n 1 "error") (group-n 2 "warning") (group-n 3 "note")) + (? "[" (+ (in "A-Z" "0-9")) "]") ":" (* nonl) + "\n" (+ " ") "-->" + " " (group-n 4 (+ nonl)) ; file + ":" (group-n 5 (+ (in "0-9"))) ; line + ":" (group-n 6 (+ (in "0-9")))) ; column + 4 5 6 (2 . 3) + nil + (1 compilation-error-face) + (2 compilation-warning-face) + (3 compilation-info-face)) + ;; Tested with Lua 5.1, 5.2, 5.3, 5.4, and LuaJIT 2.1. (lua ,(rx bol @@ -582,19 +596,6 @@ during global destruction\\.$\\)" 1 2) "\\(?:Parse\\|Fatal\\) error: \\(.*\\) in \\(.*\\) on line \\([0-9]+\\)" 2 3 nil nil) - (rust - ,(rx bol (or (group-n 1 "error") (group-n 2 "warning") (group-n 3 "note")) - (? "[" (+ (in "A-Z" "0-9")) "]") ":" (* nonl) - "\n" (+ " ") "-->" - " " (group-n 4 (+ nonl)) ; file - ":" (group-n 5 (+ (in "0-9"))) ; line - ":" (group-n 6 (+ (in "0-9")))) ; column - 4 5 6 (2 . 3) - nil - (1 compilation-error-face) - (2 compilation-warning-face) - (3 compilation-info-face)) - (rxp "^\\(?:Error\\|Warnin\\(g\\)\\):.*\n.* line \\([0-9]+\\) char\ \\([0-9]+\\) of file://\\(.+\\)" From 12eec781ed69c4fc7611e8c9a1953ad33da98a0c Mon Sep 17 00:00:00 2001 From: Amin Bandali Date: Fri, 22 May 2026 10:26:37 -0400 Subject: [PATCH 02/14] No longer raise error on HTTP 402 (Payment Required) (bug#81101) * lisp/url/url-http.el (url-http-parse-headers): Return t instead of raising an error, to give the user a chance to interact with the page. --- lisp/url/url-http.el | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lisp/url/url-http.el b/lisp/url/url-http.el index ce512c6db33..0be1b326d6c 100644 --- a/lisp/url/url-http.el +++ b/lisp/url/url-http.el @@ -826,9 +826,12 @@ should be shown to the user." ;; Authorization header field. (url-http-handle-authentication nil)) ('payment-required ; 402 - ;; This code is reserved for future use - (url-mark-buffer-as-dead buffer) - (error "Somebody wants you to give them money")) + ;; This code is "reserved for future use", but in the + ;; mean time websites have been seen to use it, for + ;; instance anti-bot challenges requiring the "payment" + ;; of a click of a button to prove the visitor is human, + ;; so we no longer raise an `error' here. + t) ('forbidden ; 403 ;; The server understood the request, but is refusing to ;; fulfill it. Authorization will not help and the request From 7892ae5eaf4c22a3209a8c44c6267004653c5691 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20T=C3=A1vora?= Date: Sun, 24 May 2026 03:26:19 +0100 Subject: [PATCH 03/14] Fix pathological slowness in flex completion The 'completion-regexp-list' optimization in completion--flex-all-completions-1, a cheap pre-filter via a trivial regexp, performs very poorly for longer patterns and strings, so drop it. That alone recovers fairly decent performance for the flex completion when compared to the 'hotfuzz' point of reference. We then recover the cheap rejection with an O(N+M) pre-check in the Fcompletion__flex_cost_gotoh C scorer. This kicks in the common case (completion-ignore-case is nil) and pays off especially when the table is already a list and 'all-completions' needn't cons. See: https://lists.gnu.org/archive/html/emacs-devel/2026-04/msg01081.html https://lists.gnu.org/archive/html/emacs-devel/2026-05/msg00519.html * lisp/minibuffer.el (completion--flex-all-completions-1): Remove regexp pre-filter. * src/minibuf.c (Fcompletion__flex_cost_gotoh): Add subsequence pre-check. --- lisp/minibuffer.el | 5 ----- src/minibuf.c | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index e8fb479bc85..a24b92cdae8 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -4982,11 +4982,6 @@ usual. Returns (ALL PAT PREFIX SUFFIX)." (prefix (substring beforepoint 0 (car bounds))) (suffix (substring afterpoint (cdr bounds))) (pat2 (substring pat (car bounds) (+ point (cdr bounds)))) - (completion-regexp-list - (cons (mapconcat (lambda (c) (regexp-quote (char-to-string c))) - pat2 - ".*") - completion-regexp-list)) (all (all-completions prefix table pred)) (all (if (zerop (length pat2)) all diff --git a/src/minibuf.c b/src/minibuf.c index c716ac0d811..745a71a63fc 100644 --- a/src/minibuf.c +++ b/src/minibuf.c @@ -2364,6 +2364,22 @@ STR the i-th character of PAT matched. */) if (patlen == 0 || strlen == 0 || size > FLEX_MAX_MATRIX_SIZE) return Qnil; + /* Also bail if PAT is not a subsequence of STR so bail "cheaply" + before the O(N*M) DP algorithm. Walking both strings + byte-by-byte for this purpose (and only for case-sensitive common + case) should be valid even for multibyte strings. */ + if (!completion_ignore_case) + { + const unsigned char *p = SDATA (pat); + const unsigned char *s = SDATA (str); + int pi = 0; + for (int si = 0; si < strlen && pi < patlen; si++) + if (s[si] == p[pi]) + pi++; + if (pi < patlen) + return Qnil; + } + /* Initialize M and D with positive infinity... */ for (int j = 0; j < size; j++) M[j] = D[j] = pos_inf; From 4c55d04ebe31f2a84273dfa2f765ca02e18ffb9d Mon Sep 17 00:00:00 2001 From: Yuan Fu Date: Mon, 18 May 2026 20:56:10 -0700 Subject: [PATCH 04/14] Add treesit-ready-p check back to tree-sitter major modes (bug#80909) * lisp/progmodes/c-ts-mode.el (c-ts-mode): (c++-ts-mode): * lisp/progmodes/cmake-ts-mode.el (cmake-ts-mode): * lisp/progmodes/dockerfile-ts-mode.el (dockerfile-ts-mode): * lisp/progmodes/elixir-ts-mode.el (elixir-ts-mode): * lisp/progmodes/go-ts-mode.el (go-ts-mode): (go-mod-ts-mode): (go-work-ts-mode): * lisp/progmodes/heex-ts-mode.el (heex-ts-mode): * lisp/progmodes/js.el (js-ts-mode): * lisp/progmodes/lua-ts-mode.el (lua-ts-mode): * lisp/progmodes/python.el (python-ts-mode): * lisp/progmodes/rust-ts-mode.el (rust-ts-mode): * lisp/progmodes/sh-script.el (bash-ts-mode): * lisp/progmodes/typescript-ts-mode.el (typescript-ts-mode): (tsx-ts-mode): * lisp/textmodes/css-mode.el (css-ts-mode): * lisp/textmodes/mhtml-ts-mode.el (mhtml-ts-mode): * lisp/textmodes/toml-ts-mode.el (toml-ts-mode): * lisp/textmodes/yaml-ts-mode.el (yaml-ts-mode): * lisp/treesit-x.el (treesit-generic-mode-setup): Add the check. --- lisp/progmodes/c-ts-mode.el | 8 ++++++-- lisp/progmodes/cmake-ts-mode.el | 4 +++- lisp/progmodes/dockerfile-ts-mode.el | 4 +++- lisp/progmodes/elixir-ts-mode.el | 8 ++++++-- lisp/progmodes/go-ts-mode.el | 12 +++++++++--- lisp/progmodes/heex-ts-mode.el | 8 ++++++-- lisp/progmodes/js.el | 8 ++++++-- lisp/progmodes/lua-ts-mode.el | 4 +++- lisp/progmodes/python.el | 8 +++++--- lisp/progmodes/rust-ts-mode.el | 4 +++- lisp/progmodes/sh-script.el | 4 +++- lisp/progmodes/typescript-ts-mode.el | 8 ++++++-- lisp/textmodes/css-mode.el | 4 +++- lisp/textmodes/mhtml-ts-mode.el | 4 +++- lisp/textmodes/toml-ts-mode.el | 4 +++- lisp/textmodes/yaml-ts-mode.el | 4 +++- lisp/treesit-x.el | 4 +++- 17 files changed, 74 insertions(+), 26 deletions(-) diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el index c8120d5752c..d08615446a1 100644 --- a/lisp/progmodes/c-ts-mode.el +++ b/lisp/progmodes/c-ts-mode.el @@ -1475,7 +1475,9 @@ in your init files, or customize `treesit-enabled-modes'." :group 'c :after-hook (c-ts-mode-set-modeline) - (when (treesit-ensure-installed 'c) + ;; `treesit-ready-p' also checks for buffer size. + (when (and (treesit-ensure-installed 'c) + (treesit-ready-p 'c)) ;; Create an "for-each" parser, see `c-ts-mode--emacs-set-ranges' ;; for more. (when c-ts-mode-emacs-sources-support @@ -1554,7 +1556,9 @@ recommended to enable `electric-pair-mode' with this mode." :group 'c++ :after-hook (c-ts-mode-set-modeline) - (when (treesit-ensure-installed 'cpp) + ;; `treesit-ready-p' also checks for buffer size. + (when (and (treesit-ensure-installed 'cpp) + (treesit-ready-p 'cpp)) (let ((primary-parser (treesit-parser-create 'cpp))) ;; Syntax. diff --git a/lisp/progmodes/cmake-ts-mode.el b/lisp/progmodes/cmake-ts-mode.el index d8873191d61..6abd92b5e1a 100644 --- a/lisp/progmodes/cmake-ts-mode.el +++ b/lisp/progmodes/cmake-ts-mode.el @@ -220,7 +220,9 @@ Return nil if there is no name or if NODE is not a defun node." :group 'cmake :syntax-table cmake-ts-mode--syntax-table - (when (treesit-ensure-installed 'cmake) + ;; `treesit-ready-p' also checks for buffer size. + (when (and (treesit-ensure-installed 'cmake) + (treesit-ready-p 'cmake)) (setq treesit-primary-parser (treesit-parser-create 'cmake)) ;; Comments. diff --git a/lisp/progmodes/dockerfile-ts-mode.el b/lisp/progmodes/dockerfile-ts-mode.el index 1d42c239b84..b97ec89b99a 100644 --- a/lisp/progmodes/dockerfile-ts-mode.el +++ b/lisp/progmodes/dockerfile-ts-mode.el @@ -167,7 +167,9 @@ Return nil if there is no name or if NODE is not a stage node." :group 'dockerfile :syntax-table dockerfile-ts-mode--syntax-table - (when (treesit-ensure-installed 'dockerfile) + ;; `treesit-ready-p' also checks for buffer size. + (when (and (treesit-ensure-installed 'dockerfile) + (treesit-ready-p 'dockerfile)) (setq treesit-primary-parser (treesit-parser-create 'dockerfile)) ;; Comments. diff --git a/lisp/progmodes/elixir-ts-mode.el b/lisp/progmodes/elixir-ts-mode.el index 9514d6bdc91..9bda7f0046f 100644 --- a/lisp/progmodes/elixir-ts-mode.el +++ b/lisp/progmodes/elixir-ts-mode.el @@ -737,7 +737,9 @@ Return nil if NODE is not a defun node or doesn't have a name." (add-hook 'post-self-insert-hook #'elixir-ts--electric-pair-string-delimiter 'append t) - (when (treesit-ensure-installed 'elixir) + ;; `treesit-ready-p' also checks for buffer size. + (when (and (treesit-ensure-installed 'elixir) + (treesit-ready-p 'elixir)) (setq-local treesit-primary-parser (treesit-parser-create 'elixir)) @@ -762,7 +764,9 @@ Return nil if NODE is not a defun node or doesn't have a name." (setq-local treesit-defun-name-function #'elixir-ts--defun-name) ;; Embedded Heex. - (when (treesit-ensure-installed 'heex) + ;; `treesit-ready-p' also checks for buffer size. + (when (and (treesit-ensure-installed 'heex) + (treesit-ready-p 'heex)) (require 'heex-ts-mode) (treesit-parser-create 'heex) diff --git a/lisp/progmodes/go-ts-mode.el b/lisp/progmodes/go-ts-mode.el index 76de7c9b41b..8de6d0e0700 100644 --- a/lisp/progmodes/go-ts-mode.el +++ b/lisp/progmodes/go-ts-mode.el @@ -287,7 +287,9 @@ :group 'go :syntax-table go-ts-mode--syntax-table - (when (treesit-ensure-installed 'go) + ;; `treesit-ready-p' also checks for buffer size. + (when (and (treesit-ensure-installed 'go) + (treesit-ready-p 'go)) (setq treesit-primary-parser (treesit-parser-create 'go)) ;; Comments. @@ -608,7 +610,9 @@ what the parent of the node would be if it were a node." :group 'go :syntax-table go-mod-ts-mode--syntax-table - (when (treesit-ensure-installed 'gomod) + ;; `treesit-ready-p' also checks for buffer size. + (when (and (treesit-ensure-installed 'gomod) + (treesit-ready-p 'gomod)) (setq treesit-primary-parser (treesit-parser-create 'gomod)) ;; Comments. @@ -712,7 +716,9 @@ what the parent of the node would be if it were a node." "Major mode for editing go.work files, powered by tree-sitter." :group 'go - (when (treesit-ensure-installed 'gowork) + ;; `treesit-ready-p' also checks for buffer size. + (when (and (treesit-ensure-installed 'gowork) + (treesit-ready-p 'gowork)) (setq treesit-primary-parser (treesit-parser-create 'gowork)) ;; Comments. diff --git a/lisp/progmodes/heex-ts-mode.el b/lisp/progmodes/heex-ts-mode.el index d756224f371..e8fec8b0469 100644 --- a/lisp/progmodes/heex-ts-mode.el +++ b/lisp/progmodes/heex-ts-mode.el @@ -201,7 +201,9 @@ Return nil if NODE is not a defun node or doesn't have a name." "Major mode for editing HEEx, powered by tree-sitter." :group 'heex-ts - (when (treesit-ensure-installed 'heex) + ;; `treesit-ready-p' also checks for buffer size. + (when (and (treesit-ensure-installed 'heex) + (treesit-ready-p 'heex)) (setq treesit-primary-parser (treesit-parser-create 'heex)) ;; Comments @@ -236,7 +238,9 @@ Return nil if NODE is not a defun node or doesn't have a name." (setq-local treesit-font-lock-feature-list heex-ts--font-lock-feature-list) - (when (treesit-ensure-installed 'elixir) + ;; `treesit-ready-p' also checks for buffer size. + (when (and (treesit-ensure-installed 'elixir) + (treesit-ready-p 'elixir)) (require 'elixir-ts-mode) (treesit-parser-create 'elixir) diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el index e7e5bd901e1..3f2deca317c 100644 --- a/lisp/progmodes/js.el +++ b/lisp/progmodes/js.el @@ -4041,7 +4041,9 @@ See `treesit-thing-settings' for more information.") \\" :group 'js :syntax-table js-mode-syntax-table - (when (treesit-ensure-installed 'javascript) + ;; `treesit-ready-p' also checks for buffer size. + (when (and (treesit-ensure-installed 'javascript) + (treesit-ready-p 'javascript)) ;; Borrowed from `js-mode'. (setq-local prettify-symbols-alist js--prettify-symbols-alist) (setq-local parse-sexp-ignore-comments t) @@ -4073,7 +4075,9 @@ See `treesit-thing-settings' for more information.") (setq-local treesit-font-lock-settings (js--treesit-font-lock-settings)) (setq-local treesit-font-lock-feature-list js--treesit-font-lock-feature-list) - (when (treesit-ensure-installed 'jsdoc) + ;; `treesit-ready-p' also checks for buffer size. + (when (and (treesit-ensure-installed 'jsdoc) + (treesit-ready-p 'jsdoc)) (setq-local treesit-range-settings (treesit-range-rules :embed 'jsdoc diff --git a/lisp/progmodes/lua-ts-mode.el b/lisp/progmodes/lua-ts-mode.el index 8d726b9b15b..2963d5a96af 100644 --- a/lisp/progmodes/lua-ts-mode.el +++ b/lisp/progmodes/lua-ts-mode.el @@ -675,7 +675,9 @@ Calls REPORT-FN directly." :syntax-table lua-ts--syntax-table (use-local-map lua-ts-mode-map) - (when (treesit-ensure-installed 'lua) + ;; `treesit-ready-p' also checks for buffer size. + (when (and (treesit-ensure-installed 'lua) + (treesit-ready-p 'lua)) (setq treesit-primary-parser (treesit-parser-create 'lua)) ;; Comments. diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index ad0e84bf74f..86336979067 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -7477,9 +7477,11 @@ implementations: `python-mode' and `python-ts-mode'." \\{python-ts-mode-map}" :syntax-table python-mode-syntax-table - (when (if (fboundp 'treesit-ensure-installed) ; Emacs 31 - (treesit-ensure-installed 'python) - (treesit-ready-p 'python)) + ;; `treesit-ready-p' also checks for buffer size. + (when (and (if (fboundp 'treesit-ensure-installed) ; Emacs 31 + (treesit-ensure-installed 'python) + t) + (treesit-ready-p 'python)) (setq treesit-primary-parser (treesit-parser-create 'python)) (setq-local treesit-font-lock-feature-list '(( comment definition) diff --git a/lisp/progmodes/rust-ts-mode.el b/lisp/progmodes/rust-ts-mode.el index 9bc4324ff66..dee82f934ce 100644 --- a/lisp/progmodes/rust-ts-mode.el +++ b/lisp/progmodes/rust-ts-mode.el @@ -557,7 +557,9 @@ See `prettify-symbols-compose-predicate'." :group 'rust :syntax-table rust-ts-mode--syntax-table - (when (treesit-ensure-installed 'rust) + ;; `treesit-ready-p' also checks for buffer size. + (when (and (treesit-ensure-installed 'rust) + (treesit-ready-p 'rust)) (setq treesit-primary-parser (treesit-parser-create 'rust)) ;; Syntax. diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index 8479c3cfd9a..4d025eeb18d 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el @@ -1583,7 +1583,9 @@ with your script for an edit-interpret-debug cycle." This mode automatically falls back to `sh-mode' if the buffer is not written in Bash or sh." :syntax-table sh-mode-syntax-table - (when (treesit-ensure-installed 'bash) + ;; `treesit-ready-p' also checks for buffer size. + (when (and (treesit-ensure-installed 'bash) + (treesit-ready-p 'bash)) (sh-set-shell "bash" nil nil) (add-hook 'flymake-diagnostic-functions #'sh-shellcheck-flymake nil t) (add-hook 'hack-local-variables-hook diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el index c9d1d1eff4d..61e281310aa 100644 --- a/lisp/progmodes/typescript-ts-mode.el +++ b/lisp/progmodes/typescript-ts-mode.el @@ -701,7 +701,9 @@ This mode is intended to be inherited by concrete major modes." :group 'typescript :syntax-table typescript-ts-mode--syntax-table - (when (treesit-ensure-installed 'typescript) + ;; `treesit-ready-p' also checks for buffer size. + (when (and (treesit-ensure-installed 'typescript) + (treesit-ready-p 'typescript)) (setq treesit-primary-parser (treesit-parser-create 'typescript)) ;; Indent. @@ -757,7 +759,9 @@ at least 3 (which is the default value)." :group 'typescript :syntax-table typescript-ts-mode--syntax-table - (when (treesit-ensure-installed 'tsx) + ;; `treesit-ready-p' also checks for buffer size. + (when (and (treesit-ensure-installed 'tsx) + (treesit-ready-p 'tsx)) (setq treesit-primary-parser (treesit-parser-create 'tsx)) ;; Comments. diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el index 355555df090..12632e24e0e 100644 --- a/lisp/textmodes/css-mode.el +++ b/lisp/textmodes/css-mode.el @@ -1888,7 +1888,9 @@ can also be used to fill comments. \\{css-mode-map}" :syntax-table css-mode-syntax-table - (when (treesit-ensure-installed 'css) + ;; `treesit-ready-p' also checks for buffer size. + (when (and (treesit-ensure-installed 'css) + (treesit-ready-p 'css)) ;; Borrowed from `css-mode'. (setq-local syntax-propertize-function css-syntax-propertize-function) diff --git a/lisp/textmodes/mhtml-ts-mode.el b/lisp/textmodes/mhtml-ts-mode.el index 2a1c62b87e4..d53d74e220a 100644 --- a/lisp/textmodes/mhtml-ts-mode.el +++ b/lisp/textmodes/mhtml-ts-mode.el @@ -511,7 +511,9 @@ Powered by tree-sitter." ;; jsdoc is not mandatory for js-ts-mode, so we respect this by ;; adding jsdoc range rules only when jsdoc is available. - (when (treesit-ensure-installed 'jsdoc) + ;; `treesit-ready-p' also checks for buffer size. + (when (and (treesit-ensure-installed 'jsdoc) + (treesit-ready-p 'jsdoc)) (setq-local c-ts-common--comment-regexp js--treesit-jsdoc-comment-regexp)) diff --git a/lisp/textmodes/toml-ts-mode.el b/lisp/textmodes/toml-ts-mode.el index d3f09526b90..63e3f60edd9 100644 --- a/lisp/textmodes/toml-ts-mode.el +++ b/lisp/textmodes/toml-ts-mode.el @@ -138,7 +138,9 @@ Return nil if there is no name or if NODE is not a defun node." :group 'toml-mode :syntax-table toml-ts-mode--syntax-table - (when (treesit-ensure-installed 'toml) + ;; `treesit-ready-p' also checks for buffer size. + (when (and (treesit-ensure-installed 'toml) + (treesit-ready-p 'toml)) (setq treesit-primary-parser (treesit-parser-create 'toml)) ;; Comments diff --git a/lisp/textmodes/yaml-ts-mode.el b/lisp/textmodes/yaml-ts-mode.el index c1521c82c22..5afd4d2d111 100644 --- a/lisp/textmodes/yaml-ts-mode.el +++ b/lisp/textmodes/yaml-ts-mode.el @@ -262,7 +262,9 @@ Calls REPORT-FN directly." :group 'yaml :syntax-table yaml-ts-mode--syntax-table - (when (treesit-ensure-installed 'yaml) + ;; `treesit-ready-p' also checks for buffer size. + (when (and (treesit-ensure-installed 'yaml) + (treesit-ready-p 'yaml)) (setq treesit-primary-parser (treesit-parser-create 'yaml)) ;; Comments. diff --git a/lisp/treesit-x.el b/lisp/treesit-x.el index 9d0541b458c..86eb417c7b5 100644 --- a/lisp/treesit-x.el +++ b/lisp/treesit-x.el @@ -142,7 +142,9 @@ of `define-treesit-generic-mode'. ;;;###autoload (defun treesit-generic-mode-setup (lang) "Go into the treesit generic mode MODE." - (when (treesit-ensure-installed lang) + ;; `treesit-ready-p' also checks for buffer size. + (when (and (treesit-ensure-installed lang) + (treesit-ready-p lang)) (setq treesit-primary-parser (treesit-parser-create lang)) (when-let* ((query (treesit-generic-mode-font-lock-query lang))) From 4d87d203cfb9c407930332d53b8198328236fe9b Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sun, 24 May 2026 09:41:26 +0300 Subject: [PATCH 05/14] Fix display of inline SVG images in Rmail * lisp/mail/rmailmm.el (rmail-mime-set-bulk-data): Support Content-type of "svg+xml" if SVG images are supported, --- lisp/mail/rmailmm.el | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lisp/mail/rmailmm.el b/lisp/mail/rmailmm.el index 9226976c114..e70f96cb2f8 100644 --- a/lisp/mail/rmailmm.el +++ b/lisp/mail/rmailmm.el @@ -842,8 +842,11 @@ directly." ((string-match "text/" content-type) (setq type 'text)) ((string-match "image/\\(.*\\)" content-type) - (setq type (image-supported-file-p - (concat "." (match-string 1 content-type)))) + (let ((fnext (match-string 1 content-type))) + ;; Ask about SVG support when Content-type is image/svg+xml. + (if (equal fnext "svg+xml") + (setq fnext "svg")) + (setq type (image-supported-file-p (concat "." fnext)))) (when (and type rmail-mime-show-images (not (eq rmail-mime-show-images 'button)) From 7cee526a8cc44dd7166108ec2718a4ca0d1ad1f1 Mon Sep 17 00:00:00 2001 From: Zhengyi Fu Date: Thu, 21 May 2026 22:08:39 +0800 Subject: [PATCH 06/14] Save and restore original local keymap in grep-edit-mode * lisp/progmodes/grep.el (grep-edit-original-mode-map): New variable. (grep-change-to-grep-edit-mode): Save the current local map before switching to grep-edit-mode-map. (grep-edit-save-changes): Restore the saved local map instead of assuming grep-mode-map (bug#81090). Copyright-paperwork-exempt: yes --- lisp/progmodes/grep.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el index 72a05a082bb..a5ba32d26e8 100644 --- a/lisp/progmodes/grep.el +++ b/lisp/progmodes/grep.el @@ -1120,6 +1120,8 @@ list is empty)." (defvar grep-edit-mode-hook nil "Hooks run when changing to Grep-Edit mode.") +(defvar grep-edit-original-mode-map nil) + (defun grep-edit-mode () "Major mode for editing *grep* buffers. In this mode, changes to the *grep* buffer are applied to the @@ -1140,6 +1142,7 @@ The only editable texts in a Grep-Edit buffer are the match results." (error "Not a Grep buffer")) (when (get-buffer-process (current-buffer)) (error "Cannot switch when grep is running")) + (setq-local grep-edit-original-mode-map (current-local-map)) (use-local-map grep-edit-mode-map) (grep-edit--prepare-buffer) (setq buffer-read-only nil) @@ -1159,7 +1162,7 @@ The only editable texts in a Grep-Edit buffer are the match results." (unless (derived-mode-p 'grep-edit-mode) (error "Not a Grep-Edit buffer")) (remove-hook 'after-change-functions #'occur-after-change-function t) - (use-local-map grep-mode-map) + (use-local-map grep-edit-original-mode-map) (setq buffer-read-only t) (setq major-mode 'grep-mode) (setq mode-name "Grep") From a7414f18598bab861f3fef307efd0b8e15cb6ebe Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Sun, 24 May 2026 11:46:47 +0100 Subject: [PATCH 07/14] native--compile-skip-on-battery-p: Try to fix ?b, ?B conditions * lisp/emacs-lisp/comp-run.el (native--compile-skip-on-battery-p): Don't skip charging because the battery is charging, and don't look for "discharging", at least for now (bug#80922). Thanks to David Koppelman for the report. --- lisp/emacs-lisp/comp-run.el | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lisp/emacs-lisp/comp-run.el b/lisp/emacs-lisp/comp-run.el index f329d627392..64e20327906 100644 --- a/lisp/emacs-lisp/comp-run.el +++ b/lisp/emacs-lisp/comp-run.el @@ -203,9 +203,10 @@ LOAD and SELECTOR work as described in `native--compile-async'." ;; because power users often configure their batteries ;; to stop charging at less than 100% as a way to ;; extend the lifetime of their battery hardware. - (string= (cdr (assq ?b res)) "+") - (member (cdr (assq ?B res)) '("charging" "pending-charge")) - (not (string= (cdr (assq ?B res)) "discharging"))))))) + ;; Further discussion in bug#80922. + (and (not (equal (cdr (assq ?b res)) "+")) + (not (member (cdr (assq ?B res)) + '("charging" "pending-charge"))))))))) (defvar comp-files-queue () "List of Emacs Lisp files to be compiled.") From 768c8bf004556c6594133b8f625757f052e7f067 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Sun, 24 May 2026 11:49:50 +0100 Subject: [PATCH 08/14] Revert "* admin/notes/documentation: Recommend not using "it's"." --- admin/notes/documentation | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/admin/notes/documentation b/admin/notes/documentation index d355ad06412..f6fa321b217 100644 --- a/admin/notes/documentation +++ b/admin/notes/documentation @@ -106,7 +106,7 @@ For instance, this anywhere in sight is too confusing. may not need mentioning, because --daemon will give an error message -saying it is not implemented, and other cases aren't affected. +saying it's not implemented, and other cases aren't affected. The kind of change for which the user really needs help from Antinews is where a feature works _differently_ in the previous version. @@ -164,5 +164,3 @@ like subr.el, which are not quoted. Call 'emacs-news-view-mode'. Lisp symbols and Info manual links shall be decorated, and clicking on them shall lead to the respective Help buffer or Info node. - -*** Do not use "it's", "you're" and alike. From 2c1b45f5c56254a7699a92b619eb6ebf3b3571c8 Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sun, 24 May 2026 14:44:07 +0300 Subject: [PATCH 09/14] ; Improve documentation of 'vc-dir-auto-hide-up-to-date' * lisp/vc/vc-dir.el (vc-dir-auto-hide-up-to-date): Doc fix. * doc/emacs/maintaining.texi (VC Directory Buffer): Document 'vc-dir-auto-hide-up-to-date'. (Bug#81033) --- doc/emacs/maintaining.texi | 28 +++++++++++++++++++++------- lisp/vc/vc-dir.el | 24 +++++++++++++++--------- 2 files changed, 36 insertions(+), 16 deletions(-) diff --git a/doc/emacs/maintaining.texi b/doc/emacs/maintaining.texi index a1825c5e515..b5f7c362a91 100644 --- a/doc/emacs/maintaining.texi +++ b/doc/emacs/maintaining.texi @@ -1523,10 +1523,11 @@ on the current line if no files are marked. and their version control statuses. It lists files in the current directory (the one specified when you called @kbd{C-x v d}) and its subdirectories, but only those with a noteworthy status. Files -that are up-to-date (i.e., the same as in the repository) are -omitted. If all the files in a subdirectory are up-to-date, the +that are up-to-date (i.e., the same as in the repository) or ignored +are omitted. If all the files in a subdirectory are up-to-date, the subdirectory is not listed either. As an exception, if a file has -become up-to-date as a direct result of a VC command, it is listed. +become up-to-date as a direct result of a VC command, it is listed by +default. Here is an example of a VC Directory buffer listing: @@ -1565,6 +1566,16 @@ systems can show other statuses. For instance, CVS shows the been applied to the work file. RCS and SCCS show the name of the user locking a file as its status. +@vindex vc-dir-auto-hide-up-to-date + As mentioned above, by default files and directories which become +up-to-date or ignored after the VC Directory buffer is first displayed +stay displayed. To automatically remove such files from display, +customize the variable @code{vc-dir-auto-hide-up-to-date} to the value +@code{t}. You can also customize it to the value @code{revert}, in +which case such files will be removed only when you refresh the VC +Directory display, e.g., by typing @kbd{g} (@pxref{VC Directory +Commands}). + @ifnottex On CVS, the @code{vc-dir} command normally contacts the repository, which may be on a remote machine, to check for updates. If you change @@ -1595,7 +1606,7 @@ cases Emacs must occasionally fetch from the remote repository in order to determine the count. If your connection to the remote repository is slow then this may cause unacceptable slowdowns in refreshing the VC Directory buffer. If this affects you, you can customize -@code{vc-dir-show-outgoing-count} to nil to disable the unpushed +@code{vc-dir-show-outgoing-count} to @code{nil} to disable the unpushed revisions count altogether. You can also set this on a per-repository basis using directory local variables (@pxref{Directory Variables}). @@ -1674,9 +1685,6 @@ the VC Directory buffer (@code{vc-dir-root-next-action}). This is like @w{@kbd{C-x v v}} (@pxref{Basic VC Editing}) except that it ignores any marks and the position of point. -@item q -Quit the VC Directory buffer, and bury it (@code{quit-window}). - @item u Unmark the file or directory on the current line. If the region is active, unmark all the files in the region (@code{vc-dir-unmark}). @@ -1691,6 +1699,12 @@ files and directories. Hide files with @samp{up-to-date} or @samp{ignored} status (@code{vc-dir-hide-up-to-date}). With a prefix argument, hide items whose state is that of the item at point. + +@item g +Refresh the VC Directory buffer display (@code{revert-buffer}). + +@item q +Quit the VC Directory buffer, and bury it (@code{quit-window}). @end table @findex vc-dir-mark diff --git a/lisp/vc/vc-dir.el b/lisp/vc/vc-dir.el index 2d6f8ee97d0..c79ac50cfc3 100644 --- a/lisp/vc/vc-dir.el +++ b/lisp/vc/vc-dir.el @@ -161,17 +161,23 @@ proceed to mark and unmark other entries, without asking." :version "31.1") (defcustom vc-dir-auto-hide-up-to-date nil - "If non-nil, VC-Dir automatically hides \\+`up-to-date' and \\+`ignored' items. + "Whether VC-Dir automatically removes \\+`up-to-date'/\\+`ignored' files from display. -If the value of this variable is the symbol `revert', \ -\\\\[revert-buffer] in VC-Dir -buffers also does \\[vc-dir-hide-up-to-date]. \ -That is, refreshing the VC-Dir buffer also hides -\\+`up-to-date' and \\+`ignored' items. +If the value is nil, files shown in the VC-Dir buffer will remain on +display if they become \\+`up-to-date' or \\+`ignored'. +If the value is t, files are automatically removed from display when +they become \\+`up-to-date' or \\+`ignored'. +If the value is the symbol `revert', any displayed files that +are \\+`up-to-date' or \\+`ignored' are removed from display +by \\\\[revert-buffer], but they are not automatically removed +when they become \\+`up-to-date' or \\+`ignored'. That is, +refreshing the VC-Dir buffer hides \\+`up-to-date' and \\+`ignored' +files when the value is the symbol `revert'. +Any other value is treated as t. + +VC-Dir never shows \\+`up-to-date' and \\+`ignored' files when the +directory is first displayed. -If the value of this variable is any other non-nil value, then in -addition, hide items whenever their state would change to -\\+`up-to-date' or \\+`ignored'. You can still use `vc-dir-show-fileentry' to manually add an entry for an \\+`up-to-date' or \\+`ignored' file." :type 'boolean From c6181780663a32729e150c8d57222a6579691af6 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Mon, 25 May 2026 08:44:42 +0200 Subject: [PATCH 10/14] ; Mark process-test-stderr-buffer as :unstable when running on emba * test/src/process-tests.el (process-test-stderr-buffer): Mark as :unstable when running on emba. (Bug#80166) --- test/src/process-tests.el | 1 + 1 file changed, 1 insertion(+) diff --git a/test/src/process-tests.el b/test/src/process-tests.el index 55657a23fa9..ad6cb924943 100644 --- a/test/src/process-tests.el +++ b/test/src/process-tests.el @@ -89,6 +89,7 @@ process to complete." (should (string= (buffer-string) "arg1=\"x &y\", arg2=\n")))))) (ert-deftest process-test-stderr-buffer () + :tags (if (getenv "EMACS_EMBA_CI") '(:unstable)) (skip-unless (executable-find "bash")) (with-timeout (60 (ert-fail "Test timed out")) (let* ((stdout-buffer (generate-new-buffer "*stdout*")) From 02897e208d005956f84aa228f4f298f260133896 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 26 May 2026 18:25:13 -0700 Subject: [PATCH 11/14] emacsclient quote_argument is void MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * lib-src/emacsclient.c (quote_argument): Don’t use ‘return E;’ in a function returning void. Problem found by Oracle Developer Studio 12.6. --- lib-src/emacsclient.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c index 0769c94a89d..9df20d8524b 100644 --- a/lib-src/emacsclient.c +++ b/lib-src/emacsclient.c @@ -902,7 +902,7 @@ quote_argument_len (HSOCKET s, const char *str, ptrdiff_t len) static void quote_argument (HSOCKET s, const char *str) { - return quote_argument_len (s, str, strlen (str)); + quote_argument_len (s, str, strlen (str)); } /* The inverse of quote_argument. Remove quoting in string STR by From ea54c33950f5a360b08040a1412da36ffb14e704 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Wed, 27 May 2026 13:16:12 +0100 Subject: [PATCH 12/14] ; * etc/PROBLEMS: Link to bug#81124. --- etc/PROBLEMS | 3 +++ 1 file changed, 3 insertions(+) diff --git a/etc/PROBLEMS b/etc/PROBLEMS index b619c6e7f37..655bfd6c173 100644 --- a/etc/PROBLEMS +++ b/etc/PROBLEMS @@ -136,6 +136,9 @@ result in an endless loop. If you need Emacs to be able to recover from closing displays, compile it with the Lucid toolkit instead of GTK. +One possible mitigation for the problem is described in +https://debbugs.gnu.org/81124 + ** Emacs compiled with GTK+ 3 crashes when run under some X servers. This happens when the X server does not provide certain display features that the underlying GTK+ 3 toolkit assumes. For example, this From 2e70b88623ed4506c4334f8b9e73651f7d21ade7 Mon Sep 17 00:00:00 2001 From: Juri Linkov Date: Wed, 27 May 2026 18:32:40 +0300 Subject: [PATCH 13/14] Fix fill-paragraph combining text with preceding comment * lisp/textmodes/fill.el (fill-paragraph): Handle the case when a non-comment line follows a comment line with non-nil 'fill-paragraph-handle-comment' (bug#80449). Skip such a comment line before filling a non-comment line. * test/lisp/textmodes/fill-tests.el (fill-test-fill-paragraph-handle-comment): Add new test. * test/lisp/textmodes/fill-resources/fill-paragraph-handle-comment.erts: New file. --- lisp/textmodes/fill.el | 13 +++++++ .../fill-paragraph-handle-comment.erts | 37 +++++++++++++++++++ test/lisp/textmodes/fill-tests.el | 4 ++ 3 files changed, 54 insertions(+) create mode 100644 test/lisp/textmodes/fill-resources/fill-paragraph-handle-comment.erts diff --git a/lisp/textmodes/fill.el b/lisp/textmodes/fill.el index c1ccdf2ec5f..270cb388971 100644 --- a/lisp/textmodes/fill.el +++ b/lisp/textmodes/fill.el @@ -911,6 +911,7 @@ region, instead of just filling the current paragraph." (fill-comment-paragraph justify))) ;; 4. If it all fails, default to the good ol' text paragraph filling. (let ((before (point)) + (paragraph-start-orig paragraph-start) (paragraph-start paragraph-start) ;; Fill prefix used for filling the paragraph. fill-pfx) @@ -933,6 +934,18 @@ region, instead of just filling the current paragraph." (setq fill-pfx "") (let ((end (point)) (beg (progn (fill-forward-paragraph -1) (point)))) + ;; If the paragraph starts with a comment line preceding point + ;; on a non-comment line, skip such comment lines, so they + ;; are not filled together (bug#80449). + (when (and fill-paragraph-handle-comment comment-start-skip + (< beg before)) + (save-excursion + (goto-char beg) + (when (looking-at paragraph-start-orig) + (goto-char (1+ (match-end 0)))) + (when (looking-at comment-start-skip) + (forward-line 1) + (setq beg (point))))) (goto-char before) (setq fill-pfx (if use-hard-newlines diff --git a/test/lisp/textmodes/fill-resources/fill-paragraph-handle-comment.erts b/test/lisp/textmodes/fill-resources/fill-paragraph-handle-comment.erts new file mode 100644 index 00000000000..c7c9e96ea50 --- /dev/null +++ b/test/lisp/textmodes/fill-resources/fill-paragraph-handle-comment.erts @@ -0,0 +1,37 @@ +Point-Char: | + +Name: fill-paragraph-handle-comment - non-comment line before comment line +Code: + (lambda () + (setq-local comment-start "# ") + (setq-local fill-paragraph-handle-comment t) + (setq-local fill-column 42) + (fill-paragraph)) + +=-= + +this is not part of the comment this is not part of the comment| +# this is a comment this is a comment this is a comment + +=-= + +this is not part of the comment this is +not part of the comment +# this is a comment this is a comment this is a comment + +=-=-= + +Name: fill-paragraph-handle-comment - non-comment line after comment line + +=-= + +# this is a comment this is a comment this is a comment +this is not part of the comment this is not part of the comment| + +=-= + +# this is a comment this is a comment this is a comment +this is not part of the comment this is +not part of the comment + +=-=-= diff --git a/test/lisp/textmodes/fill-tests.el b/test/lisp/textmodes/fill-tests.el index 2bb9d3ea163..c37a879b4b2 100644 --- a/test/lisp/textmodes/fill-tests.el +++ b/test/lisp/textmodes/fill-tests.el @@ -163,6 +163,10 @@ eius. Foo"))) (skip-unless (functionp 'markdown-mode)) (ert-test-erts-file (ert-resource-file "fill-paragraph-semlf-markdown-mode.erts"))) +(ert-deftest fill-test-fill-paragraph-handle-comment () + "Test the `fill-paragraph-handle-comment' variable." + (ert-test-erts-file (ert-resource-file "fill-paragraph-handle-comment.erts"))) + (provide 'fill-tests) ;;; fill-tests.el ends here From c3babe4b8966c3ada6305b2af85e24398190a14f Mon Sep 17 00:00:00 2001 From: Zhengyi Fu Date: Wed, 27 May 2026 10:03:36 +0800 Subject: [PATCH 14/14] Fix lax whitespace highlight during query-replace * lisp/replace.el (query-replace-read-args): Add :lax-whitespace to minibuffer-lazy-highlight-setup, so lazy highlight during query-replace respects replace-lax-whitespace and replace-regexp-lax-whitespace (bug#81131). Copyright-paperwork-exempt: yes --- lisp/replace.el | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lisp/replace.el b/lisp/replace.el index 48e158de531..4bb91fbd6a0 100644 --- a/lisp/replace.el +++ b/lisp/replace.el @@ -369,6 +369,8 @@ should a regexp." (replace--region-filter (funcall region-extract-function 'bounds))) :highlight (and query-replace-lazy-highlight (not no-highlight)) + :lax-whitespace (if regexp-flag replace-regexp-lax-whitespace + replace-lax-whitespace) :regexp regexp-flag :regexp-function (or replace-regexp-function delimited-flag