commit 49f449bb5bc90bc1eca6b4a1f013d4c0b5460d65 (HEAD, refs/remotes/origin/master) Author: João Távora Date: Mon Jan 20 19:19:08 2025 +0000 Eglot: release version 1.18 * etc/EGLOT-NEWS: Update. * lisp/progmodes/eglot.el (Version): Bump to 1.18 diff --git a/etc/EGLOT-NEWS b/etc/EGLOT-NEWS index 3f1b76bdea0..f4621994b67 100644 --- a/etc/EGLOT-NEWS +++ b/etc/EGLOT-NEWS @@ -20,11 +20,16 @@ https://github.com/joaotavora/eglot/issues/1234. * Changes in upcoming Eglot -** Disable workDoneProgress if eglot-report-progress is nil + +* Changes in Eglot 1.18 (20/1/2025) + +** 'eglot-managed-mode-hook' now run when turning off Eglot (bug#70958) -Eglot will now try to not register $/progress messages from the server -when the defcustom is set to nil. This requires a restart of the server -for the change to take effect. +** Better handling of 'eglot-report-progress' + +Eglot no longer advertises the 'workDoneProgress' capability when this +customization variable is set to nil. This requires a restart of the +server for the change to take effect. ** LSP MarkedString interface is now supported (bug#71353) @@ -38,16 +43,34 @@ C-M-i). ** More strict completion expansion (bug#72705). -It ensures that "expand common" commands (such as C-M-i or TAB in +Ensures that "expand common" commands (such as C-M-i or TAB in third-party frontends) don't result in fewer completions than before they are called. +** More robust completion results when typing quickly (github#1474, bug#73279) + +** Support for 'InsertReplaceEdit' objects (bug#73857) + +This allows servers such as Zig's 'zls' to behave better when completion +starts from the middle of an incomplete symbol. + ** Experimental support for Eglot-only subprojects (github#1337) Useful for complex projects with subprojects needing different language servers. See associated github issue https://github.com/joaotavora/eglot/discussions/1337 for examples. +** Support nested {} in server-provided globs (github#1403) + +In short, play nice with 'tailwindcss-language-server' which seems to +use this. + +** Eglot commands have a 'command-modes' property (bug#70554) + +** Fix to function signature display (bug#74914) + +** Fix command execution (bug#71642) + ** New servers have been added to 'eglot-server-programs'. - blueprint (bug#70015) @@ -56,6 +79,12 @@ https://github.com/joaotavora/eglot/discussions/1337 for examples. - millet - nushell (bug#68823) +** Eglot uses an internal 'track-changes.el' library (bug#70077) + +This should in theory help smoothen the Eglot's handling of events that +change the buffer. The library has been problematic in the past, let's +hope we're past that phase. + * Changes in Eglot 1.17 (25/1/2024) diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index d7caa7d120e..181f4a9c7a0 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -2,7 +2,7 @@ ;; Copyright (C) 2018-2025 Free Software Foundation, Inc. -;; Version: 1.17 +;; Version: 1.18 ;; Author: João Távora ;; Maintainer: João Távora ;; URL: https://github.com/joaotavora/eglot commit aa94e1c56c1b4aeb2e2c98f3b7ccbc354f50108e Author: João Távora Date: Mon Jan 20 19:21:22 2025 +0000 Eglot: fix signature's of Eglot's ElDoc functions These functions are specified to be passed at least one argument, so our implementation must accept an arbitrary number of arguments. * lisp/progmodes/eglot.el (eglot-signature-eldoc-function) (eglot-hover-eldoc-function): Fix signature. diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 4d7ce970543..d7caa7d120e 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -3468,7 +3468,7 @@ for which LSP on-type-formatting should be requested." ": " fpardoc))))) (buffer-string)))) -(defun eglot-signature-eldoc-function (cb) +(defun eglot-signature-eldoc-function (cb &rest _ignored) "A member of `eldoc-documentation-functions', for signatures." (when (eglot-server-capable :signatureHelpProvider) (let ((buf (current-buffer))) @@ -3492,7 +3492,7 @@ for which LSP on-type-formatting should be requested." :deferred :textDocument/signatureHelp)) t)) -(defun eglot-hover-eldoc-function (cb) +(defun eglot-hover-eldoc-function (cb &rest _ignored) "A member of `eldoc-documentation-functions', for hover." (when (eglot-server-capable :hoverProvider) (let ((buf (current-buffer))) commit 1143cf09a339d57051a4341103c9e342d8876649 Author: João Távora Date: Mon Jan 20 18:58:05 2025 +0000 Eglot: add support for insertReplaceEdit (bug#73857) * lisp/progmodes/eglot.el (eglot-server-programs): Mention zig-ts-mode. (eglot--lsp-interface-alist): Describe 'InsertReplaceEdit'. (eglot-client-capabilities): Advertise 'insertReplaceSupport'. (eglot-completion-at-point): Consider 'InsertReplaceEdit'. (eglot--apply-text-edits): Consider 'InsertReplaceEdit'. * test/lisp/progmodes/eglot-tests.el (eglot-test-zig-insert-replace-completion): New test. Special thanks to kcbanner@gmail.com diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 422604f6875..4d7ce970543 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -314,7 +314,7 @@ automatically)." ((lua-mode lua-ts-mode) . ,(eglot-alternatives '("lua-language-server" "lua-lsp"))) (yang-mode . ("yang-language-server")) - (zig-mode . ("zls")) + ((zig-mode zig-ts-mode) . ("zls")) ((css-mode css-ts-mode) . ,(eglot-alternatives '(("vscode-css-language-server" "--stdio") ("css-languageserver" "--stdio")))) @@ -658,6 +658,7 @@ This can be useful when using docker to run a language server.") (:detail :deprecated :children)) (TextDocumentEdit (:textDocument :edits) ()) (TextEdit (:range :newText)) + (InsertReplaceEdit (:newText :insert :replace)) (VersionedTextDocumentIdentifier (:uri :version) ()) (WorkDoneProgress (:kind) (:title :message :percentage :cancellable)) (WorkspaceEdit () (:changes :documentChanges)) @@ -970,7 +971,8 @@ object." ["documentation" "details" "additionalTextEdits"]) - :tagSupport (:valueSet [1])) + :tagSupport (:valueSet [1]) + :insertReplaceSupport t) :contextSupport t) :hover (list :dynamicRegistration :json-false :contentFormat (eglot--accepted-formats)) @@ -3367,8 +3369,15 @@ for which LSP on-type-formatting should be requested." ;; insertion to potentially cancel an essential ;; resolution request (github#1474). 'dont-cancel-on-input) - (let ((snippet-fn (and (eql insertTextFormat 2) - (eglot--snippet-expansion-fn)))) + (let* ((snippet-fn (and (eql insertTextFormat 2) + (eglot--snippet-expansion-fn))) + (apply-edit + (lambda (range text) + (pcase-let ((`(,beg . ,end) + (eglot-range-region range))) + (delete-region beg end) + (goto-char beg) + (funcall (or snippet-fn #'insert) text))))) (cond (textEdit ;; Revert buffer back to state when the edit ;; was obtained from server. If a `proxy' @@ -3377,12 +3386,11 @@ for which LSP on-type-formatting should be requested." ;; state, _not_ the current "foo.bar". (delete-region orig-pos (point)) (insert (substring bounds-string (- orig-pos (car bounds)))) - (eglot--dbind ((TextEdit) range newText) textEdit - (pcase-let ((`(,beg . ,end) - (eglot-range-region range))) - (delete-region beg end) - (goto-char beg) - (funcall (or snippet-fn #'insert) newText)))) + (eglot--dcase textEdit + (((TextEdit) range newText) + (funcall apply-edit range newText)) + (((InsertReplaceEdit) newText replace) + (funcall apply-edit replace newText)))) (snippet-fn ;; A snippet should be inserted, but using plain ;; `insertText'. This requires us to delete the @@ -3611,8 +3619,12 @@ If SILENT, don't echo progress in mode-line." (replace-buffer-contents temp))) (when reporter (eglot--reporter-update reporter (cl-incf done)))))))) - (mapcar (eglot--lambda ((TextEdit) range newText) - (cons newText (eglot-range-region range 'markers))) + (mapcar (lambda (edit) + (eglot--dcase edit + (((TextEdit) range newText) + (cons newText (eglot-range-region range 'markers))) + (((InsertReplaceEdit) newText replace) + (cons newText (eglot-range-region replace 'markers))))) (reverse edits))) (undo-amalgamate-change-group change-group) (when reporter diff --git a/test/lisp/progmodes/eglot-tests.el b/test/lisp/progmodes/eglot-tests.el index 2dc45df7d9e..d54654b84ac 100644 --- a/test/lisp/progmodes/eglot-tests.el +++ b/test/lisp/progmodes/eglot-tests.el @@ -725,6 +725,21 @@ directory hierarchy." "fn test() -> i32 { let v: usize = 1; v.count_ones.1234567890;") (buffer-string)))))) +(ert-deftest eglot-test-zig-insert-replace-completion () + "Test zls's use of 'InsertReplaceEdit'." + (skip-unless (functionp 'zig-ts-mode)) + (eglot--with-fixture + `(("project" . + (("main.zig" . + ,(concat "const Foo = struct {correct_name: u32,\n};\n" + "fn example(foo: Foo) u32 {return foo.correc_name; }"))))) + (with-current-buffer + (eglot--find-file-noselect "project/main.zig") + (should (eglot--tests-connect)) + (search-forward "foo.correc") + (completion-at-point) + (should (looking-back "correct_name"))))) + (ert-deftest eglot-test-basic-xref () "Test basic xref functionality in a clangd LSP." (skip-unless (executable-find "clangd")) commit a1ce633ca9be91c4acba4125cdabc5b6f600e5ff Author: João Távora Date: Mon Jan 20 17:42:59 2025 +0000 Eglot: make eglot-test-javascript-basic more robust * test/lisp/progmodes/eglot-tests.el (eglot-test-javascript-basic): Mark test expensive and increase timeout. diff --git a/test/lisp/progmodes/eglot-tests.el b/test/lisp/progmodes/eglot-tests.el index 10e8fb1d41b..2dc45df7d9e 100644 --- a/test/lisp/progmodes/eglot-tests.el +++ b/test/lisp/progmodes/eglot-tests.el @@ -866,6 +866,7 @@ int main() { (ert-deftest eglot-test-javascript-basic () "Test basic autocompletion in a JavaScript LSP." + :tags '(:expensive-test) (skip-unless (and (executable-find "typescript-language-server") (executable-find "tsserver"))) (eglot--with-fixture @@ -880,14 +881,14 @@ int main() { :client-notifications c-notifs) (should (eglot--tests-connect)) - (eglot--wait-for (s-notifs 2) (&key method &allow-other-keys) + (eglot--wait-for (s-notifs 10) (&key method &allow-other-keys) (string= method "textDocument/publishDiagnostics")) (should (not (eq 'flymake-error (face-at-point)))) (insert "{") (eglot--signal-textDocument/didChange) (eglot--wait-for (c-notifs 1) (&key method &allow-other-keys) (string= method "textDocument/didChange")) - (eglot--wait-for (s-notifs 2) (&key params method &allow-other-keys) + (eglot--wait-for (s-notifs 10) (&key params method &allow-other-keys) (and (string= method "textDocument/publishDiagnostics") (cl-destructuring-bind (&key _uri diagnostics) params (cl-find-if (jsonrpc-lambda (&key severity &allow-other-keys) commit 73f51f3a99ed454fa57e5ebe177df00cada1f11a Author: João Távora Date: Mon Jan 20 17:23:08 2025 +0000 Eglot: try again to fix try-completion logic Emacs partial completion simply doesn't make sense in LSP. Attempts to make it make some sense end up failing for one reason or another. This commit restores the original intention of the eglot--dumb-allc and eglot--dumb-tryc functions, which was to be dumb and pop up a *Completions* buffer (or a company tooltip), as soon as there is doubt over what the user wants to do. It also fixes tests, including an expensive Rust test that had been broken for a long time. * lisp/progmodes/eglot.el (eglot--dumb-allc): Consider point. (eglot--dumb-tryc): Make it suitably dumb again. * test/lisp/progmodes/eglot-tests.el (eglot--wait-for-rust-analyzer): Wait longer. (eglot-test-common-prefix-completion): Delete this test. It's not the intended behavior. (eglot--kill-completions-buffer): New helper. (eglot-test-try-completion-nomatch): Rework test. (eglot-test-try-completion-inside-symbol): Pops *Completions* buffer because mustn't partial complete. (eglot-test-try-completion-inside-symbol-2): Does complete. (eglot-test-rust-completion-exit-function): Fix long-broken test. diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 3c9644568ef..422604f6875 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -3162,22 +3162,14 @@ for which LSP on-type-formatting should be requested." nil comp) finally (cl-return comp))) -(defun eglot--dumb-allc (pat table pred _point) (funcall table pat pred t)) +(defun eglot--dumb-allc (pat table pred point) + (funcall table (substring pat 0 point) pred t)) + (defun eglot--dumb-tryc (pat table pred point) - (let ((probe (funcall table pat pred nil))) - (cond ((eq probe t) t) - (probe - (if (and (not (equal probe pat)) - (cl-every - (lambda (s) (string-prefix-p probe s completion-ignore-case)) - (funcall table pat pred t))) - (cons probe (length probe)) - (cons pat point))) - (t - ;; Match ignoring suffix: if there are any completions for - ;; the current prefix at least, keep the current input. - (and (funcall table (substring pat 0 point) pred t) - (cons pat point)))))) + (let* ((probe (funcall table (substring pat 0 point) pred t))) + (cond ((and probe (null (cdr probe))) + (cons (car probe) (length (car probe)))) + (t (cons pat point))))) (add-to-list 'completion-category-defaults '(eglot-capf (styles eglot--dumb-flex))) (add-to-list 'completion-styles-alist '(eglot--dumb-flex eglot--dumb-tryc eglot--dumb-allc)) diff --git a/test/lisp/progmodes/eglot-tests.el b/test/lisp/progmodes/eglot-tests.el index dd2f4428366..10e8fb1d41b 100644 --- a/test/lisp/progmodes/eglot-tests.el +++ b/test/lisp/progmodes/eglot-tests.el @@ -595,11 +595,12 @@ directory hierarchy." (eglot--wait-for (s-notifs 20) (&key method params &allow-other-keys) (and (string= method "$/progress") - "rustAnalyzer/Indexing" - (equal params - '(:token "rustAnalyzer/Indexing" :value - ;; Could wait for :kind "end" instead, but it's 2 more seconds. - (:kind "begin" :title "Indexing" :cancellable :json-false :percentage 0))))))) + (equal (plist-get params :token) "rustAnalyzer/Roots Scanned") + (equal (plist-get (plist-get params :value) :kind) "end"))) + ;; Annoyingly, waiting for that special progress report is still not + ;; enough to make sure the server is ready to provide completions, + ;; so here's two extra seconds. + (sit-for 2))) (ert-deftest eglot-test-basic-completions () "Test basic autocompletion in a clangd LSP." @@ -614,20 +615,6 @@ directory hierarchy." (message (buffer-string)) (should (looking-back "fprintf.?"))))) -(ert-deftest eglot-test-common-prefix-completion () - "Test completion appending the common prefix." - (skip-unless (executable-find "clangd")) - (eglot--with-fixture - `(("project" . (("coiso.c" . - ,(concat "int foo_bar; int foo_bar_baz;" - "int main() {foo"))))) - (with-current-buffer - (eglot--find-file-noselect "project/coiso.c") - (eglot--wait-for-clangd) - (goto-char (point-max)) - (completion-at-point) - (should (looking-back "{foo_bar"))))) - (ert-deftest eglot-test-non-unique-completions () "Test completion resulting in 'Complete, but not unique'." (skip-unless (executable-find "clangd")) @@ -661,6 +648,10 @@ directory hierarchy." (completion-at-point) (should (looking-back "foo"))))) +(defun eglot--kill-completions-buffer () + (when (buffer-live-p (get-buffer "*Completions*")) + (kill-buffer "*Completions*"))) + (ert-deftest eglot-test-try-completion-nomatch () "Test completion table with non-matching input, returning nil." (skip-unless (executable-find "clangd")) @@ -670,12 +661,11 @@ directory hierarchy." (with-current-buffer (eglot--find-file-noselect "project/coiso.c") (eglot--wait-for-clangd) + (eglot--kill-completions-buffer) (goto-char (point-max)) - (should - (null - (completion-try-completion - "abc" - (nth 2 (eglot-completion-at-point)) nil 3)))))) + (completion-at-point) + (should (looking-back "abc")) + (should-not (get-buffer "*Completions*"))))) (ert-deftest eglot-test-try-completion-inside-symbol () "Test completion table inside symbol, with only prefix matching." @@ -684,21 +674,38 @@ directory hierarchy." `(("project" . (("coiso.c" . ,(concat "int foobar;" + "int foobarbaz;" "int main() {foo123"))))) (with-current-buffer (eglot--find-file-noselect "project/coiso.c") (eglot--wait-for-clangd) (goto-char (- (point-max) 3)) - (when (buffer-live-p "*Completions*") - (kill-buffer "*Completions*")) + (eglot--kill-completions-buffer) (completion-at-point) (should (looking-back "foo")) (should (looking-at "123")) - (should (get-buffer "*Completions*")) - ))) + (should (get-buffer "*Completions*"))))) + +(ert-deftest eglot-test-try-completion-inside-symbol-2 () + "Test completion table inside symbol, with only prefix matching." + (skip-unless (executable-find "clangd")) + (eglot--with-fixture + `(("project" . (("coiso.c" . + ,(concat + "int foobar;" + "int main() {foo123"))))) + (with-current-buffer + (eglot--find-file-noselect "project/coiso.c") + (eglot--wait-for-clangd) + (goto-char (- (point-max) 3)) + (completion-at-point) + (should (looking-back "foobar")) + (should (looking-at "123"))))) (ert-deftest eglot-test-rust-completion-exit-function () - "Ensure that the rust-analyzer exit function creates the expected contents." + "Ensure rust-analyzer exit function creates the expected contents." + :tags '(:expensive-test) + ;; This originally appeared in github#1339 (skip-unless (executable-find "rust-analyzer")) (skip-unless (executable-find "cargo")) (eglot--with-fixture @@ -708,25 +715,14 @@ directory hierarchy." (with-current-buffer (eglot--find-file-noselect "cmpl-project/main.rs") (should (zerop (shell-command "cargo init"))) - (eglot--tests-connect) - (goto-char (point-min)) (search-forward "v.count_on") - (let ((minibuffer-message-timeout 0) - ;; Fail at (ding) if completion fails. - (executing-kbd-macro t)) - (when (buffer-live-p "*Completions*") - (kill-buffer "*Completions*")) - ;; The design is pretty brittle, we'll need to monitor the - ;; language server for changes in behavior. - (eglot--wait-for-rust-analyzer) - (completion-at-point) - (should (looking-back "\\.count_on")) - (should (get-buffer "*Completions*")) - (minibuffer-next-completion 1) - (minibuffer-choose-completion t)) + (eglot--wait-for-rust-analyzer) + (completion-at-point) (should (equal - "fn test() -> i32 { let v: usize = 1; v.count_ones.1234567890;" + (if (bound-and-true-p yas-minor-mode) + "fn test() -> i32 { let v: usize = 1; v.count_ones().1234567890;" + "fn test() -> i32 { let v: usize = 1; v.count_ones.1234567890;") (buffer-string)))))) (ert-deftest eglot-test-basic-xref () commit 275df7420cfb6a514171cb69a03235ee09aebebf Author: Stefan Kangas Date: Mon Jan 20 18:32:33 2025 +0100 Prefer defvar-keymap in bat-mode.el * lisp/progmodes/bat-mode.el (bat-mode-map): Prefer defvar-keymap. (bat-menu): Move to top level. diff --git a/lisp/progmodes/bat-mode.el b/lisp/progmodes/bat-mode.el index 226614928f1..30a63071007 100644 --- a/lisp/progmodes/bat-mode.el +++ b/lisp/progmodes/bat-mode.el @@ -101,7 +101,15 @@ (,(concat "\\_<" (regexp-opt UNIX) "\\_>") . font-lock-warning-face))))) -(defvar bat-menu +(defvar-keymap bat-mode-map + "C-c C-/" #'bat-cmd-help ;FIXME: Why not C-c C-? ? + "C-c C-a" #'bat-run-args + "C-c C-c" #'bat-run + "C-c C-t" #'bat-template + "C-c C-v" #'bat-run) + +(easy-menu-define bat-menu bat-mode-map + "Menu used for `bat-mode'." '("Bat" ["Run" bat-run :help "Run script"] ["Run with Args" bat-run-args :help "Run script with args"] @@ -112,16 +120,6 @@ "--" ["Help (Command)" bat-cmd-help :help "Show help page for DOS command"])) -(defvar bat-mode-map - (let ((map (make-sparse-keymap))) - (easy-menu-define nil map nil bat-menu) - (define-key map [?\C-c ?\C-/] 'bat-cmd-help) ;FIXME: Why not C-c C-? ? - (define-key map [?\C-c ?\C-a] 'bat-run-args) - (define-key map [?\C-c ?\C-c] 'bat-run) - (define-key map [?\C-c ?\C-t] 'bat-template) - (define-key map [?\C-c ?\C-v] 'bat-run) - map)) - (defvar bat-mode-syntax-table (let ((table (make-syntax-table))) (modify-syntax-entry ?\n ">" table) commit 40d5ff01e51ed6319933e18df0fbe9ef55d9bece Author: Tassilo Horn Date: Mon Jan 20 16:21:24 2025 +0100 Don't skip or double-process files in dired with auto-revert-mode (bug#75626) * lisp/dired.el (dired--inhibit-auto-revert): New variable. (dired-map-over-marks): Make the generated code bind it. (dired-buffer-stale-p): Return nil if dired--inhibit-auto-revert is non-nil. diff --git a/lisp/dired.el b/lisp/dired.el index 2087a6f6f21..d2071d80bf3 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -944,6 +944,9 @@ Return value is the number of files marked, or nil if none were marked." "")))) (and (> count 0) count))) +(defvar-local dired--inhibit-auto-revert nil + "A non-nil value prevents `auto-revert-mode' from reverting the buffer.") + (defmacro dired-map-over-marks (body arg &optional show-progress distinguish-one-marked) "Eval BODY with point on each marked line. Return a list of BODY's results. @@ -980,7 +983,9 @@ marked file, return (t FILENAME) instead of (FILENAME)." ;;endless loop. ;;This warning should not apply any longer, sk 2-Sep-1991 14:10. `(prog1 - (let ((inhibit-read-only t) case-fold-search found results) + (let ((dired--inhibit-auto-revert t) + (inhibit-read-only t) + case-fold-search found results) (if (and ,arg (not (eq ,arg 'marked))) (if (integerp ,arg) (progn ;; no save-excursion, want to move point. @@ -1289,6 +1294,12 @@ This feature is used by Auto Revert mode." ;; Do not auto-revert when the dired buffer can be currently ;; written by the user as in `wdired-mode'. buffer-read-only + ;; When a dired operation using dired-map-over-marks is in + ;; progress, dired--inhibit-auto-revert is bound to some + ;; non-nil value and we must not auto-revert because that could + ;; change the order of files leading to skipping or + ;; double-processing (see bug#75626). + (not dired--inhibit-auto-revert) (dired-directory-changed-p dirname)))) (defcustom dired-auto-revert-buffer nil commit b568ff418ce7147c27d7f82fe4a8eef325b9de2c Author: Stefan Kangas Date: Mon Jan 20 14:05:37 2025 +0100 Use 'max' macro in clip_to_bounds * src/lisp.h (clip_to_bounds): Use 'max' macro. diff --git a/src/lisp.h b/src/lisp.h index 0ac1e1933fd..8b870119315 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -1361,7 +1361,7 @@ EQ (Lisp_Object x, Lisp_Object y) INLINE intmax_t clip_to_bounds (intmax_t lower, intmax_t num, intmax_t upper) { - return num < lower ? lower : min (num, upper); + return max (lower, min (num, upper)); } /* Construct a Lisp_Object from a value or address. */ commit ad51b3b3911bcca1dba5a5b3e5581465d2277d64 Author: Eli Zaretskii Date: Mon Jan 20 14:39:20 2025 +0200 ; Fix last change * src/treesit.c (Ftreesit_parser_create): Fix comment wording. * doc/lispref/parsing.texi (Using Parser): Fix wording and markup. diff --git a/doc/lispref/parsing.texi b/doc/lispref/parsing.texi index 8f1ee614ff2..034c424105b 100644 --- a/doc/lispref/parsing.texi +++ b/doc/lispref/parsing.texi @@ -571,7 +571,7 @@ in the alist, creating a parser for @var{language-a} actually creates a parser for @var{language-b}. By extension, anything that creates a node or makes a query of @var{language-a} will be redirected to use @var{language-b} instead. This mapping is completely transparent, the -parser created will report as @var{language-b}, and the sames goes for +created parser will reported to use @var{language-b}, and the same goes for nodes created by this parser. Specifically, the parser created by @code{treesit-parser-create} will @@ -583,10 +583,10 @@ if language @code{cpp} is mapped to @code{cuda}: (setq treesit-language-remap-alist '((cpp . cuda))) (treesit-parser-language (treesit-parser-create 'cpp)) -;; => 'cpp + @result{} 'cpp (treesit-parser-language (treesit-parser-create 'cuda)) -;; => 'cuda + @result{} 'cuda @end group @end example diff --git a/src/treesit.c b/src/treesit.c index f179e4561cf..d4090b949ea 100644 --- a/src/treesit.c +++ b/src/treesit.c @@ -1688,9 +1688,9 @@ an indirect buffer. */) ts_parser_set_language (parser, lang); /* Create parser. Use the unmapped LANGUAGE symbol, so the nodes - created by this parser (and this parser) self identify as the - unmapped language. This makes the grammar mapping completely - transparent. */ + created by this parser (and the parser itself) identify themselves + as the unmapped language. This makes the grammar mapping + completely transparent. */ Lisp_Object lisp_parser = make_treesit_parser (buf_orig, parser, NULL, language, tag);