From 2d4d6dc43a417b873024d1bee93036d3749f59af Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Sun, 6 Oct 2024 01:47:50 +0200 Subject: [PATCH 01/13] Delete XIE X extension from TODO According to Wikipedia, XIE "is no longer included in the X11 reference distribution, having been removed with X11R6.7 in 2004." Ref: https://en.wikipedia.org/wiki/X_Image_Extension * etc/TODO: Delete item to use XIE X extension. --- etc/TODO | 3 --- 1 file changed, 3 deletions(-) diff --git a/etc/TODO b/etc/TODO index 87ca19f37f2..21c85216964 100644 --- a/etc/TODO +++ b/etc/TODO @@ -788,9 +788,6 @@ to ASCII. *** Provide a user friendly interface to specify fonts -** Use the XIE X extension, if available, for image display -This is obsolete, as XIE itself is now considered obsolete. - ** Make monochrome images honor the face Display those images using the foreground and background colors of the applicable faces. From 37a6c859b04ef9f88c3f9751027d544100cf1d2c Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Sun, 6 Oct 2024 13:38:57 +0800 Subject: [PATCH 02/13] ; * lisp/emacs-lisp/cl-macs.el (cl-once-only): Fix capitalisation. --- lisp/emacs-lisp/cl-macs.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index 2e501005bf7..b37f744b175 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el @@ -2505,7 +2505,7 @@ by EXPANSION, and (setq NAME ...) will act like (setf EXPANSION ...). (defmacro cl-once-only (names &rest body) "Generate code to evaluate each of NAMES just once in BODY. -This macro helps with writing other macros. Each of names is +This macro helps with writing other macros. Each of NAMES is either (NAME FORM) or NAME, which latter means (NAME NAME). During macroexpansion, each NAME is bound to an uninterned symbol. The expansion evaluates each FORM and binds it to the From ed57faafc74e0810b492841deccb3cdc77a258ff Mon Sep 17 00:00:00 2001 From: Yuan Fu Date: Mon, 7 Oct 2024 17:24:32 -0700 Subject: [PATCH 03/13] Set treesit-primary-parser for tree-sitter modes I debated whether to do this, since technically speaking it's not needed for single-language modes. But ultimately it's better to be explicit and set a good example with builtin modes. * lisp/progmodes/cmake-ts-mode.el (cmake-ts-mode): * lisp/progmodes/csharp-mode.el (csharp-ts-mode): * lisp/progmodes/dockerfile-ts-mode.el (dockerfile-ts-mode): * lisp/progmodes/go-ts-mode.el (go-ts-mode): (go-mod-ts-mode): * lisp/progmodes/heex-ts-mode.el (heex-ts-mode): * lisp/progmodes/java-ts-mode.el (java-ts-mode): * lisp/progmodes/json-ts-mode.el (json-ts-mode): * lisp/progmodes/lua-ts-mode.el (lua-ts-mode): * lisp/progmodes/python.el (python-ts-mode): * lisp/progmodes/ruby-ts-mode.el (ruby-ts-mode): * lisp/progmodes/rust-ts-mode.el (rust-ts-mode): * lisp/progmodes/sh-script.el: * lisp/progmodes/typescript-ts-mode.el (typescript-ts-mode): (tsx-ts-mode): * lisp/textmodes/css-mode.el (css-ts-mode): * lisp/textmodes/html-ts-mode.el (html-ts-mode): * lisp/textmodes/toml-ts-mode.el (toml-ts-mode): * lisp/textmodes/yaml-ts-mode.el (yaml-ts-mode): Set treesit-primary-parser. --- lisp/progmodes/cmake-ts-mode.el | 2 +- lisp/progmodes/csharp-mode.el | 2 +- lisp/progmodes/dockerfile-ts-mode.el | 2 +- lisp/progmodes/go-ts-mode.el | 4 ++-- lisp/progmodes/heex-ts-mode.el | 2 +- lisp/progmodes/java-ts-mode.el | 2 +- lisp/progmodes/json-ts-mode.el | 2 +- lisp/progmodes/lua-ts-mode.el | 2 +- lisp/progmodes/python.el | 2 +- lisp/progmodes/ruby-ts-mode.el | 2 +- lisp/progmodes/rust-ts-mode.el | 2 +- lisp/progmodes/sh-script.el | 2 +- lisp/progmodes/typescript-ts-mode.el | 4 ++-- lisp/textmodes/css-mode.el | 2 +- lisp/textmodes/html-ts-mode.el | 2 +- lisp/textmodes/toml-ts-mode.el | 2 +- lisp/textmodes/yaml-ts-mode.el | 2 +- 17 files changed, 19 insertions(+), 19 deletions(-) diff --git a/lisp/progmodes/cmake-ts-mode.el b/lisp/progmodes/cmake-ts-mode.el index 854adf4ade7..597ef69d9b8 100644 --- a/lisp/progmodes/cmake-ts-mode.el +++ b/lisp/progmodes/cmake-ts-mode.el @@ -208,7 +208,7 @@ Return nil if there is no name or if NODE is not a defun node." :syntax-table cmake-ts-mode--syntax-table (when (treesit-ready-p 'cmake) - (treesit-parser-create 'cmake) + (setq treesit-primary-parser (treesit-parser-create 'cmake)) ;; Comments. (setq-local comment-start "# ") diff --git a/lisp/progmodes/csharp-mode.el b/lisp/progmodes/csharp-mode.el index 1f86527191a..b86555b1d87 100644 --- a/lisp/progmodes/csharp-mode.el +++ b/lisp/progmodes/csharp-mode.el @@ -1049,7 +1049,7 @@ Key bindings: (error "Tree-sitter for C# isn't available")) ;; Tree-sitter. - (treesit-parser-create 'c-sharp) + (setq treesit-primary-parser (treesit-parser-create 'c-sharp)) ;; Comments. (c-ts-common-comment-setup) diff --git a/lisp/progmodes/dockerfile-ts-mode.el b/lisp/progmodes/dockerfile-ts-mode.el index e31fd86bbdf..42fa7482a87 100644 --- a/lisp/progmodes/dockerfile-ts-mode.el +++ b/lisp/progmodes/dockerfile-ts-mode.el @@ -133,7 +133,7 @@ Return nil if there is no name or if NODE is not a stage node." :syntax-table dockerfile-ts-mode--syntax-table (when (treesit-ready-p 'dockerfile) - (treesit-parser-create 'dockerfile) + (setq treesit-primary-parser (treesit-parser-create 'dockerfile)) ;; Comments. (setq-local comment-start "# ") diff --git a/lisp/progmodes/go-ts-mode.el b/lisp/progmodes/go-ts-mode.el index 2d3e6aac090..899f7852c2b 100644 --- a/lisp/progmodes/go-ts-mode.el +++ b/lisp/progmodes/go-ts-mode.el @@ -253,7 +253,7 @@ :syntax-table go-ts-mode--syntax-table (when (treesit-ready-p 'go) - (treesit-parser-create 'go) + (setq treesit-primary-parser (treesit-parser-create 'go)) ;; Comments. (setq-local comment-start "// ") @@ -453,7 +453,7 @@ what the parent of the node would be if it were a node." :syntax-table go-mod-ts-mode--syntax-table (when (treesit-ready-p 'gomod) - (treesit-parser-create 'gomod) + (setq treesit-primary-parser (treesit-parser-create 'gomod)) ;; Comments. (setq-local comment-start "// ") diff --git a/lisp/progmodes/heex-ts-mode.el b/lisp/progmodes/heex-ts-mode.el index b527d96b579..84fd513525c 100644 --- a/lisp/progmodes/heex-ts-mode.el +++ b/lisp/progmodes/heex-ts-mode.el @@ -148,7 +148,7 @@ With ARG, do it many times. Negative ARG means move backward." :group 'heex-ts (when (treesit-ready-p 'heex) - (treesit-parser-create 'heex) + (setq treesit-primary-parser (treesit-parser-create 'heex)) ;; Comments (setq-local treesit-thing-settings diff --git a/lisp/progmodes/java-ts-mode.el b/lisp/progmodes/java-ts-mode.el index 4ceb211ade1..6c7c5a30ab8 100644 --- a/lisp/progmodes/java-ts-mode.el +++ b/lisp/progmodes/java-ts-mode.el @@ -326,7 +326,7 @@ Return nil if there is no name or if NODE is not a defun node." (unless (treesit-ready-p 'java) (error "Tree-sitter for Java isn't available")) - (treesit-parser-create 'java) + (setq treesit-primary-parser (treesit-parser-create 'java)) ;; Comments. (c-ts-common-comment-setup) diff --git a/lisp/progmodes/json-ts-mode.el b/lisp/progmodes/json-ts-mode.el index 1fb96555010..7409c6be833 100644 --- a/lisp/progmodes/json-ts-mode.el +++ b/lisp/progmodes/json-ts-mode.el @@ -128,7 +128,7 @@ Return nil if there is no name or if NODE is not a defun node." (unless (treesit-ready-p 'json) (error "Tree-sitter for JSON isn't available")) - (treesit-parser-create 'json) + (setq treesit-primary-parser (treesit-parser-create 'json)) ;; Comments. (setq-local comment-start "// ") diff --git a/lisp/progmodes/lua-ts-mode.el b/lisp/progmodes/lua-ts-mode.el index 4ea453c9b65..aea5e1e6116 100644 --- a/lisp/progmodes/lua-ts-mode.el +++ b/lisp/progmodes/lua-ts-mode.el @@ -752,7 +752,7 @@ Calls REPORT-FN directly." (use-local-map lua-ts-mode-map) (when (treesit-ready-p 'lua) - (treesit-parser-create 'lua) + (setq treesit-primary-parser (treesit-parser-create 'lua)) ;; Comments. (setq-local comment-start "--") diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 0001bdd21a9..e4b9fe2367d 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -7147,7 +7147,7 @@ implementations: `python-mode' and `python-ts-mode'." \\{python-ts-mode-map}" :syntax-table python-mode-syntax-table (when (treesit-ready-p 'python) - (treesit-parser-create 'python) + (setq treesit-primary-parser (treesit-parser-create 'python)) (setq-local treesit-font-lock-feature-list '(( comment definition) ( keyword string type) diff --git a/lisp/progmodes/ruby-ts-mode.el b/lisp/progmodes/ruby-ts-mode.el index adcdf15c7ad..aff0b8911b9 100644 --- a/lisp/progmodes/ruby-ts-mode.el +++ b/lisp/progmodes/ruby-ts-mode.el @@ -1127,7 +1127,7 @@ leading double colon is not added." (unless (treesit-ready-p 'ruby) (error "Tree-sitter for Ruby isn't available")) - (treesit-parser-create 'ruby) + (setq treesit-primary-parser (treesit-parser-create 'ruby)) (setq-local add-log-current-defun-function #'ruby-ts-add-log-current-function) diff --git a/lisp/progmodes/rust-ts-mode.el b/lisp/progmodes/rust-ts-mode.el index 571ffa9b220..038955d1ae0 100644 --- a/lisp/progmodes/rust-ts-mode.el +++ b/lisp/progmodes/rust-ts-mode.el @@ -507,7 +507,7 @@ See `prettify-symbols-compose-predicate'." :syntax-table rust-ts-mode--syntax-table (when (treesit-ready-p 'rust) - (treesit-parser-create 'rust) + (setq treesit-primary-parser (treesit-parser-create 'rust)) ;; Syntax. (setq-local syntax-propertize-function diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index a348e9ba6fd..8ba64100203 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el @@ -1623,7 +1623,7 @@ not written in Bash or sh." (add-hook 'flymake-diagnostic-functions #'sh-shellcheck-flymake nil t) (add-hook 'hack-local-variables-hook #'sh-after-hack-local-variables nil t) - (treesit-parser-create 'bash) + (setq treesit-primary-parser (treesit-parser-create 'bash)) (setq-local treesit-font-lock-feature-list '(( comment function) ( command declaration-command keyword string) diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el index 3606a139d50..4860eaf3a34 100644 --- a/lisp/progmodes/typescript-ts-mode.el +++ b/lisp/progmodes/typescript-ts-mode.el @@ -502,7 +502,7 @@ This mode is intended to be inherited by concrete major modes." :syntax-table typescript-ts-mode--syntax-table (when (treesit-ready-p 'typescript) - (treesit-parser-create 'typescript) + (setq treesit-primary-parser (treesit-parser-create 'typescript)) ;; Indent. (setq-local treesit-simple-indent-rules @@ -540,7 +540,7 @@ at least 3 (which is the default value)." :syntax-table typescript-ts-mode--syntax-table (when (treesit-ready-p 'tsx) - (treesit-parser-create 'tsx) + (setq treesit-primary-parser (treesit-parser-create 'tsx)) ;; Comments. (setq-local comment-start "// ") diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el index f5a20e0ca0e..c8da28187ee 100644 --- a/lisp/textmodes/css-mode.el +++ b/lisp/textmodes/css-mode.el @@ -1814,7 +1814,7 @@ can also be used to fill comments. (setq-local font-lock-fontify-region-function #'css--fontify-region) ;; Tree-sitter specific setup. - (treesit-parser-create 'css) + (setq treesit-primary-parser (treesit-parser-create 'css)) (setq-local treesit-simple-indent-rules css--treesit-indent-rules) (setq-local treesit-defun-type-regexp "rule_set") (setq-local treesit-defun-name-function #'css--treesit-defun-name) diff --git a/lisp/textmodes/html-ts-mode.el b/lisp/textmodes/html-ts-mode.el index 235e1055fa9..f78fbdde1da 100644 --- a/lisp/textmodes/html-ts-mode.el +++ b/lisp/textmodes/html-ts-mode.el @@ -92,7 +92,7 @@ Return nil if there is no name or if NODE is not a defun node." (unless (treesit-ready-p 'html) (error "Tree-sitter for HTML isn't available")) - (treesit-parser-create 'html) + (setq treesit-primary-parser (treesit-parser-create 'html)) ;; Indent. (setq-local treesit-simple-indent-rules html-ts-mode--indent-rules) diff --git a/lisp/textmodes/toml-ts-mode.el b/lisp/textmodes/toml-ts-mode.el index 3c4533a7fea..806f045c23b 100644 --- a/lisp/textmodes/toml-ts-mode.el +++ b/lisp/textmodes/toml-ts-mode.el @@ -124,7 +124,7 @@ Return nil if there is no name or if NODE is not a defun node." :syntax-table toml-ts-mode--syntax-table (when (treesit-ready-p 'toml) - (treesit-parser-create 'toml) + (setq treesit-primary-parser (treesit-parser-create 'toml)) ;; Comments (setq-local comment-start "# ") diff --git a/lisp/textmodes/yaml-ts-mode.el b/lisp/textmodes/yaml-ts-mode.el index 210835585fe..42d7c2e1798 100644 --- a/lisp/textmodes/yaml-ts-mode.el +++ b/lisp/textmodes/yaml-ts-mode.el @@ -148,7 +148,7 @@ boundaries. JUSTIFY is passed to `fill-paragraph'." :syntax-table yaml-ts-mode--syntax-table (when (treesit-ready-p 'yaml) - (treesit-parser-create 'yaml) + (setq treesit-primary-parser (treesit-parser-create 'yaml)) ;; Comments. (setq-local comment-start "# ") From 52746ceb62592fba6d58595b7bc3199058f30185 Mon Sep 17 00:00:00 2001 From: Yuan Fu Date: Mon, 7 Oct 2024 17:27:13 -0700 Subject: [PATCH 04/13] Remove duplicate indent rules in elixir-ts-mode * lisp/progmodes/elixir-ts-mode.el (elixir-ts-mode): There are two forms adding heex-ts--indent-rules, remove one of them. --- lisp/progmodes/elixir-ts-mode.el | 3 --- 1 file changed, 3 deletions(-) diff --git a/lisp/progmodes/elixir-ts-mode.el b/lisp/progmodes/elixir-ts-mode.el index a3e11658468..cacdb266298 100644 --- a/lisp/progmodes/elixir-ts-mode.el +++ b/lisp/progmodes/elixir-ts-mode.el @@ -734,9 +734,6 @@ Return nil if NODE is not a defun node or doesn't have a name." (when (treesit-ready-p 'heex) (setq-local treesit-range-settings elixir-ts--treesit-range-rules) - (setq-local treesit-simple-indent-rules - (append treesit-simple-indent-rules heex-ts--indent-rules)) - (setq-local treesit-font-lock-settings (append treesit-font-lock-settings heex-ts--font-lock-settings)) From 1ea0d9b891bf7abadd291aeb715c51c4cc496dba Mon Sep 17 00:00:00 2001 From: Yuan Fu Date: Tue, 8 Oct 2024 17:33:11 -0700 Subject: [PATCH 05/13] Revert "Set treesit-primary-parser for tree-sitter modes" This reverts commit ed57faafc74e0810b492841deccb3cdc77a258ff. --- lisp/progmodes/cmake-ts-mode.el | 2 +- lisp/progmodes/csharp-mode.el | 2 +- lisp/progmodes/dockerfile-ts-mode.el | 2 +- lisp/progmodes/go-ts-mode.el | 4 ++-- lisp/progmodes/heex-ts-mode.el | 2 +- lisp/progmodes/java-ts-mode.el | 2 +- lisp/progmodes/json-ts-mode.el | 2 +- lisp/progmodes/lua-ts-mode.el | 2 +- lisp/progmodes/python.el | 2 +- lisp/progmodes/ruby-ts-mode.el | 2 +- lisp/progmodes/rust-ts-mode.el | 2 +- lisp/progmodes/sh-script.el | 2 +- lisp/progmodes/typescript-ts-mode.el | 4 ++-- lisp/textmodes/css-mode.el | 2 +- lisp/textmodes/html-ts-mode.el | 2 +- lisp/textmodes/toml-ts-mode.el | 2 +- lisp/textmodes/yaml-ts-mode.el | 2 +- 17 files changed, 19 insertions(+), 19 deletions(-) diff --git a/lisp/progmodes/cmake-ts-mode.el b/lisp/progmodes/cmake-ts-mode.el index 597ef69d9b8..854adf4ade7 100644 --- a/lisp/progmodes/cmake-ts-mode.el +++ b/lisp/progmodes/cmake-ts-mode.el @@ -208,7 +208,7 @@ Return nil if there is no name or if NODE is not a defun node." :syntax-table cmake-ts-mode--syntax-table (when (treesit-ready-p 'cmake) - (setq treesit-primary-parser (treesit-parser-create 'cmake)) + (treesit-parser-create 'cmake) ;; Comments. (setq-local comment-start "# ") diff --git a/lisp/progmodes/csharp-mode.el b/lisp/progmodes/csharp-mode.el index b86555b1d87..1f86527191a 100644 --- a/lisp/progmodes/csharp-mode.el +++ b/lisp/progmodes/csharp-mode.el @@ -1049,7 +1049,7 @@ Key bindings: (error "Tree-sitter for C# isn't available")) ;; Tree-sitter. - (setq treesit-primary-parser (treesit-parser-create 'c-sharp)) + (treesit-parser-create 'c-sharp) ;; Comments. (c-ts-common-comment-setup) diff --git a/lisp/progmodes/dockerfile-ts-mode.el b/lisp/progmodes/dockerfile-ts-mode.el index 42fa7482a87..e31fd86bbdf 100644 --- a/lisp/progmodes/dockerfile-ts-mode.el +++ b/lisp/progmodes/dockerfile-ts-mode.el @@ -133,7 +133,7 @@ Return nil if there is no name or if NODE is not a stage node." :syntax-table dockerfile-ts-mode--syntax-table (when (treesit-ready-p 'dockerfile) - (setq treesit-primary-parser (treesit-parser-create 'dockerfile)) + (treesit-parser-create 'dockerfile) ;; Comments. (setq-local comment-start "# ") diff --git a/lisp/progmodes/go-ts-mode.el b/lisp/progmodes/go-ts-mode.el index 899f7852c2b..2d3e6aac090 100644 --- a/lisp/progmodes/go-ts-mode.el +++ b/lisp/progmodes/go-ts-mode.el @@ -253,7 +253,7 @@ :syntax-table go-ts-mode--syntax-table (when (treesit-ready-p 'go) - (setq treesit-primary-parser (treesit-parser-create 'go)) + (treesit-parser-create 'go) ;; Comments. (setq-local comment-start "// ") @@ -453,7 +453,7 @@ what the parent of the node would be if it were a node." :syntax-table go-mod-ts-mode--syntax-table (when (treesit-ready-p 'gomod) - (setq treesit-primary-parser (treesit-parser-create 'gomod)) + (treesit-parser-create 'gomod) ;; Comments. (setq-local comment-start "// ") diff --git a/lisp/progmodes/heex-ts-mode.el b/lisp/progmodes/heex-ts-mode.el index 84fd513525c..b527d96b579 100644 --- a/lisp/progmodes/heex-ts-mode.el +++ b/lisp/progmodes/heex-ts-mode.el @@ -148,7 +148,7 @@ With ARG, do it many times. Negative ARG means move backward." :group 'heex-ts (when (treesit-ready-p 'heex) - (setq treesit-primary-parser (treesit-parser-create 'heex)) + (treesit-parser-create 'heex) ;; Comments (setq-local treesit-thing-settings diff --git a/lisp/progmodes/java-ts-mode.el b/lisp/progmodes/java-ts-mode.el index 6c7c5a30ab8..4ceb211ade1 100644 --- a/lisp/progmodes/java-ts-mode.el +++ b/lisp/progmodes/java-ts-mode.el @@ -326,7 +326,7 @@ Return nil if there is no name or if NODE is not a defun node." (unless (treesit-ready-p 'java) (error "Tree-sitter for Java isn't available")) - (setq treesit-primary-parser (treesit-parser-create 'java)) + (treesit-parser-create 'java) ;; Comments. (c-ts-common-comment-setup) diff --git a/lisp/progmodes/json-ts-mode.el b/lisp/progmodes/json-ts-mode.el index 7409c6be833..1fb96555010 100644 --- a/lisp/progmodes/json-ts-mode.el +++ b/lisp/progmodes/json-ts-mode.el @@ -128,7 +128,7 @@ Return nil if there is no name or if NODE is not a defun node." (unless (treesit-ready-p 'json) (error "Tree-sitter for JSON isn't available")) - (setq treesit-primary-parser (treesit-parser-create 'json)) + (treesit-parser-create 'json) ;; Comments. (setq-local comment-start "// ") diff --git a/lisp/progmodes/lua-ts-mode.el b/lisp/progmodes/lua-ts-mode.el index aea5e1e6116..4ea453c9b65 100644 --- a/lisp/progmodes/lua-ts-mode.el +++ b/lisp/progmodes/lua-ts-mode.el @@ -752,7 +752,7 @@ Calls REPORT-FN directly." (use-local-map lua-ts-mode-map) (when (treesit-ready-p 'lua) - (setq treesit-primary-parser (treesit-parser-create 'lua)) + (treesit-parser-create 'lua) ;; Comments. (setq-local comment-start "--") diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index e4b9fe2367d..0001bdd21a9 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -7147,7 +7147,7 @@ implementations: `python-mode' and `python-ts-mode'." \\{python-ts-mode-map}" :syntax-table python-mode-syntax-table (when (treesit-ready-p 'python) - (setq treesit-primary-parser (treesit-parser-create 'python)) + (treesit-parser-create 'python) (setq-local treesit-font-lock-feature-list '(( comment definition) ( keyword string type) diff --git a/lisp/progmodes/ruby-ts-mode.el b/lisp/progmodes/ruby-ts-mode.el index aff0b8911b9..adcdf15c7ad 100644 --- a/lisp/progmodes/ruby-ts-mode.el +++ b/lisp/progmodes/ruby-ts-mode.el @@ -1127,7 +1127,7 @@ leading double colon is not added." (unless (treesit-ready-p 'ruby) (error "Tree-sitter for Ruby isn't available")) - (setq treesit-primary-parser (treesit-parser-create 'ruby)) + (treesit-parser-create 'ruby) (setq-local add-log-current-defun-function #'ruby-ts-add-log-current-function) diff --git a/lisp/progmodes/rust-ts-mode.el b/lisp/progmodes/rust-ts-mode.el index 038955d1ae0..571ffa9b220 100644 --- a/lisp/progmodes/rust-ts-mode.el +++ b/lisp/progmodes/rust-ts-mode.el @@ -507,7 +507,7 @@ See `prettify-symbols-compose-predicate'." :syntax-table rust-ts-mode--syntax-table (when (treesit-ready-p 'rust) - (setq treesit-primary-parser (treesit-parser-create 'rust)) + (treesit-parser-create 'rust) ;; Syntax. (setq-local syntax-propertize-function diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index 8ba64100203..a348e9ba6fd 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el @@ -1623,7 +1623,7 @@ not written in Bash or sh." (add-hook 'flymake-diagnostic-functions #'sh-shellcheck-flymake nil t) (add-hook 'hack-local-variables-hook #'sh-after-hack-local-variables nil t) - (setq treesit-primary-parser (treesit-parser-create 'bash)) + (treesit-parser-create 'bash) (setq-local treesit-font-lock-feature-list '(( comment function) ( command declaration-command keyword string) diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el index 4860eaf3a34..3606a139d50 100644 --- a/lisp/progmodes/typescript-ts-mode.el +++ b/lisp/progmodes/typescript-ts-mode.el @@ -502,7 +502,7 @@ This mode is intended to be inherited by concrete major modes." :syntax-table typescript-ts-mode--syntax-table (when (treesit-ready-p 'typescript) - (setq treesit-primary-parser (treesit-parser-create 'typescript)) + (treesit-parser-create 'typescript) ;; Indent. (setq-local treesit-simple-indent-rules @@ -540,7 +540,7 @@ at least 3 (which is the default value)." :syntax-table typescript-ts-mode--syntax-table (when (treesit-ready-p 'tsx) - (setq treesit-primary-parser (treesit-parser-create 'tsx)) + (treesit-parser-create 'tsx) ;; Comments. (setq-local comment-start "// ") diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el index c8da28187ee..f5a20e0ca0e 100644 --- a/lisp/textmodes/css-mode.el +++ b/lisp/textmodes/css-mode.el @@ -1814,7 +1814,7 @@ can also be used to fill comments. (setq-local font-lock-fontify-region-function #'css--fontify-region) ;; Tree-sitter specific setup. - (setq treesit-primary-parser (treesit-parser-create 'css)) + (treesit-parser-create 'css) (setq-local treesit-simple-indent-rules css--treesit-indent-rules) (setq-local treesit-defun-type-regexp "rule_set") (setq-local treesit-defun-name-function #'css--treesit-defun-name) diff --git a/lisp/textmodes/html-ts-mode.el b/lisp/textmodes/html-ts-mode.el index f78fbdde1da..235e1055fa9 100644 --- a/lisp/textmodes/html-ts-mode.el +++ b/lisp/textmodes/html-ts-mode.el @@ -92,7 +92,7 @@ Return nil if there is no name or if NODE is not a defun node." (unless (treesit-ready-p 'html) (error "Tree-sitter for HTML isn't available")) - (setq treesit-primary-parser (treesit-parser-create 'html)) + (treesit-parser-create 'html) ;; Indent. (setq-local treesit-simple-indent-rules html-ts-mode--indent-rules) diff --git a/lisp/textmodes/toml-ts-mode.el b/lisp/textmodes/toml-ts-mode.el index 806f045c23b..3c4533a7fea 100644 --- a/lisp/textmodes/toml-ts-mode.el +++ b/lisp/textmodes/toml-ts-mode.el @@ -124,7 +124,7 @@ Return nil if there is no name or if NODE is not a defun node." :syntax-table toml-ts-mode--syntax-table (when (treesit-ready-p 'toml) - (setq treesit-primary-parser (treesit-parser-create 'toml)) + (treesit-parser-create 'toml) ;; Comments (setq-local comment-start "# ") diff --git a/lisp/textmodes/yaml-ts-mode.el b/lisp/textmodes/yaml-ts-mode.el index 42d7c2e1798..210835585fe 100644 --- a/lisp/textmodes/yaml-ts-mode.el +++ b/lisp/textmodes/yaml-ts-mode.el @@ -148,7 +148,7 @@ boundaries. JUSTIFY is passed to `fill-paragraph'." :syntax-table yaml-ts-mode--syntax-table (when (treesit-ready-p 'yaml) - (setq treesit-primary-parser (treesit-parser-create 'yaml)) + (treesit-parser-create 'yaml) ;; Comments. (setq-local comment-start "# ") From cd36e070c24d7828ea1b9bf62ffa920068ac4d41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20T=C3=A1vora?= Date: Wed, 9 Oct 2024 06:26:27 -0500 Subject: [PATCH 06/13] Eglot: minor changes to doc and docstrings * doc/misc/eglot.texi (Quick Start): Tweak. (Setting Up LSP Servers): Tweak. (Customizing Eglot): Clarify eglot-connect-hook and eglot-initialized-hook. * lisp/progmodes/eglot.el (eglot-connect-hook) (eglot-server-initialized-hook): Rework docstring. --- doc/misc/eglot.texi | 28 +++++++++++++++++----------- lisp/progmodes/eglot.el | 9 ++++++--- 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/doc/misc/eglot.texi b/doc/misc/eglot.texi index fb5b618bd84..959bbfa6857 100644 --- a/doc/misc/eglot.texi +++ b/doc/misc/eglot.texi @@ -123,14 +123,16 @@ Here's how to start using Eglot with your programming project: @item Select and install a language server. -Eglot comes pre-configured with many popular language servers, see the -value of @code{eglot-server-programs}. If the server(s) mentioned -there satisfy your needs for the programming language(s) with which -you want to use Eglot, you just need to make sure those servers are -installed on your system. Alternatively, install one or more servers -of your choice and add them to the value of +Eglot comes pre-configured for many popular language servers, see the +value of @code{eglot-server-programs}. If the server(s) mentioned there +satisfy your needs for the programming language(s) with which you want +to use Eglot, you just need to make sure those servers are installed on +your system and Eglot can find them. + +Alternatively, install one or more servers of your choice and tell Eglot +where to find them. To do that, you may add to the value of @code{eglot-server-programs}, as described in @ref{Setting Up LSP -Servers}. +Servers} or have Eglot prompt you about it (@pxref{Eglot Commands}). @item Turn on Eglot for your project. @@ -197,7 +199,7 @@ particular server(s) you want to install. To use a language server, Eglot must know how to start it and which programming languages each server supports. This information is -provided by the variable @code{eglot-server-programs}. +commonly provided by the variable @code{eglot-server-programs}. @defvar eglot-server-programs This variable associates major modes with names and command-line @@ -939,12 +941,16 @@ to @w{@code{(disallow-non-standard-keys enforce-required-keys)}}. @vindex eglot-server-initialized-hook @item eglot-server-initialized-hook -A hook run after the server object is successfully initialized. +A hook run after the server object is successfully initialized (which +includes launching the process) but before any LSP communication is +attempted. Each function receives a @code{eglot-lsp-server} instance as +argument. @vindex eglot-connect-hook @item eglot-connect-hook -A hook run after connection to the server is successfully -established. @xref{Starting Eglot}. +A hook run after the LSP connection to the server is successfully +established. Each function receives a @code{eglot-lsp-server} instance +as argument. @xref{Starting Eglot}. @item eglot-managed-mode-hook A hook run after Eglot started or stopped managing a buffer. diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 58487924883..e7a0a3ce135 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -1487,18 +1487,21 @@ Use current server's or first available Eglot events buffer." (defvar eglot-connect-hook '(eglot-signal-didChangeConfiguration) - "Hook run after connecting in `eglot--connect'.") + "Hook run after connecting to a server. +Each function is passed an `eglot-lsp-server' instance +as argument.") (defvar eglot-server-initialized-hook '() "Hook run after a `eglot-lsp-server' instance is created. -That is before a connection was established. Use +That is before a connection is established. Use `eglot-connect-hook' to hook into when a connection was successfully established and the server on the other side has received the initializing configuration. -Each function is passed the server as an argument") +Each function is passed an `eglot-lsp-server' instance +as argument.") (defun eglot--cmd (contact) "Helper for `eglot--connect'." From 6a5c2edd84fc3fdb879e4a19ea182c2a4d385833 Mon Sep 17 00:00:00 2001 From: Brennan Vincent Date: Wed, 9 Oct 2024 06:30:30 -0500 Subject: [PATCH 07/13] Eglot: use :immediate t when resolving completions (bug#73279) Copyright-paperwork-exempt: Yes * lisp/progmodes/eglot.el (eglot-completion-at-point): Tweak eglot--request call. --- lisp/progmodes/eglot.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index e7a0a3ce135..0a14146a245 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -3242,7 +3242,8 @@ for which LSP on-type-formatting should be requested." :resolveProvider) (plist-get lsp-comp :data)) (eglot--request server :completionItem/resolve - lsp-comp :cancel-on-input t) + lsp-comp :cancel-on-input t + :immediate t) lsp-comp)))))) (when (and (consp eglot--capf-session) (= (car bounds) (car (nth 0 eglot--capf-session))) From f520008744b1eb71accded4108888d1f2055402e Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Wed, 9 Oct 2024 16:21:08 +0300 Subject: [PATCH 08/13] Avoid segfaults in Rmail-MIME Rmail-MIME decodes text of email, including removal of CR characters, but that can segfault if the text of some MIME part is empty. * src/coding.c (decode_coding_raw_text): * lisp/mail/rmailmm.el (rmail-mime-insert-decoded-text): Don't attempt to decode empty text region. --- lisp/mail/rmailmm.el | 12 +++++++----- src/coding.c | 4 +++- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/lisp/mail/rmailmm.el b/lisp/mail/rmailmm.el index a5ce5b65cd7..d86e48e6281 100644 --- a/lisp/mail/rmailmm.el +++ b/lisp/mail/rmailmm.el @@ -579,11 +579,13 @@ HEADER is a header component of a MIME-entity object (see (ignore-errors (base64-decode-region pos (point)))) ((string= transfer-encoding "quoted-printable") (quoted-printable-decode-region pos (point)))))) - (decode-coding-region - pos (point) - ;; Use -dos decoding, to remove ^M characters left from base64 or - ;; rogue qp-encoded text. - (coding-system-change-eol-conversion coding-system 1)) + ;; If the text is empty, we don't have anything to decode. + (and (/= pos (point)) + (decode-coding-region + pos (point) + ;; Use -dos decoding, to remove ^M characters left from base64 + ;; or rogue qp-encoded text. + (coding-system-change-eol-conversion coding-system 1))) (if (and (or (not rmail-mime-coding-system) (consp rmail-mime-coding-system)) (not (eq (coding-system-base coding-system) 'us-ascii))) diff --git a/src/coding.c b/src/coding.c index b21ed360578..5591b7fed45 100644 --- a/src/coding.c +++ b/src/coding.c @@ -5270,7 +5270,9 @@ decode_coding_raw_text (struct coding_system *coding) coding->chars_at_source = 1; coding->consumed_char = coding->src_chars; coding->consumed = coding->src_bytes; - if (eol_dos && coding->source[coding->src_bytes - 1] == '\r') + if (eol_dos + && coding->src_bytes > 0 /* empty source text? */ + && coding->source[coding->src_bytes - 1] == '\r') { coding->consumed_char--; coding->consumed--; From e49b479f8692573379a1ee3417bdda9e1f777888 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Kvalsvik?= Date: Fri, 4 Oct 2024 21:38:33 +0200 Subject: [PATCH 09/13] Fix c-ts-mode indentation for initializer lists (bug#73661) The intentation behavior differed between c-mode/c++-mode and *-ts-mode for initializer lists where the first element was not at beginning-of-line. The anchor-prev-sibling function gave up and returned nil, but it should (probably) anchor on the first element in the initializer list, such as this: return { v1, v2, ..., y1, y2, ... }; c-ts-mode behaved better and figured out how to align, but I added a test for a similar compound literal to prevent regressions. * lisp/progmodes/c-ts-mode.el (c-ts-mode--anchor-prev-sibling): Anchor at first sibling unless bol is found. * test/lisp/progmodes/c-ts-mode-resources/indent.erts: New initializer list and compound literal test. Copyright-paperwork-exempt: yes --- lisp/progmodes/c-ts-mode.el | 9 +++-- .../progmodes/c-ts-mode-resources/indent.erts | 39 +++++++++++++++++++ 2 files changed, 45 insertions(+), 3 deletions(-) diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el index a3379ad7aab..576d715510d 100644 --- a/lisp/progmodes/c-ts-mode.el +++ b/lisp/progmodes/c-ts-mode.el @@ -324,10 +324,13 @@ characters of the current line." ;; If the start of the previous sibling isn't at the ;; beginning of a line, something's probably not quite ;; right, go a step further. (E.g., comment after a - ;; statement.) + ;; statement.) If the previous sibling is the first named + ;; node then anchor to that, e.g. when returning an aggregate + ;; and starting the items on the same line as {. (_ (goto-char (treesit-node-start prev-sibling)) - (if (looking-back (rx bol (* whitespace)) - (line-beginning-position)) + (if (or (looking-back (rx bol (* whitespace)) + (line-beginning-position))) + (null (treesit-node-prev-sibling prev-sibling t)) (setq continue nil) (setq prev-sibling (treesit-node-prev-sibling prev-sibling))))))) diff --git a/test/lisp/progmodes/c-ts-mode-resources/indent.erts b/test/lisp/progmodes/c-ts-mode-resources/indent.erts index 599173832b5..a13a74cf8b3 100644 --- a/test/lisp/progmodes/c-ts-mode-resources/indent.erts +++ b/test/lisp/progmodes/c-ts-mode-resources/indent.erts @@ -208,6 +208,21 @@ int main() } =-=-= +Name: Return Compund Literal + +=-= +struct pair { int fst, snd; }; +struct pair +make_pair(int long_identifier_a[], int long_identifier_b[], + int offset_a, int offset_b) +{ + int base_offset = 10; + return (struct pair) { long_identifier_a[base_offset + offset_b], + long_identifier_b[base_offset + offset_b] }; +} + +=-=-= + Name: Switch-Case statement =-= @@ -486,6 +501,30 @@ namespace A { } =-=-= +Name: Return Aggregate Initialized Struct + +=-= +struct pair { int x, y; } +pair +make_pair(int long_identifier_a[], int long_identifier_b[], + int offset_a, int offset_b) +{ + int base_offset = 10; + return { long_identifier_a[base_offset + offset_b], + long_identifier_b[base_offset + offset_b] }; +} +=-= +struct pair { int x, y; } +pair +make_pair(int long_identifier_a[], int long_identifier_b[], + int offset_a, int offset_b) +{ + int base_offset = 10; + return { long_identifier_a[base_offset + offset_b], + long_identifier_b[base_offset + offset_b] }; +} +=-=-= + Code: (lambda () (c-ts-mode) From d664227f81aed98097520877a16c5369403a6a2d Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Thu, 10 Oct 2024 11:03:48 +0300 Subject: [PATCH 10/13] ; More accurate documentation of 'file-newer-than-file-p' * doc/lispref/files.texi (File Attributes): * src/fileio.c (Ffile_newer_than_file_p): Say the comparison uses the last-modification times. (Bug#73709) --- doc/lispref/files.texi | 3 ++- src/fileio.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/doc/lispref/files.texi b/doc/lispref/files.texi index 70db8521481..5c63f192447 100644 --- a/doc/lispref/files.texi +++ b/doc/lispref/files.texi @@ -1299,7 +1299,8 @@ and modification. This function returns @code{t} if the file @var{filename1} is newer than file @var{filename2}. If @var{filename1} does not exist, it returns @code{nil}. If @var{filename1} does exist, but -@var{filename2} does not, it returns @code{t}. +@var{filename2} does not, it returns @code{t}. Otherwise, it compares +the times of last modification of the files. In the following example, assume that the file @file{aug-19} was written on the 19th, @file{aug-20} was written on the 20th, and the file diff --git a/src/fileio.c b/src/fileio.c index 7afe3e75737..2db2760916b 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -3788,7 +3788,8 @@ DEFUN ("unix-sync", Funix_sync, Sunix_sync, 0, 0, "", DEFUN ("file-newer-than-file-p", Ffile_newer_than_file_p, Sfile_newer_than_file_p, 2, 2, 0, doc: /* Return t if file FILE1 is newer than file FILE2. If FILE1 does not exist, the answer is nil; -otherwise, if FILE2 does not exist, the answer is t. */) +otherwise, if FILE2 does not exist, the answer is t. +For existing files, this compares their last-modified times. */) (Lisp_Object file1, Lisp_Object file2) { struct stat st1, st2; From 6dbe4e99ac41bc1f5bcbdbda3c215941170bc9c5 Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Fri, 11 Oct 2024 15:26:28 +0200 Subject: [PATCH 11/13] ; * lisp/emacs-lisp/chart.el (chart-bar-quickie): Improve documentation. --- lisp/emacs-lisp/chart.el | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/lisp/emacs-lisp/chart.el b/lisp/emacs-lisp/chart.el index 2ca9b64be33..b9646e93253 100644 --- a/lisp/emacs-lisp/chart.el +++ b/lisp/emacs-lisp/chart.el @@ -574,13 +574,11 @@ R1 and R2 are dotted pairs. Colorize it with FACE." (defun chart-bar-quickie (dir title namelst nametitle numlst numtitle &optional max sort-pred) - "Wash over the complex EIEIO stuff and create a nice bar chart. -Create it going in direction DIR [`horizontal' `vertical'] with TITLE -using a name sequence NAMELST labeled NAMETITLE with values NUMLST -labeled NUMTITLE. -Optional arguments: -Set the chart's max element display to MAX, and sort lists with -SORT-PRED if desired." + "Create a bar chart in direction DIR [`horizontal' `vertical'] named TITLE. +NAMELST is the list of bar names and NAMETITLE is the name the of axis containing +them. NUMLST is the list of values and NUMTITLE is the name of the value +axis. Optional arguments: Set the chart's max element display to MAX, and sort +lists with SORT-PRED if desired." (let ((nc (make-instance 'chart-bar :title title :key-label "8-m" ; This is a text key pic From fb155bcfb6f7dfdec3aaf9f535428d46419a6b4e Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 12 Oct 2024 08:44:28 +0300 Subject: [PATCH 12/13] ; * lisp/emacs-lisp/chart.el (chart-bar-quickie): Doc fix. --- lisp/emacs-lisp/chart.el | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lisp/emacs-lisp/chart.el b/lisp/emacs-lisp/chart.el index b9646e93253..c472d421eb0 100644 --- a/lisp/emacs-lisp/chart.el +++ b/lisp/emacs-lisp/chart.el @@ -574,11 +574,16 @@ R1 and R2 are dotted pairs. Colorize it with FACE." (defun chart-bar-quickie (dir title namelst nametitle numlst numtitle &optional max sort-pred) - "Create a bar chart in direction DIR [`horizontal' `vertical'] named TITLE. -NAMELST is the list of bar names and NAMETITLE is the name the of axis containing -them. NUMLST is the list of values and NUMTITLE is the name of the value -axis. Optional arguments: Set the chart's max element display to MAX, and sort -lists with SORT-PRED if desired." + "Create a bar chart named TITLE in direction DIR [`horizontal' `vertical']. +NAMELST is the list of bar names and NAMETITLE is the name the of axis +containing them. +NUMLST is the list of values and NUMTITLE is the name of the value +axis. +Optional argument MAX limits the chart's max element display to MAX by +passing it as second argument to `chart-trim', otherwise the chart's +display is unlimited. +Optional argument SORT-PRED is a predicate function passed as second +argument to `chart-sort' to sort the lists if desired." (let ((nc (make-instance 'chart-bar :title title :key-label "8-m" ; This is a text key pic From 0f8f0773183a07a229b23d3f970723ceb9585aef Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Sat, 12 Oct 2024 10:17:10 +0300 Subject: [PATCH 13/13] ; * doc/emacs/search.texi (Word Search): Document 'dictionary-search'. --- doc/emacs/search.texi | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/doc/emacs/search.texi b/doc/emacs/search.texi index 3b52385347b..f23dc1fdb51 100644 --- a/doc/emacs/search.texi +++ b/doc/emacs/search.texi @@ -792,6 +792,46 @@ search engine whose @acronym{URL} is specified by the variable Wowser Manual}). If the region is not active, or doesn't contain any words, this command prompts the user for a URL or keywords to search. +@findex dictionary-search +@findex dictionary +@findex dictionary-tooltip-mode +@cindex dictionary server protocol (DICT) +@cindex word definition search +@vindex dictionary-server + You can also search for definitions of a word by querying dictionary +servers via the @sc{dict} protocol defined by @acronym{RFC} 2229. Emacs +includes a client for this protocol. Type @w{@kbd{M-x dictionary-search +@key{RET}}} to connect to a @sc{dict} server and ask it to provide the +available definitions of a word. This command prompts for the word to +look up, using the word at point as the default, then asks the @sc{dict} +server to provide the definitions of that word in one or more +dictionaries. By default, the command first tries to connect to the +@sc{dict} server installed on the local host, and if that fails, it +tries @file{dict.org} after your confirmation; customize the variable +@code{dictionary-server} to specify, as a string, the URL of a single +server to use (use @samp{localhost} if you want to query only the local +server). Normally, @code{dictionary-search} tells the server to look up +the word in all the dictionaries available to the server, but if you +invoke the command with a prefix argument, it will prompt for a single +dictionary to look. The list of dictionaries available to a server can +be displayed by pressing the @samp{Select dictionary} button shown in +the @file{*Dictionary*} buffer, described below. + + First time you use @code{dictionary-search}, it creates a new +@file{*Dictionary*} buffer and turns on a special mode in it. The +buffer shows buttons for selecting a dictionary, searching a definition +of another word, etc. Subsequent @code{dictionary-search} commands +reuse this buffer. To create another such buffer (e.g., too look up +other words, perhaps in another dictionary), type @w{@kbd{M-x dictionary +@key{RET}}}. + + If you turn on @code{dictionary-tooltip-mode} in a buffer, Emacs will +look up the definitions of the word at mouse pointer and show those +definitions in a tool tip. This is handy when you are reading text with +many words about whose meaning you are unsure. + + For other options of dictionary-search, see the @code{dictionary} +customization group (@pxref{Specific Customization}). @node Symbol Search @section Symbol Search