commit fe58837bbec5181013b178684860f74e0379d965 (HEAD, refs/remotes/origin/master) Author: Stefan Kangas Date: Wed Mar 15 05:12:01 2023 +0100 ; Auto-commit of loaddefs files. diff --git a/lisp/ldefs-boot.el b/lisp/ldefs-boot.el index 65b990682c1..fe46b220da5 100644 --- a/lisp/ldefs-boot.el +++ b/lisp/ldefs-boot.el @@ -3781,6 +3781,12 @@ "cc-styles" (put 'c-basic-offset 'safe-local-variable 'integerp) (put 'c-backslash-column 'safe-local-variable 'integerp) + (put 'c-font-lock-extra-types 'safe-local-variable #'c-list-of-strings) + (put 'c++-font-lock-extra-types 'safe-local-variable #'c-list-of-strings) + (put 'objc-font-lock-extra-types 'safe-local-variable #'c-list-of-strings) + (put 'java-font-lock-extra-types 'safe-local-variable #'c-list-of-strings) + (put 'idl-font-lock-extra-types 'safe-local-variable #'c-list-of-strings) + (put 'pike-font-lock-extra-types 'safe-local-variable #'c-list-of-strings) (put 'c-file-style 'safe-local-variable 'string-or-null-p) (register-definition-prefixes "cc-vars" '("awk-mode-hook" "c++-" "c-" "defcustom-c-stylevar" "idl-" "java-" "objc-" "pike-")) @@ -9212,7 +9218,7 @@ "edt-vt100" ;;; Generated autoloads from progmodes/eglot.el -(push (purecopy '(eglot 1 11)) package--builtin-versions) +(push (purecopy '(eglot 1 12)) package--builtin-versions) (autoload 'eglot "eglot" "\ Start LSP server in support of PROJECT's buffers under MANAGED-MAJOR-MODE. @@ -9256,6 +9262,8 @@ "edt-vt100" (autoload 'eglot-ensure "eglot" "\ Start Eglot session for current buffer if there isn't one.") (put 'eglot-workspace-configuration 'safe-local-variable 'listp) +(put 'eglot--debbugs-or-github-bug-uri 'bug-reference-url-format t) +(defun eglot--debbugs-or-github-bug-uri nil (format (if (string= (match-string 2) "github") "https://github.com/joaotavora/eglot/issues/%s" "https://debbugs.gnu.org/%s") (match-string 3))) (register-definition-prefixes "eglot" '("eglot-")) @@ -9506,6 +9514,15 @@ "elide-head" (fn &optional REINIT)" t) (register-definition-prefixes "elint" '("elint-")) + +;;; Generated autoloads from progmodes/elixir-ts-mode.el + +(autoload 'elixir-ts-mode "elixir-ts-mode" "\ +Major mode for editing Elixir, powered by tree-sitter. + +(fn)" t) +(register-definition-prefixes "elixir-ts-mode" '("elixir-ts-")) + ;;; Generated autoloads from emacs-lisp/elp.el @@ -10178,7 +10195,7 @@ "epg-config" ;;; Generated autoloads from erc/erc.el -(push (purecopy '(erc 5 4 1)) package--builtin-versions) +(push (purecopy '(erc 5 5)) package--builtin-versions) (autoload 'erc-select-read-args "erc" "\ Prompt the user for values of nick, server, port, and password.") (autoload 'erc "erc" "\ @@ -15098,6 +15115,15 @@ "hanoi" (fn &optional ARG)" t) (register-definition-prefixes "hashcash" '("hashcash-")) + +;;; Generated autoloads from progmodes/heex-ts-mode.el + +(autoload 'heex-ts-mode "heex-ts-mode" "\ +Major mode for editing HEEx, powered by tree-sitter. + +(fn)" t) +(register-definition-prefixes "heex-ts-mode" '("heex-ts-")) + ;;; Generated autoloads from help-at-pt.el @@ -18740,7 +18766,7 @@ "json-ts-mode" ;;; Generated autoloads from jsonrpc.el -(push (purecopy '(jsonrpc 1 0 16)) package--builtin-versions) +(push (purecopy '(jsonrpc 1 0 17)) package--builtin-versions) (register-definition-prefixes "jsonrpc" '("jsonrpc-")) @@ -36942,7 +36968,7 @@ "xmltok" ;;; Generated autoloads from progmodes/xref.el -(push (purecopy '(xref 1 6 2)) package--builtin-versions) +(push (purecopy '(xref 1 6 3)) package--builtin-versions) (autoload 'xref-find-backend "xref") (define-obsolete-function-alias 'xref-pop-marker-stack #'xref-go-back "29.1") (autoload 'xref-go-back "xref" "\ commit a054c4aa4a5d42e7abe01f181a40a630f0df2b87 Author: João Távora Date: Wed Mar 15 00:36:26 2023 +0000 More fixes to Eglot tests * test/lisp/progmodes/eglot-tests.el (eglot-test-project-wide-diagnostics-rust-analyzer): Make even more robust. (eglot--wait-for): flush-standard-output doesn't exist in older Emacsen. (eglot-test-basic-diagnostics): Increase timeout. diff --git a/test/lisp/progmodes/eglot-tests.el b/test/lisp/progmodes/eglot-tests.el index d5f0f02fc6b..b95e527c510 100644 --- a/test/lisp/progmodes/eglot-tests.el +++ b/test/lisp/progmodes/eglot-tests.el @@ -281,8 +281,11 @@ eglot--wait-for do ;; `read-event' is essential to have the file ;; watchers come through. - (read-event nil nil 0.1) - (princ ".") (flush-standard-output) + (cond ((fboundp 'flush-standard-output) + (read-event nil nil 0.1) (princ ".") + (flush-standard-output)) + (t + (read-event "." nil 0.1))) (accept-process-output nil 0.1)))) (setq ,events-sym (cdr events)) (cl-destructuring-bind (&key method id &allow-other-keys) (car events) @@ -441,7 +444,7 @@ eglot-test-basic-diagnostics (eglot--find-file-noselect "diag-project/main.c") (eglot--sniffing (:server-notifications s-notifs) (eglot--tests-connect) - (eglot--wait-for (s-notifs 2) + (eglot--wait-for (s-notifs 10) (&key _id method &allow-other-keys) (string= method "textDocument/publishDiagnostics")) (flymake-start) @@ -826,9 +829,10 @@ eglot-test-project-wide-diagnostics-rust-analyzer (eglot--sniffing (:server-notifications s-notifs) (eglot--tests-connect) (flymake-start) - (eglot--wait-for (s-notifs 10) - (&key _id method &allow-other-keys) - (string= method "textDocument/publishDiagnostics")) + (eglot--wait-for (s-notifs 15) + (&key _id method params &allow-other-keys) + (and (string= method "textDocument/publishDiagnostics") + (string-suffix-p "main.rs" (plist-get params :uri)))) (let* ((diags (flymake--project-diagnostics))) (should (cl-some (lambda (diag) (let ((locus (flymake-diagnostic-buffer diag))) commit cf7db4d9dd2e69cf7463a3d43ce7d92a6dce6f3c Author: João Távora Date: Tue Mar 14 19:50:48 2023 +0000 Improve debug output of Eglot tests * test/lisp/progmodes/eglot-tests.el (eglot--test-message): New helper. (eglot--call-with-fixture): Use it. (eglot--cleanup-after-test): Use it. (eglot--wait-for): Use it. Clean mistaken docstring. diff --git a/test/lisp/progmodes/eglot-tests.el b/test/lisp/progmodes/eglot-tests.el index 4d6af79f87f..d5f0f02fc6b 100644 --- a/test/lisp/progmodes/eglot-tests.el +++ b/test/lisp/progmodes/eglot-tests.el @@ -59,6 +59,11 @@ ;;; Helpers +(defun eglot--test-message (format &rest args) + "Message out with FORMAT with ARGS." + (message "[eglot-tests] %s" + (apply #'format format args))) + (defmacro eglot--with-fixture (fixture &rest body) "Setup FIXTURE, call BODY, teardown FIXTURE. FIXTURE is a list. Its elements are of the form (FILE . CONTENT) @@ -102,6 +107,7 @@ eglot--call-with-fixture (push (cons (car spec) (symbol-value (car spec))) syms-to-restore) (set (car spec) (cadr spec))) ((stringp (car spec)) (push spec file-specs)))) + (eglot--test-message "[%s]: test start" (ert-test-name (ert-running-test))) (unwind-protect (let* ((process-environment (append @@ -126,8 +132,8 @@ eglot--call-with-fixture (setq created-files (mapcan #'eglot--make-file-or-dir file-specs)) (prog1 (funcall fn) (setq test-body-successful-p t))) - (eglot--message - "Test body was %s" (if test-body-successful-p "OK" "A FAILURE")) + (eglot--test-message "[%s]: %s" (ert-test-name (ert-running-test)) + (if test-body-successful-p "OK" "FAILED")) (unwind-protect (let ((eglot-autoreconnect nil)) (dolist (server new-servers) @@ -136,8 +142,7 @@ eglot--call-with-fixture (eglot-shutdown server nil 3 (not test-body-successful-p)) (error - (eglot--message "Non-critical shutdown error after test: %S" - oops)))) + (eglot--test-message "Non-critical cleanup error: %S" oops)))) (when (not test-body-successful-p) ;; We want to do this after the sockets have ;; shut down such that any pending data has been @@ -150,21 +155,21 @@ eglot--call-with-fixture (jsonrpc-events-buffer server))))) (cond (noninteractive (dolist (buffer buffers) - (eglot--message "%s:" (buffer-name buffer)) + (eglot--test-message "contents of `%s':" (buffer-name buffer)) (princ (with-current-buffer buffer (buffer-string)) 'external-debugging-output))) (t - (eglot--message "Preserved for inspection: %s" - (mapconcat #'buffer-name buffers ", ")))))))) + (eglot--test-message "Preserved for inspection: %s" + (mapconcat #'buffer-name buffers ", ")))))))) (eglot--cleanup-after-test fixture-directory created-files syms-to-restore))))) (defun eglot--cleanup-after-test (fixture-directory created-files syms-to-restore) (let ((buffers-to-delete (delete nil (mapcar #'find-buffer-visiting created-files)))) - (eglot--message "Killing %s, wiping %s, restoring %s" - buffers-to-delete - fixture-directory - (mapcar #'car syms-to-restore)) + (eglot--test-message "Killing %s, wiping %s, restoring %s" + buffers-to-delete + fixture-directory + (mapcar #'car syms-to-restore)) (cl-loop for (sym . val) in syms-to-restore do (set sym val)) (dolist (buf buffers-to-delete) ;; have to save otherwise will get prompted @@ -252,12 +257,12 @@ eglot--sniffing (advice-remove #'jsonrpc--log-event ',log-event-ad-sym)))) (cl-defmacro eglot--wait-for ((events-sym &optional (timeout 1) message) args &body body) - "Spin until FN match in EVENTS-SYM, flush events after it. -Pass TIMEOUT to `eglot--with-timeout'." (declare (indent 2) (debug (sexp sexp sexp &rest form))) `(eglot--with-timeout '(,timeout ,(or message (format "waiting for:\n%s" (pp-to-string body)))) - (let ((event + (eglot--test-message "waiting for `%s'" (with-output-to-string + (mapc #'princ ',body))) + (let ((events (cl-loop thereis (cl-loop for json in ,events-sym for method = (plist-get json :method) when (keywordp method) @@ -271,16 +276,18 @@ eglot--wait-for collect json into before) for i from 0 when (zerop (mod i 5)) - ;; do (eglot--message "still struggling to find in %s" - ;; ,events-sym) + ;; do (eglot--test-message "still struggling to find in %s" + ;; ,events-sym) do ;; `read-event' is essential to have the file ;; watchers come through. - (read-event "[eglot] Waiting a bit..." nil 0.1) + (read-event nil nil 0.1) + (princ ".") (flush-standard-output) (accept-process-output nil 0.1)))) - (setq ,events-sym (cdr event)) - (eglot--message "Event detected:\n%s" - (pp-to-string (car event)))))) + (setq ,events-sym (cdr events)) + (cl-destructuring-bind (&key method id &allow-other-keys) (car events) + (eglot--test-message "detected: %s" + (or method (and id (format "id=%s" id)))))))) ;; `rust-mode' is not a part of Emacs, so we define these two shims ;; which should be more than enough for testing. @@ -803,17 +810,18 @@ eglot-test-project-wide-diagnostics-rust-analyzer "Test diagnostics through multiple files in a TypeScript LSP." (skip-unless (executable-find "rust-analyzer")) (skip-unless (executable-find "cargo")) + (skip-unless (executable-find "git")) (eglot--with-fixture '(("project" . (("main.rs" . "fn main() -> i32 { return 42.2;}") ("other-file.rs" . "fn foo() -> () { let hi=3; }")))) - (eglot--make-file-or-dir '(".git")) (let ((eglot-server-programs '((rust-mode . ("rust-analyzer"))))) ;; Open other-file.rs, and see diagnostics arrive for main.rs, ;; which we didn't open. (with-current-buffer (eglot--find-file-noselect "project/other-file.rs") + (should (zerop (shell-command "git init"))) (should (zerop (shell-command "cargo init"))) (eglot--sniffing (:server-notifications s-notifs) (eglot--tests-connect) commit d3ab5f68773d70eb9e0a2396975583bf14453f40 Author: João Távora Date: Tue Mar 14 19:44:45 2023 +0000 Robustify some Eglot tests involving rust-analyzer * eglot-tests.el (eglot-test-diagnostics-tags-unnecessary-code): Use clangd instead of rust-analyzer. (eglot-test-project-wide-diagnostics-rust-analyzer): Don't count diagnostics, just check they come from unvisited file. (eglot-test-rust-analyzer-watches-files): Wait a bit more time.. diff --git a/test/lisp/progmodes/eglot-tests.el b/test/lisp/progmodes/eglot-tests.el index 9cb6befa993..4d6af79f87f 100644 --- a/test/lisp/progmodes/eglot-tests.el +++ b/test/lisp/progmodes/eglot-tests.el @@ -407,7 +407,7 @@ eglot-test-rust-analyzer-watches-files ) (should (eglot--tests-connect)) (let (register-id) - (eglot--wait-for (s-requests 1) + (eglot--wait-for (s-requests 3) (&key id method &allow-other-keys) (setq register-id id) (string= method "client/registerCapability")) @@ -444,16 +444,19 @@ eglot-test-basic-diagnostics (ert-deftest eglot-test-diagnostic-tags-unnecessary-code () "Test rendering of diagnostics tagged \"unnecessary\"." - (skip-unless (executable-find "rust-analyzer")) - (skip-unless (executable-find "cargo")) + (skip-unless (executable-find "clangd")) (eglot--with-fixture - '(("diagnostic-tag-project" . - (("main.rs" . - "fn main() -> () { let test=3; }")))) + `(("diag-project" . + (("main.cpp" . "int main(){float a = 42.2; return 0;}")))) (with-current-buffer - (eglot--find-file-noselect "diagnostic-tag-project/main.rs") - (let ((eglot-server-programs '((rust-mode . ("rust-analyzer"))))) - (should (zerop (shell-command "cargo init"))) + (eglot--find-file-noselect "diag-project/main.cpp") + (eglot--make-file-or-dir '(".git")) + (eglot--make-file-or-dir + `("compile_commands.json" . + ,(json-serialize + `[(:directory ,default-directory :command "/usr/bin/c++ -Wall -c main.cpp" + :file ,(expand-file-name "main.cpp"))]))) + (let ((eglot-server-programs '((c++-mode . ("clangd"))))) (eglot--sniffing (:server-notifications s-notifs) (eglot--tests-connect) (eglot--wait-for (s-notifs 10) @@ -803,12 +806,13 @@ eglot-test-project-wide-diagnostics-rust-analyzer (eglot--with-fixture '(("project" . (("main.rs" . - "fn main() -> () { let test=3; }") + "fn main() -> i32 { return 42.2;}") ("other-file.rs" . "fn foo() -> () { let hi=3; }")))) (eglot--make-file-or-dir '(".git")) (let ((eglot-server-programs '((rust-mode . ("rust-analyzer"))))) - ;; Open other-file, and see diagnostics arrive for main.rs + ;; Open other-file.rs, and see diagnostics arrive for main.rs, + ;; which we didn't open. (with-current-buffer (eglot--find-file-noselect "project/other-file.rs") (should (zerop (shell-command "cargo init"))) (eglot--sniffing (:server-notifications s-notifs) @@ -817,13 +821,12 @@ eglot-test-project-wide-diagnostics-rust-analyzer (eglot--wait-for (s-notifs 10) (&key _id method &allow-other-keys) (string= method "textDocument/publishDiagnostics")) - (let ((diags (flymake--project-diagnostics))) - (should (= 2 (length diags))) - ;; Check that we really get a diagnostic from main.rs, and - ;; not from other-file.rs - (should (string-suffix-p - "main.rs" - (flymake-diagnostic-buffer (car diags)))))))))) + (let* ((diags (flymake--project-diagnostics))) + (should (cl-some (lambda (diag) + (let ((locus (flymake-diagnostic-buffer diag))) + (and (stringp (flymake-diagnostic-buffer diag)) + (string-suffix-p "main.rs" locus)))) + diags)))))))) (ert-deftest eglot-test-json-basic () "Test basic autocompletion in vscode-json-languageserver." commit 2957985b541d2d9cd717552c0f6ff04b9028577c Author: João Távora Date: Tue Mar 14 19:43:04 2023 +0000 Check before using bleeding edge ERT sym in Eglot tests Else, these tests won't run on Emacs versions that Eglot runs on, like 26.3. * test/lisp/progmodes/eglot-tests.el (eglot--call-with-tramp-test): check for ert-remote-temporary-file-directory before using. diff --git a/test/lisp/progmodes/eglot-tests.el b/test/lisp/progmodes/eglot-tests.el index 7a90d68d213..9cb6befa993 100644 --- a/test/lisp/progmodes/eglot-tests.el +++ b/test/lisp/progmodes/eglot-tests.el @@ -1262,7 +1262,9 @@ eglot--call-with-tramp-test (let* ((tramp-remote-path (cons 'tramp-own-remote-path tramp-remote-path)) (tramp-histfile-override t) (tramp-verbose 1) - (temporary-file-directory ert-remote-temporary-file-directory) + (temporary-file-directory + (or (bound-and-true-p ert-remote-temporary-file-directory) + temporary-file-directory)) (default-directory temporary-file-directory)) ;; We must check the remote LSP server. So far, just "clangd" is used. (unless (executable-find "clangd" 'remote) commit 2d835d64ba339bb375f0d55c4679149d6da3f209 Author: João Távora Date: Tue Mar 14 19:07:23 2023 +0000 Better jsonrpc.el workaround for debug-on-error check Some extensions, notably ert.el, set `debug-on-error' to non-nil, which makes it hard to test the behaviour catching of the Elisp error when processing a request and replying to the endpoint with an JSONRPC-error. The previous workaround relied on requiring lisp/emacs-lisp/ert.el in lisp/jsonrpc.el, which really doesn't make sense. This is better. For the single test of that behaviour, set a new variable, jsonrpc-inhibit-debug-on-error. Not only is this cleaner, it allows us to use ert.el's useful debug-on-error setting. * lisp/jsonrpc.el (ert): Don't require it. (jsonrpc-inhibit-debug-on-error): New variable. (jsonrpc-connection-receive): Use it. (Package-Requires): Bump to 1.0.17 * test/lisp/jsonrpc-tests.el (signals-an--32603-JSONRPC-error): Bind jsonrpc-inhibit-debug-on-error. diff --git a/lisp/jsonrpc.el b/lisp/jsonrpc.el index f583d116d20..3965d38bc3e 100644 --- a/lisp/jsonrpc.el +++ b/lisp/jsonrpc.el @@ -4,7 +4,7 @@ ;; Author: João Távora ;; Keywords: processes, languages, extensions -;; Version: 1.0.16 +;; Version: 1.0.17 ;; Package-Requires: ((emacs "25.2")) ;; This is a GNU ELPA :core package. Avoid functionality that is not @@ -43,7 +43,6 @@ (eval-when-compile (require 'subr-x)) (require 'warnings) (require 'pcase) -(require 'ert) ; to escape a `condition-case-unless-debug' ;;; Public API @@ -154,6 +153,14 @@ jsonrpc-forget-pending-continuations "Stop waiting for responses from the current JSONRPC CONNECTION." (clrhash (jsonrpc--request-continuations connection))) +(defvar jsonrpc-inhibit-debug-on-error nil + "Inhibit `debug-on-error' when answering requests. +Some extensions, notably ert.el, set `debug-on-error' to non-nil, +which makes it hard to test the behaviour of catching the Elisp +error and replying to the endpoint with an JSONRPC-error. This +variable can be set around calls like `jsonrpc-request' to +circumvent that.") + (defun jsonrpc-connection-receive (connection message) "Process MESSAGE just received from CONNECTION. This function will destructure MESSAGE and call the appropriate @@ -166,7 +173,8 @@ jsonrpc-connection-receive (cond (;; A remote request (and method id) - (let* ((debug-on-error (and debug-on-error (not (ert-running-test)))) + (let* ((debug-on-error (and debug-on-error + (not jsonrpc-inhibit-debug-on-error))) (reply (condition-case-unless-debug _ignore (condition-case oops diff --git a/test/lisp/jsonrpc-tests.el b/test/lisp/jsonrpc-tests.el index a595167d130..85ac96a931c 100644 --- a/test/lisp/jsonrpc-tests.el +++ b/test/lisp/jsonrpc-tests.el @@ -124,7 +124,7 @@ signals-an--32603-JSONRPC-error "Signals an -32603 JSONRPC error." (jsonrpc--with-emacsrpc-fixture (conn) (condition-case err - (progn + (let ((jsonrpc-inhibit-debug-on-error t)) (jsonrpc-request conn '+ ["a" 2]) (ert-fail "A `jsonrpc-error' should have been signaled!")) (jsonrpc-error commit a55aaf9eaf203a4aedb0a492de2c33ab54b0b11c Merge: a0539190979 4b6f2a7028b Author: João Távora Date: Tue Mar 14 18:14:48 2023 +0000 Merge from origin/emacs-29 4b6f2a7028b * lisp/progmodes/xref.el: Bump the version. 24c8b146bbc * lisp/progmodes/xref.el (xref--xref-buffer-mode): Split ... 46f9e53c3da Fix import of keys in buffer created by epa-search-keys 36ade0704e1 Fix connection-local variables settings e759905d2e0 ; Minor copyedits in EGLOT-NEWS ba22a2c346b Bump Eglot version to 1.12 54e123a5055 Update Eglot's manual about eglot-workspace-configuration 812597f864c ; * lisp/novice.el (disabled-command-function): Add note ... 4a603c98499 Amend last Eglot commit (bug#62065) b916ec88b2f Make eglot-ensure's post-command-hook run a bit later (bu... 1c05175c21a Fix display of disabled-command help text 3ce37db9882 Remove mention of old dotted-list reader quirk from manual 42335c2c1f1 Fix value history shown for 'gc-cons-percentage' fffbce29349 TRework fix for bug#62106 8bc12a27362 ; * etc/NEWS: Fix last change. 2ac068d294e ; Remove 'ns-popup-font-panel' from documentation 5bc32d008fb Add missing indentation rule for rust-ts-mode (Bug#62109) 0404924930d ; One more improvement to ELisp "internals" appendix. c857775ca61 Fix bug#62106 0fedbfa6a9d ; Minor improvement of documentation of GC thresholds b0b24ad2fc5 Add missing rust-ts-mode highlight query for scoped_type_... c0cf69f7a17 Make "case" keyword a dedenter in Python db178517ce7 ; * lisp/arc-mode.el (w32-get-console-codepage): Declare. 157a91b54be Fix decoding non-ASCII file names in zip archives on MS-W... 4803f972047 Fix copying binary files from zip archives 679f528b953 Skip ruby-ts-syntax-propertize-symbol unless treesitter i... 081cc7aa8e0 ; * doc/misc/eglot.texi (Project-specific configuration):... 1de513a29fa Fix enums and unions appearing as structs in c-ts-base-mo... ecdfd584a52 ruby-ts-mode: Fine-tune s-p-f on symbols (bug#62086) 29228e24f20 python-info-dedenter-opening-block-positions: Fix to supp... 01b65d442ad Autoload Eglot helper funtion eglot--debbugs-or-github-bu... 50a3559c5a7 Add chapter on advanced server configuration to Eglot manual 2e7460c2315 ; * lisp/progmodes/java-ts-mode.el (treesit-query-capture... 255eeee0e06 java-ts-mode: detect if text_block is supported. 6fe9075ff38 Revert workaround introduced in Bug#56271 f175141aead Fix searching for end of string in python-nav-end-of-stat... # Conflicts: # etc/NEWS commit a0539190979e3c4adc59a7e527d9f5a850d966bf Author: Michael Albinus Date: Tue Mar 14 11:39:32 2023 +0100 ; * etc/NEWS: Fix typos. diff --git a/etc/NEWS b/etc/NEWS index 3b02e85b691..9edea44ad1b 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -232,8 +232,8 @@ from the available shortdoc information. This function inserts into the current buffer examples of use of a given Emacs Lisp function, which it gleans from the shortdoc information. If you want 'describe-function' ('C-h f') to insert -examples of using the function into regular *Help* buffers, add the -following to you init file: +examples of using the function into regular "*Help*" buffers, add the +following to your init file: (add-hook 'help-fns-describe-function-functions #'shortdoc-help-fns-examples-function) @@ -249,11 +249,11 @@ An optional major mode based on the tree-sitter library for editing HTML files. --- -*** New major mode heex-ts-mode'. +*** New major mode 'heex-ts-mode'. A major mode based on the tree-sitter library for editing HEEx files. --- -*** New major mode elixir-ts-mode'. +*** New major mode 'elixir-ts-mode'. A major mode based on the tree-sitter library for editing Elixir files. commit 401ce12d6264b2763cea06363f7f5ef17232be41 Author: Michael Albinus Date: Tue Mar 14 11:39:16 2023 +0100 Fix Tramp tests * test/lisp/net/tramp-tests.el (tramp-test26-file-name-completion): Fix test. (tramp-test45-asynchronous-requests): Mark it :unstable. diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index b6ad2e2f219..e99089f1667 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -4592,9 +4592,11 @@ tramp-test26-file-name-completion (should-not (file-name-completion "a" tmp-name)) ;; `file-name-completion' should not err out if ;; directory does not exist. (Bug#61890) - (should-not - (file-name-completion - "a" (tramp-compat-file-name-concat tmp-name "fuzz"))) + ;; Ange-FTP does not support this. + (unless (tramp--test-ange-ftp-p) + (should-not + (file-name-completion + "a" (tramp-compat-file-name-concat tmp-name "fuzz")))) ;; Ange-FTP does not support predicates. (unless (tramp--test-ange-ftp-p) (should @@ -7387,10 +7389,12 @@ tramp-test45-asynchronous-requests "Check parallel asynchronous requests. Such requests could arrive from timers, process filters and process sentinels. They shall not disturb each other." - :tags (append '(:expensive-test :tramp-asynchronous-processes) - (and (or (getenv "EMACS_HYDRA_CI") - (getenv "EMACS_EMBA_CI")) - '(:unstable))) + ;; :tags (append '(:expensive-test :tramp-asynchronous-processes) + ;; (and (or (getenv "EMACS_HYDRA_CI") + ;; (getenv "EMACS_EMBA_CI")) + ;; '(:unstable))) + ;; It doesn't work sufficiently. + :tags '(:expensive-test :tramp-asynchronous-processes :unstable) (skip-unless (tramp--test-enabled)) (skip-unless (tramp--test-supports-processes-p)) (skip-unless (not (tramp--test-container-p))) commit 54ef338ba3670415cf47fabc33a92d4904707c7e Author: Michael Albinus Date: Tue Mar 14 11:38:39 2023 +0100 Improve Tramp processes to accept output over the same socket * lisp/net/tramp.el (tramp-accept-process-output): Don't use TIMEOUT anymore, default it to 0. When the connection uses a shared socket possibly, accept also the output from other processes over the same connection. (Bug#61350) (tramp-handle-file-notify-rm-watch, tramp-action-process-alive) (tramp-action-out-of-band, tramp-process-one-action) (tramp-interrupt-process): * lisp/net/tramp-adb.el (tramp-adb-handle-make-process): * lisp/net/tramp-gvfs.el (tramp-gvfs-handle-file-notify-add-watch): * lisp/net/tramp-sh.el (tramp-sh-handle-file-notify-add-watch): * lisp/net/tramp-smb.el (tramp-smb-action-get-acl) (tramp-smb-action-set-acl, tramp-smb-wait-for-output): * lisp/net/tramp-sudoedit.el (tramp-sudoedit-action-sudo): Adapt callees. * lisp/net/tramp.el (tramp-handle-make-process): * lisp/net/tramp-sh.el (tramp-do-copy-or-rename-file-out-of-band) (tramp-sh-handle-file-notify-add-watch) (tramp-maybe-open-connection): Set `shared-socket' property. diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el index 64f45e7958d..d338201ab72 100644 --- a/lisp/net/tramp-adb.el +++ b/lisp/net/tramp-adb.el @@ -990,7 +990,7 @@ tramp-adb-handle-make-process (progn (goto-char (point-min)) (not (search-forward "\n" nil t))) - (tramp-accept-process-output p 0)) + (tramp-accept-process-output p)) (delete-region (point-min) (point))) ;; Provide error buffer. This shows only ;; initial error messages; messages diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el index 266724c587f..c1ad37de1d2 100644 --- a/lisp/net/tramp-gvfs.el +++ b/lisp/net/tramp-gvfs.el @@ -1469,7 +1469,7 @@ tramp-gvfs-handle-file-notify-add-watch (set-process-sentinel p #'tramp-file-notify-process-sentinel) ;; There might be an error if the monitor is not supported. ;; Give the filter a chance to read the output. - (while (tramp-accept-process-output p 0)) + (while (tramp-accept-process-output p)) (unless (process-live-p p) (tramp-error p 'file-notify-error "Monitoring not supported for `%s'" file-name)) diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index a854ff42b0d..5227897fbec 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -2424,6 +2424,10 @@ tramp-do-copy-or-rename-file-out-of-band copy-program copy-args))) (tramp-message v 6 "%s" (string-join (process-command p) " ")) (process-put p 'vector v) + ;; This is neded for ssh or PuTTY based processes, and + ;; only if the respective options are set. Perhaps, + ;; the setting could be more fine-grained. + (process-put p 'shared-socket t) (process-put p 'adjust-window-size-function #'ignore) (set-process-query-on-exit-flag p nil) @@ -3753,6 +3757,10 @@ tramp-sh-handle-file-notify-add-watch (string-join sequence " ")) (tramp-message v 6 "Run `%s', %S" (string-join sequence " ") p) (process-put p 'vector v) + ;; This is neded for ssh or PuTTY based processes, and only if + ;; the respective options are set. Perhaps, the setting could + ;; be more fine-grained. + (process-put p 'shared-socket t) ;; Needed for process filter. (process-put p 'events events) (process-put p 'watch-name localname) @@ -3761,7 +3769,7 @@ tramp-sh-handle-file-notify-add-watch (set-process-sentinel p #'tramp-file-notify-process-sentinel) ;; There might be an error if the monitor is not supported. ;; Give the filter a chance to read the output. - (while (tramp-accept-process-output p 0)) + (while (tramp-accept-process-output p)) (unless (process-live-p p) (tramp-error p 'file-notify-error "Monitoring not supported for `%s'" file-name)) @@ -5116,6 +5124,10 @@ tramp-maybe-open-connection ;; Set sentinel and query flag. Initialize variables. (set-process-sentinel p #'tramp-process-sentinel) (process-put p 'vector vec) + ;; This is neded for ssh or PuTTY based processes, and + ;; only if the respective options are set. Perhaps, + ;; the setting could be more fine-grained. + (process-put p 'shared-socket t) (process-put p 'adjust-window-size-function #'ignore) (set-process-query-on-exit-flag p nil) (setq tramp-current-connection (cons vec (current-time))) diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el index 1aa4520eeb6..bb4ab9e3057 100644 --- a/lisp/net/tramp-smb.el +++ b/lisp/net/tramp-smb.el @@ -757,7 +757,7 @@ tramp-smb-action-get-acl "Read ACL data from connection buffer." (unless (process-live-p proc) ;; Accept pending output. - (while (tramp-accept-process-output proc 0)) + (while (tramp-accept-process-output proc)) (with-current-buffer (tramp-get-connection-buffer vec) ;; There might be a hidden password prompt. (widen) @@ -1363,7 +1363,7 @@ tramp-smb-action-set-acl "Set ACL data." (unless (process-live-p proc) ;; Accept pending output. - (while (tramp-accept-process-output proc 0)) + (while (tramp-accept-process-output proc)) (tramp-message vec 10 "\n%s" (tramp-get-buffer-string (tramp-get-connection-buffer vec))) (throw 'tramp-action 'ok))) @@ -2023,7 +2023,7 @@ tramp-smb-wait-for-output ;; Read pending output. (while (not (re-search-forward tramp-smb-prompt nil t)) - (while (tramp-accept-process-output p 0)) + (while (tramp-accept-process-output p)) (goto-char (point-min))) (tramp-message vec 6 "\n%s" (buffer-string)) diff --git a/lisp/net/tramp-sudoedit.el b/lisp/net/tramp-sudoedit.el index abb9afc570b..3cacde2468c 100644 --- a/lisp/net/tramp-sudoedit.el +++ b/lisp/net/tramp-sudoedit.el @@ -692,7 +692,7 @@ tramp-sudoedit-action-sudo "Check, whether a sudo process has finished. Remove unneeded output." ;; There might be pending output for the exit status. (unless (process-live-p proc) - (while (tramp-accept-process-output proc 0)) + (while (tramp-accept-process-output proc)) ;; Delete narrowed region, it would be in the way reading a Lisp form. (goto-char (point-min)) (widen) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 47173b95bea..b6e985db6b1 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -5087,6 +5087,11 @@ tramp-handle-make-process ;; t. See Bug#51177. (when filter (set-process-filter p filter)) + (process-put p 'vector v) + ;; This is neded for ssh or PuTTY based processes, and + ;; only if the respective options are set. Perhaps, the + ;; setting could be more fine-grained. + (process-put p 'shared-socket t) (process-put p 'remote-command orig-command) (tramp-set-connection-property p "remote-command" orig-command) @@ -5489,7 +5494,7 @@ tramp-handle-file-notify-rm-watch ;; There might be pending output. Avoid problems with reentrant ;; call of Tramp. (ignore-errors - (while (tramp-accept-process-output proc 0))) + (while (tramp-accept-process-output proc))) (tramp-message proc 6 "Kill %S" proc) (delete-process proc)) @@ -5641,13 +5646,13 @@ tramp-action-process-alive "Check, whether a process has finished." (unless (process-live-p proc) ;; There might be pending output. - (while (tramp-accept-process-output proc 0)) + (while (tramp-accept-process-output proc)) (throw 'tramp-action 'process-died))) (defun tramp-action-out-of-band (proc vec) "Check, whether an out-of-band copy has finished." ;; There might be pending output for the exit status. - (while (tramp-accept-process-output proc 0)) + (while (tramp-accept-process-output proc)) (cond ((and (not (process-live-p proc)) (zerop (process-exit-status proc))) (tramp-message vec 3 "Process has finished.") @@ -5678,7 +5683,7 @@ tramp-process-one-action (while (not found) ;; Reread output once all actions have been performed. ;; Obviously, the output was not complete. - (while (tramp-accept-process-output proc 0)) + (while (tramp-accept-process-output proc)) (setq todo actions) (while todo (setq item (pop todo) @@ -5795,11 +5800,21 @@ with-tramp-locked-connection ,@body) (tramp-flush-connection-property ,proc "locked")))) -(defun tramp-accept-process-output (proc &optional timeout) +(defun tramp-accept-process-output (proc &optional _timeout) "Like `accept-process-output' for Tramp processes. This is needed in order to hide `last-coding-system-used', which is set for process communication also. If the user quits via `C-g', it is propagated up to `tramp-file-name-handler'." + (declare (advertised-calling-convention (proc) "29.2")) + ;; There could be other processes which use the same socket for + ;; communication. This could block the output for the current + ;; process. Read such output first. (Bug#61350) + (when-let (((process-get proc 'shared-socket)) + (v (process-get proc 'vector))) + (dolist (p (delq proc (process-list))) + (when (tramp-file-name-equal-p v (process-get p 'vector)) + (accept-process-output p 0 nil t)))) + (with-current-buffer (process-buffer proc) (let ((inhibit-read-only t) last-coding-system-used @@ -5809,10 +5824,10 @@ tramp-accept-process-output ;; JUST-THIS-ONE is set due to Bug#12145. `with-local-quit' ;; returns t in order to report success. (if (with-local-quit - (setq result (accept-process-output proc timeout nil t)) t) + (setq result (accept-process-output proc 0 nil t)) t) (tramp-message - proc 10 "%s %s %s %s\n%s" - proc timeout (process-status proc) result (buffer-string)) + proc 10 "%s %s %s\n%s" + proc (process-status proc) result (buffer-string)) ;; Propagate quit. (keyboard-quit))) result))) @@ -6825,7 +6840,7 @@ tramp-interrupt-process (tramp-get-remote-null-device (process-get proc 'vector)))) ;; Wait, until the process has disappeared. If it doesn't, ;; fall back to the default implementation. - (while (tramp-accept-process-output proc 0)) + (while (tramp-accept-process-output proc)) (not (process-live-p proc)))))) (add-hook 'interrupt-process-functions #'tramp-interrupt-process) commit b9a70865d2c390ce02e12994c7d65a6cf555cd57 Author: Robert Pluim Date: Mon Mar 13 09:25:26 2023 +0100 * lisp/server.el (server-eval-at): Improve docstring diff --git a/lisp/server.el b/lisp/server.el index 89aedc72d52..608e5df3a5b 100644 --- a/lisp/server.el +++ b/lisp/server.el @@ -1941,10 +1941,10 @@ server-eval-at This function signals `error' if it could not contact the server. -This function signals `server-return-invalid-read-syntax' if it -couldn't read the result of evaluation printed by the server. -This will occur whenever the result of evaluating FORM is something -not readably printable." +This function signals `server-return-invalid-read-syntax' if +`read' fails on the result returned by the server. +This will occur whenever the result of evaluating FORM is +something that cannot be printed readably." (let* ((server-dir (if server-use-tcp server-auth-dir server-socket-dir)) (server-file (expand-file-name server server-dir)) (coding-system-for-read 'binary) commit 4b6f2a7028b91128934a19f83572f24106782225 Author: Juri Linkov Date: Mon Mar 13 20:21:47 2023 +0200 * lisp/progmodes/xref.el: Bump the version. diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index 1493856cfdd..d4e34f7e55a 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -1,7 +1,7 @@ ;;; xref.el --- Cross-referencing commands -*-lexical-binding:t-*- ;; Copyright (C) 2014-2023 Free Software Foundation, Inc. -;; Version: 1.6.2 +;; Version: 1.6.3 ;; Package-Requires: ((emacs "26.1")) ;; This is a GNU ELPA :core package. Avoid functionality that is not commit 24c8b146bbce1bbaa032fbc75ab40e5d924b3fc3 Author: Juri Linkov Date: Mon Mar 13 19:38:28 2023 +0200 * lisp/progmodes/xref.el (xref--xref-buffer-mode): Split up 'setq-local'. xref.el needs to support 26.1, but an arbitrary number of variables in 'setq-local' was added in Emacs 27.1 (bug#62162). diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index 38c424402a0..1493856cfdd 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -981,7 +981,7 @@ xref--xref-buffer-mode-map map)) (declare-function outline-search-text-property "outline" - (property &optional value bound move backward looking-at)) + (property &optional value bound move backward looking-at)) (define-derived-mode xref--xref-buffer-mode special-mode "XREF" "Mode for displaying cross-references." @@ -993,14 +993,14 @@ xref--xref-buffer-mode (setq imenu-extract-index-name-function #'xref--imenu-extract-index-name) (setq-local add-log-current-defun-function - #'xref--add-log-current-defun) - (setq-local outline-minor-mode-cycle t - outline-minor-mode-use-buttons 'insert - outline-search-function + #'xref--add-log-current-defun) + (setq-local outline-minor-mode-cycle t) + (setq-local outline-minor-mode-use-buttons 'insert) + (setq-local outline-search-function (lambda (&optional bound move backward looking-at) (outline-search-text-property - 'xref-group nil bound move backward looking-at)) - outline-level (lambda () 1))) + 'xref-group nil bound move backward looking-at))) + (setq-local outline-level (lambda () 1))) (defvar xref--transient-buffer-mode-map (let ((map (make-sparse-keymap))) commit 46f9e53c3da53db662bf6ab94c02e50754eeae0a Author: Filipp Gunbin Date: Mon Mar 13 19:27:13 2023 +0300 Fix import of keys in buffer created by epa-search-keys * lisp/epa-ks.el (epa-ks--query-url): Add operation parameter. (epa-ks--fetch-key, epa-search-keys): Use it. diff --git a/lisp/epa-ks.el b/lisp/epa-ks.el index 77d896fa438..015bf910ac6 100644 --- a/lisp/epa-ks.el +++ b/lisp/epa-ks.el @@ -140,8 +140,8 @@ epa-ks-do-key-to-fetch (epa-ks--fetch-key id))))) (tabulated-list-clear-all-tags)) -(defun epa-ks--query-url (query exact) - "Return URL for QUERY. +(defun epa-ks--query-url (query exact &optional operation) + "Return URL for QUERY and OPERATION (defaults to \"index\"). If EXACT is non-nil, don't accept approximate matches." (format "https://%s/pks/lookup?%s" (cond ((null epa-keyserver) @@ -154,13 +154,13 @@ epa-ks--query-url (url-build-query-string (append `(("search" ,query) ("options" "mr") - ("op" "index")) + ("op" ,(or operation "index"))) (and exact '(("exact" "on"))))))) (defun epa-ks--fetch-key (id) "Send request to import key with specified ID." (url-retrieve - (epa-ks--query-url (concat "0x" (url-hexify-string id)) t) + (epa-ks--query-url (concat "0x" (url-hexify-string id)) t "get") (lambda (status) (when (plist-get status :error) (error "Request failed: %s" @@ -236,7 +236,7 @@ epa-search-keys (erase-buffer)) (epa-ks-search-mode)) (url-retrieve - (epa-ks--query-url query exact) + (epa-ks--query-url query exact "index") (lambda (status) (when (plist-get status :error) (when buf commit 36ade0704e1829fd27970e8d478cf4b52deed517 Author: Michael Albinus Date: Mon Mar 13 18:02:36 2023 +0100 Fix connection-local variables settings ; * etc/NEWS: Fix typos. * lisp/files-x.el (connection-local-set-profiles) (connection-local-set-profile-variables): Use NOW when calling `custom-set-variables'. * test/lisp/files-x-tests.el (files-x-test-connection-local-set-profile-variables) (files-x-test-connection-local-update-profile-variables) (files-x-test-connection-local-set-profiles) (files-x-test-hack-connection-local-variables-apply) (files-x-test-with-connection-local-variables) (files-x-test-setq-connection-local): Fix tests. * test/lisp/net/tramp-tests.el (tramp-test34-connection-local-variables) (tramp-test34-explicit-shell-file-name): Fix tests. diff --git a/etc/NEWS b/etc/NEWS index 4774671a46d..a5f9f8c6ec1 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -3215,7 +3215,7 @@ Emacs now comes with the Eglot package, which enhances various Emacs features, such as completion, documentation, error detection, etc., based on data provided by language servers using the Language Server Protocol (LSP). See the new Info manual "(eglot) Top" for more. Also -see etc/EGLOT-NEWS. +see "etc/EGLOT-NEWS". +++ ** use-package: Declarative package configuration. @@ -4889,7 +4889,7 @@ two buttons: "Yes" and "No". +++ *** The 'ns-popup-font-panel' command has been removed. -Use the general command "M-x menu-set-font" instead. +Use the general command 'M-x menu-set-font' instead. ---------------------------------------------------------------------- diff --git a/lisp/files-x.el b/lisp/files-x.el index be27aedf2e2..548d9efc193 100644 --- a/lisp/files-x.el +++ b/lisp/files-x.el @@ -682,7 +682,7 @@ connection-local-set-profiles (cons (cons criteria (delete-dups profiles)) connection-local-criteria-alist)))) (custom-set-variables - `(connection-local-criteria-alist ',connection-local-criteria-alist))) + `(connection-local-criteria-alist ',connection-local-criteria-alist now))) (defsubst connection-local-get-profile-variables (profile) "Return the connection-local variable list for PROFILE." @@ -703,7 +703,7 @@ connection-local-set-profile-variables in order." (setf (alist-get profile connection-local-profile-alist) variables) (custom-set-variables - `(connection-local-profile-alist ',connection-local-profile-alist))) + `(connection-local-profile-alist ',connection-local-profile-alist now))) ;;;###autoload (defun connection-local-update-profile-variables (profile variables) diff --git a/test/lisp/files-x-tests.el b/test/lisp/files-x-tests.el index f79118fd564..4e14ae68fb8 100644 --- a/test/lisp/files-x-tests.el +++ b/test/lisp/files-x-tests.el @@ -66,7 +66,9 @@ files-x-test-connection-local-set-profile-variables "Test setting connection-local profile variables." ;; Declare (PROFILE VARIABLES) objects. - (let (connection-local-profile-alist connection-local-criteria-alist) + (let ((clpa connection-local-profile-alist) + (clca connection-local-criteria-alist) + connection-local-profile-alist connection-local-criteria-alist) (connection-local-set-profile-variables 'remote-bash files-x-test--variables1) (should @@ -94,13 +96,20 @@ files-x-test-connection-local-set-profile-variables (should (equal (connection-local-get-profile-variables 'remote-nullfile) - files-x-test--variables4)))) + files-x-test--variables4)) + + ;; Cleanup. + (custom-set-variables + `(connection-local-profile-alist ',clpa now) + `(connection-local-criteria-alist ',clca now)))) (ert-deftest files-x-test-connection-local-update-profile-variables () "Test updating connection-local profile variables." ;; Declare (PROFILE VARIABLES) objects. - (let (connection-local-profile-alist connection-local-criteria-alist) + (let ((clpa connection-local-profile-alist) + (clca connection-local-criteria-alist) + connection-local-profile-alist connection-local-criteria-alist) (connection-local-set-profile-variables 'remote-bash (copy-alist files-x-test--variables1)) (should @@ -116,13 +125,20 @@ files-x-test-connection-local-update-profile-variables (equal (connection-local-get-profile-variables 'remote-bash) (cons (car files-x-test--variables2) - (cdr files-x-test--variables1)))))) + (cdr files-x-test--variables1)))) + + ;; Cleanup. + (custom-set-variables + `(connection-local-profile-alist ',clpa now) + `(connection-local-criteria-alist ',clca now)))) (ert-deftest files-x-test-connection-local-set-profiles () "Test setting connection-local profiles." ;; Declare (CRITERIA PROFILES) objects. - (let (connection-local-profile-alist connection-local-criteria-alist) + (let ((clpa connection-local-profile-alist) + (clca connection-local-criteria-alist) + connection-local-profile-alist connection-local-criteria-alist) (connection-local-set-profile-variables 'remote-bash files-x-test--variables1) (connection-local-set-profile-variables @@ -205,12 +221,19 @@ files-x-test-connection-local-set-profiles '(remote-bash remote-ksh remote-nullfile))) ;; A criteria other than plist is wrong. - (should-error (connection-local-set-profiles 'dummy)))) + (should-error (connection-local-set-profiles 'dummy)) + + ;; Cleanup. + (custom-set-variables + `(connection-local-profile-alist ',clpa now) + `(connection-local-criteria-alist ',clca now)))) (ert-deftest files-x-test-hack-connection-local-variables-apply () "Test setting connection-local variables." - (let (connection-local-profile-alist connection-local-criteria-alist) + (let ((clpa connection-local-profile-alist) + (clca connection-local-criteria-alist) + connection-local-profile-alist connection-local-criteria-alist) (connection-local-set-profile-variables 'remote-bash files-x-test--variables1) @@ -302,13 +325,18 @@ files-x-test-hack-connection-local-variables-apply (hack-connection-local-variables-apply nil) (should-not connection-local-variables-alist) (should-not (local-variable-p 'remote-shell-file-name)) - (should-not (boundp 'remote-shell-file-name)))))) + (should-not (boundp 'remote-shell-file-name)))) + + ;; Cleanup. + (custom-set-variables + `(connection-local-profile-alist ',clpa now) + `(connection-local-criteria-alist ',clca now)))) (ert-deftest files-x-test-with-connection-local-variables () "Test setting connection-local variables." - (let ((connection-local-profile-alist connection-local-profile-alist) - (connection-local-criteria-alist connection-local-criteria-alist)) + (let ((clpa connection-local-profile-alist) + (clca connection-local-criteria-alist)) (connection-local-set-profile-variables 'remote-bash files-x-test--variables1) (connection-local-set-profile-variables @@ -385,7 +413,12 @@ files-x-test-with-connection-local-variables (should-not (local-variable-p 'remote-null-device)) ;; The variable values are reset. (should-not (boundp 'remote-shell-file-name)) - (should (string-equal (symbol-value 'remote-null-device) "null")))))) + (should (string-equal (symbol-value 'remote-null-device) "null")))) + + ;; Cleanup. + (custom-set-variables + `(connection-local-profile-alist ',clpa now) + `(connection-local-criteria-alist ',clca now)))) (defun files-x-test--get-lazy-var () "Get the connection-local value of `remote-lazy-var'. @@ -405,7 +438,9 @@ files-x-test--set-lazy-var (ert-deftest files-x-test-setq-connection-local () "Test dynamically setting connection local variables." - (let (connection-local-profile-alist connection-local-criteria-alist) + (let ((clpa connection-local-profile-alist) + (clca connection-local-criteria-alist) + connection-local-profile-alist connection-local-criteria-alist) (connection-local-set-profile-variables 'remote-lazy files-x-test--variables5) (connection-local-set-profiles @@ -440,7 +475,12 @@ files-x-test-setq-connection-local (should (equal (files-x-test--get-lazy-var) "there")) (with-connection-local-application-variables (cadr files-x-test--application) - (should (equal remote-null-device "null")))))) + (should (equal remote-null-device "null")))) + + ;; Cleanup. + (custom-set-variables + `(connection-local-profile-alist ',clpa now) + `(connection-local-criteria-alist ',clca now)))) (provide 'files-x-tests) ;;; files-x-tests.el ends here diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index ff0fc56043e..0a777617c1d 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el @@ -5819,6 +5819,8 @@ tramp-test34-connection-local-variables (enable-remote-dir-locals t) (inhibit-message t) kill-buffer-query-functions + (clpa connection-local-profile-alist) + (clca connection-local-criteria-alist) connection-local-profile-alist connection-local-criteria-alist) (unwind-protect (progn @@ -5867,6 +5869,9 @@ tramp-test34-connection-local-variables (kill-buffer (current-buffer)))) ;; Cleanup. + (custom-set-variables + `(connection-local-profile-alist ',clpa now) + `(connection-local-criteria-alist ',clca now)) (ignore-errors (delete-directory tmp-name1 'recursive))))) (ert-deftest tramp-test34-explicit-shell-file-name () @@ -5881,6 +5886,8 @@ tramp-test34-explicit-shell-file-name (let ((default-directory ert-remote-temporary-file-directory) explicit-shell-file-name kill-buffer-query-functions + (clpa connection-local-profile-alist) + (clca connection-local-criteria-alist) connection-local-profile-alist connection-local-criteria-alist) (unwind-protect (progn @@ -5915,6 +5922,9 @@ tramp-test34-explicit-shell-file-name ;; Cleanup. (put 'explicit-shell-file-name 'permanent-local nil) + (custom-set-variables + `(connection-local-profile-alist ',clpa now) + `(connection-local-criteria-alist ',clca now)) (kill-buffer "*shell*")))) ;; `exec-path' was introduced in Emacs 27.1. `executable-find' has commit e759905d2e0828eac4c8164b09113b40f6899656 Author: Eli Zaretskii Date: Mon Mar 13 14:48:08 2023 +0200 ; Minor copyedits in EGLOT-NEWS * etc/EGLOT-NEWS: Fix punctuation and quoting, add note about finding Issues. diff --git a/etc/EGLOT-NEWS b/etc/EGLOT-NEWS index 1d0dd84796b..dc77e4fe624 100644 --- a/etc/EGLOT-NEWS +++ b/etc/EGLOT-NEWS @@ -12,6 +12,11 @@ This file is about changes in Eglot, the Emacs client for LSP (Language Server Protocol) distributed with GNU Emacs since Emacs version 29.1 and with GNU ELPA since 2018. +Note: references to Eglot issues are presented as "github#nnnn". +This refers to https://github.com/joaotavora/eglot/issues/. +That is, to look up issue github#1234, go to +https://github.com/joaotavora/eglot/issues/1234. + * Changes in Eglot 1.12 (13/03/2023) @@ -23,16 +28,16 @@ names in function calls and a variable's automatically deduced type. Emacs can display these hints using overlays, helping the user remember those types and parameter names. -** Longstanding Tramp instability issues solved +** Longstanding Tramp instability issues solved. The solution involves a Tramp-specific workaround in Eglot. Future Tramp versions will have this problem solved at the origin. The workaround will then be removed. Emacs bug#61350 has more details. -(github#859, github#1020, github#883) +(github#859, github#1020, github#883) ** LSP's 'positionEncoding' capability is now supported. The position-encoding scheme (UTF-8, UTF-16 or UTF-32) can now -be negotiated with server. +be negotiated with the server. ** More of the user's Eldoc configuration is respected. This change addresses the problems reported in many Elglot reports @@ -45,7 +50,7 @@ set by Eglot during its tenure over a buffer. The default value for it cannot work reasonably with Eglot's additions to 'eldoc-documentation-functions'. -** Completion labels correctly displayed in servers like clangd. +** Completion labels are correctly displayed in servers like clangd. (github#1141) @@ -95,10 +100,11 @@ This is the last release before integration into Emacs's core. Probably not very useful for now. More keybindings and clickable shortcuts to connection-specific commands to be added later. -** Manual temporarily living in separate MANUAL.md file. +** Manual temporarily lives in separate MANUAL.md file. The manual has been rewritten mostly from scratch. It is structured -hierarchically and more complete. After the merge into Emacs, this -upcoming TexInfo manual uses this manual as a starting point. +hierarchically and is more complete. After the merge into Emacs, the +Eglot Texinfo manual bundled with Emacs used this temporary manual as +a starting point. ** Support for "single server, multiple modes". Previously, if an entry such as '((c++-mode c-mode) . ("clangd)")' was @@ -114,33 +120,33 @@ assumed that most, if not all, servers configured in Though Eglot's 'eglot-imenu' returned a fully compliant 'imenu' structure, that object was not understood by many other frontends other than 'M-x imenu' itself. Since the special functionality it -enabled wasn't being used anyway, decided to remove it to fix these -longstanding problems. +enabled wasn't being used anyway, it was decided to remove it to fix +these longstanding problems. (github#758, github#536, github#535) ** 'eglot-workspace-configuration' has been overhauled. This variable and its uses are now more thoroughly documented. It can -be a set to a function for dynamic calculation of the configuration. +be set to a function for dynamic calculation of the configuration. The preferred format is a plist, though the earlier alist format is still supported. (github#967, github#590, github#790) -** C-u M-. lists and completes arbitrary workspace symbols. +** 'C-u M-.' lists and completes arbitrary workspace symbols. A very old request, now made possible by a relatively recent change to the 'workspace/symbol' RPC method. (github#131) -** Rework mode-line menus. +** Reworked mode-line menus. New menus help discover Eglot's features and show which of them are supported by the current server. Menus can be customized away via 'eglot-menu-string', making space in mode-line. (github#792) -** Easier to use LSP initialize.initializationOptions. +** Easier to use LSP 'initialize.initializationOptions'. In 'eglot-server-programs' a plist may be appended to the usual list of strings passed as command line arguments. The value of its ':initializationOptions' key constructs the corresponding LSP JSON @@ -167,15 +173,15 @@ external roots of a simple git project.) Some LSP servers report diagnostics for all files in the current workspace. Flymake has (as of version 1.2.1) the option to show diagnostics from buffers other than the currently visited one. The -command 'M-x flymake-show-project-diagnostics' will now show all +command 'M-x flymake-show-project-diagnostics' will now show all the diagnostics relevant to a workspace. (github#810) ** Support LSP completion tags. -An LSP completion tag can be used to tell the editor how -to render a completion. Presently, one kind of tag exists, denoting -its corresponding completion as obsolete. +An LSP completion tag can be used to tell the editor how to render a +completion. Presently, one kind of tag exists, denoting its +corresponding completion as obsolete. (github#797) @@ -217,11 +223,11 @@ major mode within a project. ** TRAMP support added. There are no variables to customize: visit a remote file, ensure the -server also exists in the remote, and type M-x eglot. +server also exists in the remote, and type "M-x eglot". (github#637, github#463, github#84) -** 'eglot-ignored-server-capabilities' now correctly spelled. +** 'eglot-ignored-server-capabilities' is now correctly spelled. This user-visible variable used to be spelled 'eglot-ignored-server-capabilites', which is still a valid but obsolete name. @@ -240,9 +246,9 @@ specified interactively with 'C-u'. Other shortcuts call specific actions directly ('eglot-code-action-inline', 'eglot-code-action-extract', 'eglot-code-action-rewrite', 'eglot-code-action-organize-imports' and -'eglot-code-action-quickfix'). One can create own shortcuts for code -actions with specific a kind by calling 'eglot-code-actions' from -elisp. +'eglot-code-action-quickfix'). One can create one's own shortcuts for +code actions with specific a kind by calling 'eglot-code-actions' from +Lisp. (github#411) @@ -252,7 +258,7 @@ This disconnects all the Eglot connections in the user's session. (github#643) ** New variable 'eglot-withhold-process-id' added. -If non-nil, Eglot will not send the Emacs process id to the language +If non-nil, Eglot will not send the Emacs process ID to the language server. This can be useful when using docker to run a language server. @@ -296,8 +302,8 @@ The variables 'eglot-put-doc-in-help-buffer' and It seems the majority of servers now comply with the language server specification when it comes to handling non-ASCII texts. Therefore the default values of 'eglot-move-to-column-function' and -'eglot-current-column-function' have been changed. The documentations -of these variables help to restore the old behavior. +'eglot-current-column-function' have been changed. Consult the +documentation of these variables for how to restore the old behavior. (github#361) @@ -323,7 +329,7 @@ This disconnects the server after last managed buffer is killed. (github#217, github#270) ** Completion support support has been fixed. -Among other things, consider LSP's "filterText" cookies, which enables +Among other things, consider LSP's "filterText" cookies, which enable a kind of poor-man's flex-matching for some backends. (github#235, github#313, github#311, github#279) @@ -355,7 +361,7 @@ Also add two new customization variables ** Parameter highlighting in the first line of signature corrected. -** Markdown documentation strings are rendered with faces +** Markdown documentation strings are rendered with faces. Eglot uses 'gfm-view-mode' for this. ** Hard dependencies on Flymake have been removed. @@ -371,6 +377,7 @@ directory-set 'eglot-workspace-configuration'. ** Completion sorting has been fixed. If the server returns completions in some sensible order, Eglot will keep it. + (github#190) ** Flymake and Eldoc taken over completely while managing buffers. @@ -390,7 +397,7 @@ these two domains. ** Support 'completionContext' to help servers like 'ccls'. -** Use Flymake from GNU ELPA +** Use Flymake from GNU ELPA. (github#178) @@ -411,11 +418,10 @@ Eglot uses 'yasnippet.el' for this, if it is installed. (github#39) ** Accept functions as entries in 'eglot-server-programs'. - 'CONTACT' in the '(MAJOR-MODE . CONTACT)' association in 'eglot-server-programs' can now be a function of no arguments -producing any value previously valid for contact. Functions can be -interactive on non-interactive. +producing any value previously valid for a contact. Functions can be +interactive or non-interactive. (github#63) @@ -455,7 +461,6 @@ feature. ** Add out-of-the-box support for Haskell, Kotlin, Go, Ocaml, R. ** Add the ability to move to LSP-precise columns. - Some servers like 'clangd' follow the UTF-16-based spec very closely here. @@ -473,10 +478,9 @@ here. github#138, github#144, github#158, github#160, github#167) -* Changes in Eglot 1.1 (9/7/2018) - -** Implement TCP autostart/autoconnect (and support Ruby's Solargraph) +* Changes in Eglot 1.1 (9/7/2018) +** Implement TCP autostart/autoconnect (and support Ruby's Solargraph). The ':autoport' symbol in the server incovation is replaced dynamically by a local port believed to be vacant, so that the ensuing TCP connection finds a listening server. commit ba22a2c346b4a8cc992333037f6a30303a928a56 Author: João Távora Date: Fri Mar 10 11:30:58 2023 +0000 Bump Eglot version to 1.12 * etc/EGLOT-NEWS: New file. * etc/NEWS: Briefly mention etc/EGLOT-NEWS. * lisp/progmodes/eglot.el: Bump versions. diff --git a/etc/EGLOT-NEWS b/etc/EGLOT-NEWS new file mode 100644 index 00000000000..1d0dd84796b --- /dev/null +++ b/etc/EGLOT-NEWS @@ -0,0 +1,509 @@ +Eglot NEWS -*- outline -*- + +Copyright (C) 2018-2023 Free Software Foundation, Inc. +See the end of the file for license conditions. + +Please send Eglot bug reports to 'bug-gnu-emacs@gnu.org', and Cc (or +X-Debbugs-CC) the maintainer 'joaotavora@gmail.com' as well. Please +read the chapter titled "Troubleshooting" in the Eglot manual, +available https://joaotavora.github.io/eglot/#Troubleshooting-Eglot + +This file is about changes in Eglot, the Emacs client for LSP +(Language Server Protocol) distributed with GNU Emacs since Emacs +version 29.1 and with GNU ELPA since 2018. + + +* Changes in Eglot 1.12 (13/03/2023) + +** LSP inlay hints are now supported. +Inlay hints are small text annotations not unlike diagnostics, but +designed to help readability instead of indicating problems. For +example, a C++ LSP server can serve hints about positional parameter +names in function calls and a variable's automatically deduced type. +Emacs can display these hints using overlays, helping the user +remember those types and parameter names. + +** Longstanding Tramp instability issues solved +The solution involves a Tramp-specific workaround in Eglot. Future +Tramp versions will have this problem solved at the origin. The +workaround will then be removed. Emacs bug#61350 has more details. + +(github#859, github#1020, github#883) + +** LSP's 'positionEncoding' capability is now supported. +The position-encoding scheme (UTF-8, UTF-16 or UTF-32) can now +be negotiated with server. + +** More of the user's Eldoc configuration is respected. +This change addresses the problems reported in many Elglot reports +dating back to early 2021 at least. + +(github#646, github#894, github#920, github#1031, github#1171). + +This is unfinished work, as 'eldoc-documentation-strategy' is still +set by Eglot during its tenure over a buffer. The default value for +it cannot work reasonably with Eglot's additions to +'eldoc-documentation-functions'. + +** Completion labels correctly displayed in servers like clangd. + +(github#1141) + +** Assorted bugfixes. + +(bug#61312, bug#61478, bug#61532, bug#61726, bug#61866, bug#61748) + + +* Changes in Eglot 1.11 (27/1/2023) + +** New server vscode-json-languageserver added to 'eglot-server-programs'. + +(bug#60198) + +** Assorted bugfixes. + +(bug#60379, bug#60557, (bug#61048) + + +* Changes in Eglot 1.10 (16/12/2022) + +** Emacs progress reporters are used for LSP progress notifications. +(bug#59149) + +** LSP reported URIs other than file:// are passed on to Emacs. +This change allows other URI handlers, such as a 'jar:' handling +package, to cooperate with Eglot and find files inside compressed file +systems (bug#58790). + +** Eglot now shows in the menu bar. + +** Tree-sitter modes added to 'eglot-server-programs'. +These modes are usually handled by the same server that handles the +"classical mode". + +** New servers chsharp-ls and texlab added to 'eglot-server-programs'. + +** Assorted bugfixes. +(bug#59824, bug#59338) + + +* Changes in Eglot 1.9 (8/10/2022) + +This is the last release before integration into Emacs's core. + +** New 'M-x eglot-list-connections' command. +Probably not very useful for now. More keybindings and clickable +shortcuts to connection-specific commands to be added later. + +** Manual temporarily living in separate MANUAL.md file. +The manual has been rewritten mostly from scratch. It is structured +hierarchically and more complete. After the merge into Emacs, this +upcoming TexInfo manual uses this manual as a starting point. + +** Support for "single server, multiple modes". +Previously, if an entry such as '((c++-mode c-mode) . ("clangd)")' was +found in 'eglot-server-programs', it meant that '.cpp' files '.c' +files would lead to two 'clangd' instances for managing them, even if +these files were in the same project. Now only one is created. It is +assumed that most, if not all, servers configured in +'eglot-server-programs' handle this correctly. + +(github#681) + +** 'eglot-imenu' no longer uses problematic "special elements". +Though Eglot's 'eglot-imenu' returned a fully compliant 'imenu' +structure, that object was not understood by many other frontends +other than 'M-x imenu' itself. Since the special functionality it +enabled wasn't being used anyway, decided to remove it to fix these +longstanding problems. + +(github#758, github#536, github#535) + +** 'eglot-workspace-configuration' has been overhauled. +This variable and its uses are now more thoroughly documented. It can +be a set to a function for dynamic calculation of the configuration. +The preferred format is a plist, though the earlier alist format is +still supported. + +(github#967, github#590, github#790) + +** C-u M-. lists and completes arbitrary workspace symbols. +A very old request, now made possible by a relatively recent change to +the 'workspace/symbol' RPC method. + +(github#131) + +** Rework mode-line menus. +New menus help discover Eglot's features and show which of them are +supported by the current server. Menus can be customized away via +'eglot-menu-string', making space in mode-line. + +(github#792) + +** Easier to use LSP initialize.initializationOptions. +In 'eglot-server-programs' a plist may be appended to the usual list +of strings passed as command line arguments. The value of its +':initializationOptions' key constructs the corresponding LSP JSON +object. This may be easier than creating a 'defclass' for a specific +server and specializing 'eglot-initialization-options' to that class. + +(github#901, github#845, github#940) + +** LSP on-type formatting is now supported. +This is the 'documentOnTypeFormattingProvider' LSP capability, which +may be disabled via 'eglot-ignored-server-capabilities' + +(github#899) + +** Basic LSP "workspace folders" support added. +Eglot now advertises 'project-root' and 'project-external-roots' as +workspace-folders. (Configuring 'project-vc-external-roots-function' +via Elisp or 'tags-table-list' via Custtomize are two ways to set the +external roots of a simple git project.) + +(github#893) + +** Eglot can now show project wide diagnosics via Flymake. +Some LSP servers report diagnostics for all files in the current +workspace. Flymake has (as of version 1.2.1) the option to show +diagnostics from buffers other than the currently visited one. The +command 'M-x flymake-show-project-diagnostics' will now show all +diagnostics relevant to a workspace. + +(github#810) + +** Support LSP completion tags. +An LSP completion tag can be used to tell the editor how +to render a completion. Presently, one kind of tag exists, denoting +its corresponding completion as obsolete. + +(github#797) + +** Support LSP optional diagnostic tags. +A diagnostic tag can indicate either "unused or unnecessary code" or +"deprecated or obsolete code". Following the rendering suggestions in +the protocol, we fade out unnecessary code and strike-through +deprecated code. + +(github#794) + +** The Rust language server is now rust-analyzer by default. +Eglot will now prefer starting "rust-analyzer" to "rls" when it is +available. The special support code for RLS has been removed. + +(github#803) + +** New servers have been added to 'eglot-server-programs'. +- clojure-lsp (github#813) +- racket-langserver (github#694) +- futhark lsp (github#922) +- purescript-language-server (github#905) +- Perl::LanguageServer (github#952) +- marksman (github#1013) +- jedi-language-server ([#994](github#994)) + + +* Changes in Eglot 1.8 (12/1/2022) + +** Alternate servers supported out-of-box for the same major mode. +In practice, this removes the need for Eglot to "officially" bless one +server over another. + +Do not confuse this feature with another missing feature which +consists of supporting multiple servers simultaneously managing a +major mode within a project. + +(github#688) + +** TRAMP support added. +There are no variables to customize: visit a remote file, ensure the +server also exists in the remote, and type M-x eglot. + +(github#637, github#463, github#84) + +** 'eglot-ignored-server-capabilities' now correctly spelled. +This user-visible variable used to be spelled +'eglot-ignored-server-capabilites', which is still a valid but +obsolete name. + +(github#724) + +** Eglot can manage cross-referenced files outside project. +This is activated by a new customization option +'eglot-extend-to-xref', which defaults to nil. + +(github#76, github#686, github#695) + +** Code action shortcuts can be added by the user. +'M-x eglot-code-actions' accepts an optional 'action-kind' argument, +specified interactively with 'C-u'. Other shortcuts call specific +actions directly ('eglot-code-action-inline', +'eglot-code-action-extract', 'eglot-code-action-rewrite', +'eglot-code-action-organize-imports' and +'eglot-code-action-quickfix'). One can create own shortcuts for code +actions with specific a kind by calling 'eglot-code-actions' from +elisp. + +(github#411) + +** New command 'eglot-shutdown-all added. +This disconnects all the Eglot connections in the user's session. + +(github#643) + +** New variable 'eglot-withhold-process-id' added. +If non-nil, Eglot will not send the Emacs process id to the language +server. This can be useful when using docker to run a language +server. + +(github#722) + +** Several new servers have been added to 'eglot-server-programs'. +- cmake-language-server (github#787) +- css-languageserver (github#204, github#769) +- fortls (github#603) +- html-languageserver (github#204, github#769) +- json-languageserver (github#204, github#769) +- lua-lsp (github#721) +- mint ls (github#750) +- pyright (github#742) +- vim-language-server (github#787) +- yaml-language-server (github#751) +- zls (github#646) + + +* Changes in Eglot 1.7 (16/12/2020) + +** Hierarchical symbols are supported in Imenu. +(github#303). + +** Multiple "documentation at point" sources are supported. +Such sources include as LSP's signature, hover and also the Flymake +diagnostic messages. They can all be presented in the echo area +(space permitting), or via 'C-h .'. For now, composition of different +sources can be customized using 'eldoc-documentation-strategy', +'eldoc-echo-area-use-multiline-p' and 'eldoc-prefer-doc-buffer'. + +The variables 'eglot-put-doc-in-help-buffer' and +'eglot-auto-display-help-buffer' have been removed. + +(github#439, github#494, github#481, github#454) + + +* Changes in Eglot 1.6 (16/04/2020) + +** Column offset calculation is now LSP-conformant. +It seems the majority of servers now comply with the language server +specification when it comes to handling non-ASCII texts. Therefore +the default values of 'eglot-move-to-column-function' and +'eglot-current-column-function' have been changed. The documentations +of these variables help to restore the old behavior. + +(github#361) + +** LSP workspace/configuration requests are supported. +Also a new section "Per-project server configuration" in the README.md +should answer some FAQ's in this regard. + +(github#326) + + +* Changes in Eglot 1.5 (20/10/2019) + +** Eglot takes over Company configuration. +Similar to what was already the case with Flymake, Eldoc and Xref, use +just the backend that can do something useful in Eglot, +'company-capf'. See 'eglot-stay-out-of' to opt out of this. + +(github#324) + +** New option 'eglot-autoshutdown' added. +This disconnects the server after last managed buffer is killed. + +(github#217, github#270) + +** Completion support support has been fixed. +Among other things, consider LSP's "filterText" cookies, which enables +a kind of poor-man's flex-matching for some backends. + +(github#235, github#313, github#311, github#279) + +** Supports LSP's "goto declaration/implementation/typeDefinition". + +(github#302) + +** New option 'eglot-send-changes-idle-time' added. + +(github#258) + +** Eglot's Eldoc no longer flickers when moving around. + +(github#198) + +** Large docs shown in help buffer instead of echo area by default. +Also add two new customization variables +'eglot-put-doc-in-help-buffer' and 'eglot-auto-display-help-buffer'. + +(github#198) + +** Built-in support for Go, Elixir and Ada added. + +(github#304, github#264, github#316) + + +* Changes in Eglot 1.4 (5/1/2019) + +** Parameter highlighting in the first line of signature corrected. + +** Markdown documentation strings are rendered with faces +Eglot uses 'gfm-view-mode' for this. + +** Hard dependencies on Flymake have been removed. +The user can turn Flymake off now in buffers managed by Eglot. + +** Connection hooks are run with proper directory local variables. +This fixes issues with suspiciously empty 'didChangeConfiguration' +messages that are supposed to communicate parameters from a +directory-set 'eglot-workspace-configuration'. + +(github#196) + +** Completion sorting has been fixed. +If the server returns completions in some sensible order, Eglot will +keep it. +(github#190) + +** Flymake and Eldoc taken over completely while managing buffers. +No longer try to add Eglot's facilities to existing facilities in +these two domains. + + +* Changes in Eglot 1.3 (10/12/2018) + +** Provide strict checking of incoming LSP messagesp. + +(github#144, github#156) + +** Add brief context after 'xref-find-references' when available. + +(github#52) + +** Support 'completionContext' to help servers like 'ccls'. + +** Use Flymake from GNU ELPA + +(github#178) + + +* Changes in Eglot 1.2 (23/11/2018) + +** Support snippet completions. +Eglot uses 'yasnippet.el' for this, if it is installed. + +(github#50) + +** 'workspace/didChangeConfiguration' implemented. + +(github#29) + +** Handle experimental/unknown server methods gracefully. + +(github#39) + +** Accept functions as entries in 'eglot-server-programs'. + +'CONTACT' in the '(MAJOR-MODE . CONTACT)' association in +'eglot-server-programs' can now be a function of no arguments +producing any value previously valid for contact. Functions can be +interactive on non-interactive. + +(github#63) + +** Improve completion to be snappier and don't hinder typing. + +(github#61) + +** Consider ':triggerCharacters' in company completion. + +(github#80) + +** Add support for LSP 'TextEdit' objects in completion. + +** Prefer ccls over cquery for C/C++ + +(github#94) + +** 'eglot-ignored-server-capabilites' is more user-friendly. + +(github#126) + +** Supports asynchronous connections. +If a connection to the server is taking too long, is will continue in +the background. A new defcustom 'eglot-sync-connect' controls this +feature. + +(github#68) + +** The 'eglot-shutdown' command prompts for the server to shutdown. + +(github#73) + +** Add support for the Eclipse JDT language server. + +(github#63) + +** Add out-of-the-box support for Haskell, Kotlin, Go, Ocaml, R. + +** Add the ability to move to LSP-precise columns. + +Some servers like 'clangd' follow the UTF-16-based spec very closely +here. + +(github#124) + +** Fix a potential security issue fontifying LSP doc. + +(github#154) + +** Fix many, many bugs + +(github#44, github#48, github#54, github#58, github#64, github#74, + github#81, github#82, github#86, github#87, github#83, github#93, + github#100, github#115, github#120, github#121, github#126, + github#138, github#144, github#158, github#160, github#167) + + +* Changes in Eglot 1.1 (9/7/2018) + +** Implement TCP autostart/autoconnect (and support Ruby's Solargraph) + +The ':autoport' symbol in the server incovation is replaced +dynamically by a local port believed to be vacant, so that the ensuing +TCP connection finds a listening server. + +** Eglot now depends on Emacs library 'jsonrpc.el'. + + +---------------------------------------------------------------------- +This file is part of GNU Emacs. + +GNU Emacs is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +GNU Emacs is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Emacs. If not, see . + + +Local Variables: +bug-reference-bug-regexp: "\\(\\(github\\|bug\\)#\\([0-9]+\\)\\)" +bug-reference-url-format: eglot--debbugs-or-github-bug-uri +paragraph-separate: "[ ]" +End: + diff --git a/etc/NEWS b/etc/NEWS index fa59b8ed713..4774671a46d 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -3214,7 +3214,8 @@ Imenu now lists the members directly nested in R6RS Scheme libraries Emacs now comes with the Eglot package, which enhances various Emacs features, such as completion, documentation, error detection, etc., based on data provided by language servers using the Language Server -Protocol (LSP). See the new Info manual "(eglot) Top" for more. +Protocol (LSP). See the new Info manual "(eglot) Top" for more. Also +see etc/EGLOT-NEWS. +++ ** use-package: Declarative package configuration. diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 18b44e502df..428f59a8c22 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -2,12 +2,12 @@ ;; Copyright (C) 2018-2023 Free Software Foundation, Inc. -;; Version: 1.11 +;; Version: 1.12 ;; Author: João Távora ;; Maintainer: João Távora ;; URL: https://github.com/joaotavora/eglot ;; Keywords: convenience, languages -;; Package-Requires: ((emacs "26.3") (jsonrpc "1.0.16") (flymake "1.2.1") (project "0.9.3") (xref "1.4.0") (eldoc "1.11.0") (seq "2.23") (external-completion "0.1")) +;; Package-Requires: ((emacs "26.3") (jsonrpc "1.0.16") (flymake "1.2.1") (project "0.9.8") (xref "1.6.2") (eldoc "1.11.0") (seq "2.23") (external-completion "0.1")) ;; This is a GNU ELPA :core package. Avoid adding functionality ;; that is not available in the version of Emacs recorded above or any commit 54e123a5055ab5a78a19a7a23ef329e954101754 Author: João Távora Date: Sun Mar 12 19:44:53 2023 +0000 Update Eglot's manual about eglot-workspace-configuration There is a possible use for a global setting eglot-workspace-configuration, which is to (ab)use it to set user-specific configuration when the server doesn't permit other methods. Rearrange the "Advanced server configuration" section and describe that use in the manual. * doc/misc/eglot.texi (Project-specific configuration): Correct mistake about global usefulness of eglot-workspace-configuration. (Advanced server configuration): Swap order of sections. (User-specific configuration): Mention possibility of globally setting eglot-workspace-configuration. diff --git a/doc/misc/eglot.texi b/doc/misc/eglot.texi index 99dc4ae1501..735da5f0163 100644 --- a/doc/misc/eglot.texi +++ b/doc/misc/eglot.texi @@ -989,24 +989,24 @@ Advanced server configuration @itemize @bullet @item -User-specific, applying to all projects the server is used for; +Project-specific, applying to a specific project; @item -Project-specific, applying to a specific project. +User-specific, applying to all projects the server is used for. @end itemize When you have decided which kind you need, the following sections teach how Eglot's user variables can be used to achieve it: @menu -* User-specific configuration:: * Project-specific configuration:: +* User-specific configuration:: * JSONRPC objects in Elisp:: @end menu It's important to note that not all servers allow both kinds of configuration, nor is it guaranteed that user options can be copied -over project options, and vice-versa. When in doubt, consult your +over to project options, and vice-versa. When in doubt, consult your language server's documentation. It's also worth noting that some language servers can read these @@ -1019,48 +1019,6 @@ Advanced server configuration use these mechanisms instead of Eglot's, as the latter have the advantage of working with other LSP clients. -@node User-specific configuration -@section User-specific configuration -@cindex initializationOptions -@cindex command-line arguments - -This kind of configuration applies to all projects the server is used -for. Here, there are again two main ways to do this inside Eglot. - -A common way is to pass command-line options to the server invocation -via @code{eglot-server-programs}. Let's say we want to configure -where the @command{clangd} server reads its -@code{compile_commands.json} from. This can be done like so: - -@lisp -(with-eval-after-load 'eglot - (add-to-list 'eglot-server-programs - `(c++-mode . ("clangd" "--compile-commands-dir=/tmp")))) - -@end lisp - -@noindent -Another way is to have Eglot pass a JSON object to the server during -the LSP handshake. This is done using the -@code{:initializationOptions} syntax of @code{eglot-server-programs}: - -@lisp -(with-eval-after-load 'eglot - (add-to-list 'eglot-server-programs - `(c++-mode . ("clangd" :initializationOptions - (:compilationDatabasePath "/tmp"))))) -@end lisp - -@noindent -The argument @code{(:compilationDatabasePath "/tmp")} is Emacs's -representation in plist format of a simple JSON object -@code{@{"compilationDatabasePath": "/tmp"@}}. To learn how to -represent more deeply nested options in this format, @xref{JSONRPC -objects in Elisp}. - -In this case, the two examples achieve exactly the same, but notice -how the option's name has changed between them. - @node Project-specific configuration @section Project-specific configuration @vindex eglot-workspace-configuration @@ -1074,7 +1032,7 @@ Project-specific configuration Variables, , Per-directory Local Variables, emacs, The GNU Emacs Manual}). It's important to recognize that this variable really only makes sense when set directory-locally. It usually does not make -sense to set it globally or in a major-mode hook. +sense to set it file-locally or in a major-mode hook. The most common way to set @code{eglot-workspace-configuration } is using a @file{.dir-locals.el} file in the root of your project. If @@ -1207,6 +1165,68 @@ Project-specific configuration function should return a plist suitable for use as the variable's value. +@node User-specific configuration +@section User-specific configuration +@cindex initializationOptions +@cindex command-line arguments + +This kind of configuration applies to all projects the server is used +for. Here, there are a number of ways to do this inside Eglot. + +A common way is to pass command-line options to the server invocation +via @code{eglot-server-programs}. Let's say we want to configure +where the @command{clangd} server reads its +@code{compile_commands.json} from. This can be done like so: + +@lisp +(with-eval-after-load 'eglot + (add-to-list 'eglot-server-programs + `(c++-mode . ("clangd" "--compile-commands-dir=/tmp")))) + +@end lisp + +@noindent +Another way is to have Eglot pass a JSON object to the server during +the LSP handshake. This is done using the +@code{:initializationOptions} syntax of @code{eglot-server-programs}: + +@lisp +(with-eval-after-load 'eglot + (add-to-list 'eglot-server-programs + `(c++-mode . ("clangd" :initializationOptions + (:compilationDatabasePath "/tmp"))))) +@end lisp + +@noindent +The argument @code{(:compilationDatabasePath "/tmp")} is Emacs's +representation in plist format of a simple JSON object +@code{@{"compilationDatabasePath": "/tmp"@}}. To learn how to +represent more deeply nested options in this format, @xref{JSONRPC +objects in Elisp}. + +In this case, the two examples achieve exactly the same, but notice +how the option's name has changed between them. + +@vindex eglot-workspace-configuration +Finally there is another way to do user-specific configuration of +language servers, which may be used if the methods above are not +supported. It consists of @emph{globally} setting +@code{eglot-workspace-configuration}, a variable originally intended +for project-specific configuration. This has the same effect as +giving all your projects a certain default configuration, as described +in @xref{Project-specific configuration}. Here is an example. + +@lisp +(setq-default eglot-workspace-configuration + '(:pylsp (:plugins (:jedi_completion (:include_params t + :fuzzy t) + :pylint (:enabled :json-false))) + :gopls (:usePlaceholders t))) +@end lisp + +Note that the global value of @code{eglot-workspace-configuration} is +always overriden if a directory-local value is detected. + @node JSONRPC objects in Elisp @section JSONRPC objects in Elisp commit 812597f864c4c75525bc65d63a8016d6a6797c9f Author: Eli Zaretskii Date: Sun Mar 12 22:22:41 2023 +0200 ; * lisp/novice.el (disabled-command-function): Add note in a comment. diff --git a/lisp/novice.el b/lisp/novice.el index 18fb9f6c9fc..05e4bfc91c9 100644 --- a/lisp/novice.el +++ b/lisp/novice.el @@ -84,6 +84,12 @@ disabled-command-function \\`SPC' to try the command just this once, but leave it disabled. \\`!' to enable it and all the disabled commands for this session."))) (char + ;; Note: the prompt produced from the choices below must not + ;; overflow a single screen line, because otherwise it will + ;; cause the mini-window to resize, which will in turn hide + ;; the last line of the help text above: the code which fits + ;; the window to the size of the help text does not expect + ;; the mini-window to become taller. (car (read-multiple-choice "Use this command?" '((?n "no") (?y "yes") commit 4a603c98499e6ffc0ea4b061a2895b4f7f8cb1c3 Author: João Távora Date: Sun Mar 12 19:30:53 2023 +0000 Amend last Eglot commit (bug#62065) The fix contained a spurious check for this-command that shouldn't have made it in.. * lisp/progmodes/eglot.el (eglot-ensure): Don't check this-command. diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 758be488680..18b44e502df 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -1159,8 +1159,7 @@ eglot-ensure (remove-hook 'post-command-hook #'maybe-connect t) (unless eglot--managed-mode (apply #'eglot--connect (eglot--guess-contact)))))) - (when (and this-command - buffer-file-name) + (when buffer-file-name (add-hook 'post-command-hook #'maybe-connect 'append t))))) (defun eglot-events-buffer (server) commit b916ec88b2ffe22a49128f17cdfb78f0ab1bc713 Author: João Távora Date: Sun Mar 12 18:19:40 2023 +0000 Make eglot-ensure's post-command-hook run a bit later (bug#62065) 'eglot-ensure', typically used in the major-mode-hook, use 'post-command-hook' to schedule an automated, non-interactive connection attempt to a server. The goal is to connect when the buffer is ready, i.e. after the user command that found the file. However, if there are dir-local or buffer-local variables to confirm, finding the file will cause a minibuffer prompt to appear. In that case, 'eglot-ensure's addition to the global post-command-hook runs before it was intended too and a connection is started prematurely. In turn, this means that a call to 'hack-dir-local-variables' -- which is part of the connection process -- which also needs a minibuffer prompt, collides with the previous one. This generates an error and confuses the user, who doesn't know if the directory-local variables have been applied or not. This commit fixes the clash by having 'eglot-ensure' set 'post-command-hook' buffer-locally. This causes the automated connection to take place, as intended, after the user's original file-finding command has ended. However, the problem reported in bug#62065 is not completely fixed. If the user answers "no" to the first "confirm local variables" "prompt, she will be prompted again in the second one. A subsequent commit will address this separate problem. * lisp/progmodes/eglot.el (eglot-ensure): Use buffer-local post-command-hook. diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 2679773c117..758be488680 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -1155,12 +1155,13 @@ eglot-ensure (cl-labels ((maybe-connect () - (remove-hook 'post-command-hook #'maybe-connect nil) (eglot--when-live-buffer buffer + (remove-hook 'post-command-hook #'maybe-connect t) (unless eglot--managed-mode (apply #'eglot--connect (eglot--guess-contact)))))) - (when buffer-file-name - (add-hook 'post-command-hook #'maybe-connect 'append nil))))) + (when (and this-command + buffer-file-name) + (add-hook 'post-command-hook #'maybe-connect 'append t))))) (defun eglot-events-buffer (server) "Display events buffer for SERVER. commit 1c05175c21adc5e3af4ea518f25b76be4c60abed Author: Eli Zaretskii Date: Sun Mar 12 19:32:02 2023 +0200 Fix display of disabled-command help text * lisp/novice.el (disabled-command-function): Improve wording, and make sure the prompt doesn't exceed one screen line, so that the mini-window is not resized (which gets in the way of fitting the window to the size of the help text), and the help text is fully visible when Emacs prompts for input. (Bug#62146) diff --git a/lisp/novice.el b/lisp/novice.el index c3549acef3e..18fb9f6c9fc 100644 --- a/lisp/novice.el +++ b/lisp/novice.el @@ -79,16 +79,16 @@ disabled-command-function Do you want to use this command anyway? You can now type: - \\`y' to try it and enable it (no questions if you use it again). - \\`n' to cancel--don't try the command, and it remains disabled. + \\`n' (also C-g) to cancel--don't try the command; it remains disabled. + \\`y' to enable the command (no questions if you use it again). \\`SPC' to try the command just this once, but leave it disabled. - \\`!' to try it, and enable all disabled commands for this session only."))) + \\`!' to enable it and all the disabled commands for this session."))) (char (car (read-multiple-choice "Use this command?" - '((?y "yes") - (?n "no") - (?! "yes; enable for session") - (?\s "(space bar) yes; once")) + '((?n "no") + (?y "yes") + (?\s "(space bar) only once") + (?! "use and enable all")) help-string "*Disabled Command*")))) (pcase char commit 3ce37db9882aff24301716e638999e0888195083 Author: Mattias Engdegård Date: Sun Mar 12 17:57:38 2023 +0100 Remove mention of old dotted-list reader quirk from manual * doc/lispref/objects.texi (Dotted Pair Notation): The (. X) reader peculiarity is no more (bug#62020). diff --git a/doc/lispref/objects.texi b/doc/lispref/objects.texi index 99a3c073971..2fe7e6db560 100644 --- a/doc/lispref/objects.texi +++ b/doc/lispref/objects.texi @@ -1007,13 +1007,6 @@ Dotted Pair Notation @end example @end ifnottex - As a somewhat peculiar side effect of @code{(a b . c)} and -@code{(a . (b . c))} being equivalent, for consistency this means -that if you replace @code{b} here with the empty sequence, then it -follows that @code{(a . c)} and @code{(a . ( . c))} are equivalent, -too. This also means that @code{( . c)} is equivalent to @code{c}, -but this is seldom used. - @node Association List Type @subsubsection Association List Type commit 42335c2c1f18c250719dd621a1923d0f40b82927 Author: Eli Zaretskii Date: Sun Mar 12 16:19:49 2023 +0200 Fix value history shown for 'gc-cons-percentage' When Emacs is built, temacs is run in batch mode, so if we enlarge 'gc-cons-percentage' in that case, the enlarged value will be "remembered" by the dumped Emacs, and will show confusing information in "C-h v", claiming that the original value was 1.0. Keeping the value at 0.1 during dumping avoids that. * src/emacs.c (main): Increase 'gc-cons-percentage' in batch mode only if we are not initializing (a.k.a. "dumping") Emacs. diff --git a/src/emacs.c b/src/emacs.c index 214e2e2a296..e63b0924282 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -1954,7 +1954,7 @@ main (int argc, char **argv) /* Do less garbage collection in batch mode (since these tend to be more short-lived, and the memory is returned to the OS on exit anyway). */ - Vgc_cons_percentage = make_float (noninteractive? 1.0: 0.1); + Vgc_cons_percentage = make_float (noninteractive && initialized ? 1.0 : 0.1); no_loadup = argmatch (argv, argc, "-nl", "--no-loadup", 6, NULL, &skip_args); commit fffbce29349b14daa5f9b9c97ff5ba230b56c247 Author: Michael Albinus Date: Sun Mar 12 11:01:22 2023 +0100 TRework fix for bug#62106 * lisp/files-x.el (connection-local-set-profiles) (connection-local-set-profile-variables): Use `custom-set-variables'. It serves the purpose to not keep unsaved user options, and it is less invasive than `customize-save-variable'. diff --git a/lisp/files-x.el b/lisp/files-x.el index eb236c68e52..be27aedf2e2 100644 --- a/lisp/files-x.el +++ b/lisp/files-x.el @@ -681,8 +681,8 @@ connection-local-set-profiles (setq connection-local-criteria-alist (cons (cons criteria (delete-dups profiles)) connection-local-criteria-alist)))) - (customize-save-variable - 'connection-local-criteria-alist connection-local-criteria-alist)) + (custom-set-variables + `(connection-local-criteria-alist ',connection-local-criteria-alist))) (defsubst connection-local-get-profile-variables (profile) "Return the connection-local variable list for PROFILE." @@ -702,8 +702,8 @@ connection-local-set-profile-variables VARIABLES list of the connection profile. The list is processed in order." (setf (alist-get profile connection-local-profile-alist) variables) - (customize-save-variable - 'connection-local-profile-alist connection-local-profile-alist)) + (custom-set-variables + `(connection-local-profile-alist ',connection-local-profile-alist))) ;;;###autoload (defun connection-local-update-profile-variables (profile variables) commit 8bc12a273624b8cc6fcb43ae51621634a9023dce Author: Eli Zaretskii Date: Sun Mar 12 09:48:45 2023 +0200 ; * etc/NEWS: Fix last change. diff --git a/etc/NEWS b/etc/NEWS index 01ab4b8a1db..fa59b8ed713 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -4884,6 +4884,12 @@ two buttons: "Yes" and "No". --- *** 'process-attributes' is now implemented. +** macOS + ++++ +*** The 'ns-popup-font-panel' command has been removed. +Use the general command "M-x menu-set-font" instead. + ---------------------------------------------------------------------- This file is part of GNU Emacs. commit 2ac068d294ed650ab535972d9c52b45feea0dfa8 Author: Eli Zaretskii Date: Sun Mar 12 09:45:48 2023 +0200 ; Remove 'ns-popup-font-panel' from documentation * doc/emacs/macos.texi (Mac / GNUstep Customization): Remove the reference to 'ns-popup-font-panel'. (Bug#62130) diff --git a/doc/emacs/macos.texi b/doc/emacs/macos.texi index 6b9ae196704..9f2c4721cab 100644 --- a/doc/emacs/macos.texi +++ b/doc/emacs/macos.texi @@ -201,13 +201,6 @@ Mac / GNUstep Customization number makes the trackpad less sensitive. @end table -@subsection Font Panel - -@findex ns-popup-font-panel -The standard Mac / GNUstep font panel is accessible with @kbd{M-x -ns-popup-font-panel} and will set the default font in the frame most -recently used or clicked on. - @c To make the setting permanent, use @samp{Save Options} in the @c Options menu, or run @code{menu-bar-options-save}. commit 5bc32d008fb1fa4dc3e08b7400f9d42f3e6bad6c Author: Randy Taylor Date: Fri Mar 10 20:56:04 2023 -0500 Add missing indentation rule for rust-ts-mode (Bug#62109) * lisp/progmodes/rust-ts-mode.el (rust-ts-mode--indent-rules): Add missing rule. diff --git a/lisp/progmodes/rust-ts-mode.el b/lisp/progmodes/rust-ts-mode.el index 5a4f4dc25c0..be06acde3e3 100644 --- a/lisp/progmodes/rust-ts-mode.el +++ b/lisp/progmodes/rust-ts-mode.el @@ -91,6 +91,7 @@ rust-ts-mode--indent-rules ((parent-is "let_declaration") parent-bol rust-ts-mode-indent-offset) ((parent-is "macro_definition") parent-bol rust-ts-mode-indent-offset) ((parent-is "parameters") parent-bol rust-ts-mode-indent-offset) + ((parent-is "struct_pattern") parent-bol rust-ts-mode-indent-offset) ((parent-is "token_tree") parent-bol rust-ts-mode-indent-offset) ((parent-is "use_list") parent-bol rust-ts-mode-indent-offset))) "Tree-sitter indent rules for `rust-ts-mode'.") commit 0404924930d9ba021bcbee5f53b3257a86744c2e Author: Eli Zaretskii Date: Sat Mar 11 19:30:06 2023 +0200 ; One more improvement to ELisp "internals" appendix. diff --git a/doc/lispref/internals.texi b/doc/lispref/internals.texi index 428d016b274..e896c69bc38 100644 --- a/doc/lispref/internals.texi +++ b/doc/lispref/internals.texi @@ -566,7 +566,8 @@ Garbage Collection time, and advise that you never set it higher than needed for the program to run in reasonable time. Using thresholds higher than necessary could potentially cause higher system-wide memory pressure, -and should therefore be avoided. +and also make each garbage-collection cycle take much more time, and +should therefore be avoided. You can make collections more frequent by specifying a smaller value, down to 1/10th of @code{GC_DEFAULT_THRESHOLD}. A value less than this minimum commit c857775ca61c4e1fb0bc9d89d6d4cf1157a0b779 Author: Michael Albinus Date: Sat Mar 11 17:31:11 2023 +0100 Fix bug#62106 * lisp/files-x.el (connection-local-set-profiles) (connection-local-set-profile-variables): Use `customize-save-variable' instead of `customize-set-variable'. (Bug#62106) diff --git a/lisp/files-x.el b/lisp/files-x.el index 5fa0129e9d0..eb236c68e52 100644 --- a/lisp/files-x.el +++ b/lisp/files-x.el @@ -681,7 +681,7 @@ connection-local-set-profiles (setq connection-local-criteria-alist (cons (cons criteria (delete-dups profiles)) connection-local-criteria-alist)))) - (customize-set-variable + (customize-save-variable 'connection-local-criteria-alist connection-local-criteria-alist)) (defsubst connection-local-get-profile-variables (profile) @@ -702,7 +702,7 @@ connection-local-set-profile-variables VARIABLES list of the connection profile. The list is processed in order." (setf (alist-get profile connection-local-profile-alist) variables) - (customize-set-variable + (customize-save-variable 'connection-local-profile-alist connection-local-profile-alist)) ;;;###autoload commit 0fedbfa6a9d8a73c4adfa8f144acd2808676ea3a Author: Eli Zaretskii Date: Sat Mar 11 18:16:35 2023 +0200 ; Minor improvement of documentation of GC thresholds * doc/lispref/internals.texi (Garbage Collection): More practical aspects of enlarging the GC threshold. diff --git a/doc/lispref/internals.texi b/doc/lispref/internals.texi index 6a8aaf8ebaf..428d016b274 100644 --- a/doc/lispref/internals.texi +++ b/doc/lispref/internals.texi @@ -558,13 +558,15 @@ Garbage Collection value is 400,000 for the default 32-bit configuration and 800,000 for the 64-bit one. If you specify a larger value, garbage collection will happen less often. This reduces the amount of time spent garbage -collecting, but increases total memory use. You may want to do this -when running a program that creates lots of Lisp data. However, we +collecting (so Lisp programs will run faster between cycles of garbage +collection that happen more rarely), but increases total memory use. +You may want to do this when running a program that creates lots of +Lisp data, especially if you need it to run faster. However, we recommend against increasing the threshold for prolonged periods of time, and advise that you never set it higher than needed for the program to run in reasonable time. Using thresholds higher than -necessary could potentially cause system-wide memory pressure, and -should therefore be avoided. +necessary could potentially cause higher system-wide memory pressure, +and should therefore be avoided. You can make collections more frequent by specifying a smaller value, down to 1/10th of @code{GC_DEFAULT_THRESHOLD}. A value less than this minimum commit b0b24ad2fc579537e512f0c6654f35d4ca22a1b6 Author: Randy Taylor Date: Fri Mar 10 21:12:33 2023 -0500 Add missing rust-ts-mode highlight query for scoped_type_identifiers * lisp/progmodes/rust-ts-mode.el (rust-ts-mode--font-lock-settings): Add missing query. diff --git a/lisp/progmodes/rust-ts-mode.el b/lisp/progmodes/rust-ts-mode.el index 696c2633231..5a4f4dc25c0 100644 --- a/lisp/progmodes/rust-ts-mode.el +++ b/lisp/progmodes/rust-ts-mode.el @@ -235,6 +235,7 @@ rust-ts-mode--font-lock-settings "^\\(u8\\|u16\\|u32\\|u64\\|u128\\|usize\\|i8\\|i16\\|i32\\|i64\\|i128\\|isize\\|char\\|str\\)$" @font-lock-type-face)) ((scoped_identifier path: (identifier) @rust-ts-mode--fontify-scope)) + ((scoped_type_identifier path: (identifier) @rust-ts-mode--fontify-scope)) (type_identifier) @font-lock-type-face) :language 'rust commit c0cf69f7a17b657c784518434e1a049ce6970a43 Author: kobarity Date: Fri Mar 10 14:26:22 2023 +0900 Make "case" keyword a dedenter in Python * lisp/progmodes/python.el (python-rx): Add "case" to dedenter. (python-info-dedenter-opening-block-positions): Add "case" to pairs. * test/lisp/progmodes/python-tests.el (python-indent-dedenters-9): New test. diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 1980815bae9..8793fdc6458 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -426,7 +426,7 @@ python-rx (or "def" "for" "with"))) symbol-end)) (dedenter (seq symbol-start - (or "elif" "else" "except" "finally") + (or "elif" "else" "except" "finally" "case") symbol-end)) (block-ender (seq symbol-start (or @@ -5783,7 +5783,8 @@ python-info-dedenter-opening-block-positions (pairs '(("elif" "elif" "if") ("else" "if" "elif" "except" "for" "while") ("except" "except" "try") - ("finally" "else" "except" "try"))) + ("finally" "else" "except" "try") + ("case" "case"))) (dedenter (match-string-no-properties 0)) (possible-opening-blocks (cdr (assoc-string dedenter pairs))) (collected-indentations) diff --git a/test/lisp/progmodes/python-tests.el b/test/lisp/progmodes/python-tests.el index 2568299bb66..e5a9d128bc5 100644 --- a/test/lisp/progmodes/python-tests.el +++ b/test/lisp/progmodes/python-tests.el @@ -1658,6 +1658,21 @@ python-indent-dedenters-8 (python-indent-line t) (should (= (python-indent-calculate-indentation t) 6)))) +(ert-deftest python-indent-dedenters-9 () + "Test de-indentation for the case keyword." + (python-tests-with-temp-buffer + " +match a: + case 1: + print(1) + case 2 +" + (python-tests-look-at "case 2") + (should (eq (car (python-indent-context)) :at-dedenter-block-start)) + (should (= (python-indent-calculate-indentation) 4)) + (python-indent-line t) + (should (= (python-indent-calculate-indentation t) 4)))) + (ert-deftest python-indent-inside-string-1 () "Test indentation for strings." (python-tests-with-temp-buffer commit db178517ce73618f7a659e355639893748db2e45 Author: Eli Zaretskii Date: Sat Mar 11 14:54:22 2023 +0200 ; * lisp/arc-mode.el (w32-get-console-codepage): Declare. diff --git a/lisp/arc-mode.el b/lisp/arc-mode.el index 41b239fbef9..5e696c091b2 100644 --- a/lisp/arc-mode.el +++ b/lisp/arc-mode.el @@ -1956,6 +1956,7 @@ 'archive-lzh-exe-extract ;; ------------------------------------------------------------------------- ;;; Section: Zip Archives +(declare-function w32-get-console-codepage "w32proc.c") (defun archive-zip-summarize () (goto-char (- (point-max) (- 22 18))) (search-backward-regexp "[P]K\005\006") commit 157a91b54bece12d197ad66c756dcea7d1679a54 Author: Eli Zaretskii Date: Sat Mar 11 13:30:37 2023 +0200 Fix decoding non-ASCII file names in zip archives on MS-Windows * lisp/arc-mode.el (archive-zip-summarize): On MS-Windows, override archive-file-name-coding-system for files compressed on MS-Windows, and use the local console encoding instead. diff --git a/lisp/arc-mode.el b/lisp/arc-mode.el index dcf7c17a878..41b239fbef9 100644 --- a/lisp/arc-mode.el +++ b/lisp/arc-mode.el @@ -1960,6 +1960,16 @@ archive-zip-summarize (goto-char (- (point-max) (- 22 18))) (search-backward-regexp "[P]K\005\006") (let ((p (archive-l-e (+ (point) 16) 4)) + (w32-fname-encoding + ;; On MS-Windows, both InfoZip's Zip and the system's + ;; built-in File Explorer use the console codepage for + ;; encoding file names. Problem: the codepage of the system + ;; where the zip file was created cannot be known; we assume + ;; it is the same as the one of the current system. Also, + ;; the zip file doesn't tell us the OS where the file was + ;; created, it only tells the filesystem. + (if (eq system-type 'windows-nt) + (intern (format "cp%d" (w32-get-console-codepage))))) files) (when (or (= p #xffffffff) (= p -1)) ;; If the offset of end-of-central-directory is 0xFFFFFFFF, this @@ -1989,7 +1999,15 @@ archive-zip-summarize ;; (lheader (archive-l-e (+ p 42) 4)) (efnname (let ((str (buffer-substring (+ p 46) (+ p 46 fnlen)))) (decode-coding-string - str archive-file-name-coding-system))) + str + (or (if (and w32-fname-encoding + (memq creator + ;; This should be just 10 and + ;; 14, but InfoZip uses 0 and + ;; File Explorer uses 11(??). + '(0 10 11 14))) + w32-fname-encoding) + archive-file-name-coding-system)))) (ucsize (if (and (or (= ucsize #xffffffff) (= ucsize -1)) (> exlen 0)) ;; APPNOTE.TXT, para 4.5.3: the Extra Field commit 4803f97204773180d6ea97868a7d1859141e9ab5 Author: Eli Zaretskii Date: Sat Mar 11 11:54:31 2023 +0200 Fix copying binary files from zip archives * lisp/arc-mode.el (archive-copy-file): Prevent any coding conversions when writing output files. (Bug#62091) diff --git a/lisp/arc-mode.el b/lisp/arc-mode.el index 6f3e922880d..dcf7c17a878 100644 --- a/lisp/arc-mode.el +++ b/lisp/arc-mode.el @@ -1093,7 +1093,9 @@ archive-copy-file (with-temp-buffer (set-buffer-multibyte nil) (archive--extract-file extractor copy ename) - (write-region (point-min) (point-max) write-to)) + (let ((coding-system-for-write + (or coding-system-for-write 'no-conversion))) + (write-region (point-min) (point-max) write-to))) (unless (equal copy archive) (delete-file copy)))))))) commit 679f528b953abaa9195381d51ecd7d66256ac294 Author: Robert Pluim Date: Fri Mar 10 11:13:42 2023 +0100 Skip ruby-ts-syntax-propertize-symbol unless treesitter is available * test/lisp/progmodes/ruby-ts-mode-tests.el (ruby-ts-syntax-propertize-symbol): Add check for treesitter. diff --git a/test/lisp/progmodes/ruby-ts-mode-tests.el b/test/lisp/progmodes/ruby-ts-mode-tests.el index 0e258275f97..e0d9f1b5c50 100644 --- a/test/lisp/progmodes/ruby-ts-mode-tests.el +++ b/test/lisp/progmodes/ruby-ts-mode-tests.el @@ -259,6 +259,7 @@ ruby-ts-add-log-current-method-after-endless-method (should (string= (ruby-ts-add-log-current-function) "M::C#foo")))) (ert-deftest ruby-ts-syntax-propertize-symbol () + (skip-unless (treesit-ready-p 'ruby t)) (pcase-dolist (`(,str . ,expected) '((":abc" . ":abc") (":foo?" . #(":foo?" 4 5 (syntax-table (3)))) commit 081cc7aa8e07540068359922c14e61d03b4a4084 Author: Yuan Fu Date: Thu Mar 9 22:15:36 2023 -0800 ; * doc/misc/eglot.texi (Project-specific configuration): Fix typo. diff --git a/doc/misc/eglot.texi b/doc/misc/eglot.texi index 474800fb270..99dc4ae1501 100644 --- a/doc/misc/eglot.texi +++ b/doc/misc/eglot.texi @@ -1121,7 +1121,7 @@ Project-specific configuration Let's say you want to configure two language servers to be used in a project written in a combination of the Python and Go languages. You want to use the @command{pylsp} and @command{gopls} LSP servers. In -the documentation of the servers in question(or in some other editor's +the documentation of the servers in question (or in some other editor's configuration file, or in some blog article), you find the following configuration options in informal dotted-notation syntax: commit 1de513a29facd0b128b546af95358c60b2faf650 Author: Randy Taylor Date: Tue Mar 7 20:38:18 2023 -0500 Fix enums and unions appearing as structs in c-ts-base-mode's imenu * lisp/progmodes/c-ts-mode.el (c-ts-base-mode): Separate enums and unions out from structs. diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el index fdd962ff020..ff86b9e0544 100644 --- a/lisp/progmodes/c-ts-mode.el +++ b/lisp/progmodes/c-ts-mode.el @@ -930,9 +930,9 @@ c-ts-base-mode ;; Imenu. (setq-local treesit-simple-imenu-settings (let ((pred #'c-ts-mode--defun-valid-p)) - `(("Struct" ,(rx bos (or "struct" "enum" "union") - "_specifier" eos) - ,pred nil) + `(("Enum" "\\`enum_specifier\\'" ,pred nil) + ("Struct" "\\`struct_specifier\\'" ,pred nil) + ("Union" "\\`union_specifier\\'" ,pred nil) ("Variable" ,(rx bos "declaration" eos) ,pred nil) ("Function" "\\`function_definition\\'" ,pred nil) ("Class" ,(rx bos (or "class_specifier" commit ecdfd584a52f280c250b766011867059f9242057 Author: Dmitry Gutov Date: Thu Mar 9 23:49:39 2023 +0200 ruby-ts-mode: Fine-tune s-p-f on symbols (bug#62086) * lisp/progmodes/ruby-ts-mode.el (ruby-ts--s-p-query): Don't match ':' in symbol node text. Or '_', I suppose. (ruby-ts--syntax-propertize): Make sure to only put the '_' syntax on punctuation syntax characters, and not on the whole symbol (to e.g. have symbols like :foo? include text recognized as word). * test/lisp/progmodes/ruby-ts-mode-tests.el (ruby-ts-syntax-propertize-symbol): New test. diff --git a/lisp/progmodes/ruby-ts-mode.el b/lisp/progmodes/ruby-ts-mode.el index 750642420e3..da2a0a6c852 100644 --- a/lisp/progmodes/ruby-ts-mode.el +++ b/lisp/progmodes/ruby-ts-mode.el @@ -1026,7 +1026,7 @@ ruby-ts--s-p-query (:match "\\`?[#\"'`:?]" @char)) ;; Symbols like :+, :<=> or :foo=. ((simple_symbol) @symbol - (:match "[[:punct:]]" @symbol)) + (:match "\\s." @symbol)) ;; Method calls with name ending with ? or !. ((call method: (identifier) @ident) (:match "[?!]\\'" @ident)) @@ -1058,7 +1058,9 @@ ruby-ts--syntax-propertize (put-text-property (1- (treesit-node-end node)) (treesit-node-end node) 'syntax-table (string-to-syntax "_"))) ('symbol - (put-text-property (1+ (treesit-node-start node)) (treesit-node-end node) + (goto-char (treesit-node-end node)) + (skip-syntax-backward "." (treesit-node-start node)) + (put-text-property (point) (treesit-node-end node) 'syntax-table (string-to-syntax "_"))) ('heredoc (put-text-property (treesit-node-start node) (1+ (treesit-node-start node)) diff --git a/test/lisp/progmodes/ruby-ts-mode-tests.el b/test/lisp/progmodes/ruby-ts-mode-tests.el index c99e1a43063..0e258275f97 100644 --- a/test/lisp/progmodes/ruby-ts-mode-tests.el +++ b/test/lisp/progmodes/ruby-ts-mode-tests.el @@ -258,6 +258,21 @@ ruby-ts-add-log-current-method-after-endless-method (delete-char 1) (should (string= (ruby-ts-add-log-current-function) "M::C#foo")))) +(ert-deftest ruby-ts-syntax-propertize-symbol () + (pcase-dolist (`(,str . ,expected) + '((":abc" . ":abc") + (":foo?" . #(":foo?" 4 5 (syntax-table (3)))) + (":<=>" . #(":<=>" 1 4 (syntax-table (3)))))) + (ruby-ts-with-temp-buffer str + (syntax-propertize (point-max)) + (let ((text (buffer-string))) + (remove-text-properties 0 (1- (point-max)) + '(fontified) + text) + (should (equal-including-properties + text + expected)))))) + (defmacro ruby-ts-resource-file (file) `(when-let ((testfile ,(or (macroexp-file-name) buffer-file-name))) commit 29228e24f20954b93dccef4ac5d704ca31daa80c Author: Dmitry Gutov Date: Thu Mar 9 17:24:54 2023 +0200 python-info-dedenter-opening-block-positions: Fix to support "bare" match * lisp/progmodes/python.el (python-info-dedenter-opening-block-positions): Make the check stricter. Require that block starts only at indentation. * test/lisp/progmodes/python-tests.el (python-indent-after-bare-match): Another test (bug#62031). diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 5b11d204de1..1980815bae9 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -5792,7 +5792,9 @@ python-info-dedenter-opening-block-positions (while (python-nav--syntactically (lambda () (cl-loop while (re-search-backward (python-rx block-start) nil t) - if (memq (char-before) '(nil ?\s ?\t ?\n)) + if (save-match-data + (looking-back (rx line-start (* whitespace)) + (line-beginning-position))) return t)) #'<) (let ((indentation (current-indentation))) diff --git a/test/lisp/progmodes/python-tests.el b/test/lisp/progmodes/python-tests.el index 7e2f66e9095..2568299bb66 100644 --- a/test/lisp/progmodes/python-tests.el +++ b/test/lisp/progmodes/python-tests.el @@ -1994,6 +1994,20 @@ python-indent-after-re-match (python-tests-look-at "else:") (should (= (python-indent-calculate-indentation) 4)))) +(ert-deftest python-indent-after-bare-match () + "Test BUG 62031 regression." + (python-tests-with-temp-buffer + " +from re import match + +def test_re(string): + if match('^[a-c]+$', string): + print('yes') + else: + " + (python-tests-look-at "else:") + (should (= (python-indent-calculate-indentation) 4)))) + ;;; Filling commit 01b65d442ad681e6fef0db76451e668125a17038 Author: João Távora Date: Thu Mar 9 13:07:02 2023 +0000 Autoload Eglot helper funtion eglot--debbugs-or-github-bug-uri This isn't a typical autoload: the progn block is plced in the autoloads file, but the eglot.el file itself isn't loaded as a result when the function inside the progn block is called. * lisp/progmodes/eglot.el (eglot--debbugs-or-github-bug-uri): autoload, but in progn. diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 2491c86ea5b..2679773c117 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -3666,13 +3666,14 @@ eglot-inlay-hints-mode ;;; Misc ;;; -(defun eglot--debbugs-or-github-bug-uri () - (format (if (string= (match-string 2) "github") - "https://github.com/joaotavora/eglot/issues/%s" - "https://debbugs.gnu.org/%s") - (match-string 3))) -(put 'eglot--debbugs-or-github-bug-uri 'bug-reference-url-format t) - +;;;###autoload +(progn + (put 'eglot--debbugs-or-github-bug-uri 'bug-reference-url-format t) + (defun eglot--debbugs-or-github-bug-uri () + (format (if (string= (match-string 2) "github") + "https://github.com/joaotavora/eglot/issues/%s" + "https://debbugs.gnu.org/%s") + (match-string 3)))) ;;; Obsolete ;;; commit 50a3559c5a7106b99d254e1a0acb047b1fb858a2 Author: João Távora Date: Thu Mar 9 01:20:11 2023 +0000 Add chapter on advanced server configuration to Eglot manual * doc/misc/eglot.texi (Top): Add section "Advanced server configuration" (Setting Up LSP Servers): Rework. (Advanced server configuration): New chapter. diff --git a/doc/misc/eglot.texi b/doc/misc/eglot.texi index eed9744b9f0..474800fb270 100644 --- a/doc/misc/eglot.texi +++ b/doc/misc/eglot.texi @@ -98,6 +98,7 @@ Top * Eglot and LSP Servers:: How to work with language servers. * Using Eglot:: Important Eglot commands and variables. * Customizing Eglot:: Eglot customization and advanced features. +* Advanced server configuration:: Fine-tune a specific language server * Troubleshooting Eglot:: Troubleshooting and reporting bugs. * GNU Free Documentation License:: The license for this manual. * Index:: @@ -226,11 +227,10 @@ Setting Up LSP Servers standard input and standard output streams. @item (@var{program} @var{args}@dots{} :initializationOptions @var{options}@dots{}) -Like above, but with @var{options} specifying the options to be -used for constructing the @samp{initializationOptions} JSON object for -the server. @var{options} can also be a function of one argument, in -which case it will be called with the server instance as the argument, -and should return the JSON object to use for initialization. +@var{program} is invoked with @var{args} but @var{options} specifies +how to construct the @samp{:initializationOptions} JSON object to pass +the server on during the LSP handshake (@pxref{Advanced server +configuration}). @item (@var{host} @var{port} @var{args}@dots{}) Here @var{host} is a string and @var{port} is a positive integer @@ -970,139 +970,287 @@ Customizing Eglot Set this variable to true if you'd like progress notifications coming from the LSP server to be handled as Emacs's progress reporting facilities. +@end table + +@node Advanced server configuration +@chapter Advanced server configuration + +Though many language servers work well out-of-the-box, most allow +fine-grained control of their operation via specific configuration +options that vary from server to server. A small number of servers +require such special configuration to work acceptably, or even to work +at all. + +After having setup a server executable program in +@code{eglot-server-programs} (@pxref{Setting Up LSP Servers}) and +ensuring Eglot can invoke it, you may want to take advantage of some +of these options. You should first distinguish two main kinds of +server configuration: + +@itemize @bullet +@item +User-specific, applying to all projects the server is used for; + +@item +Project-specific, applying to a specific project. +@end itemize + +When you have decided which kind you need, the following sections +teach how Eglot's user variables can be used to achieve it: + +@menu +* User-specific configuration:: +* Project-specific configuration:: +* JSONRPC objects in Elisp:: +@end menu + +It's important to note that not all servers allow both kinds of +configuration, nor is it guaranteed that user options can be copied +over project options, and vice-versa. When in doubt, consult your +language server's documentation. + +It's also worth noting that some language servers can read these +settings from configuration files in the user's @code{HOME} directory +or in a project's directory. For example, the @command{pylsp} Python +server reads the file @file{~/.config/pycodestyle} for user +configuration. The @command{clangd} C/C++ server reads both +@file{~/.config/clangd/config.yaml} for user configuration and +@file{.clangd} for project configuration. It may be advantageous to +use these mechanisms instead of Eglot's, as the latter have the +advantage of working with other LSP clients. + +@node User-specific configuration +@section User-specific configuration +@cindex initializationOptions +@cindex command-line arguments + +This kind of configuration applies to all projects the server is used +for. Here, there are again two main ways to do this inside Eglot. + +A common way is to pass command-line options to the server invocation +via @code{eglot-server-programs}. Let's say we want to configure +where the @command{clangd} server reads its +@code{compile_commands.json} from. This can be done like so: + +@lisp +(with-eval-after-load 'eglot + (add-to-list 'eglot-server-programs + `(c++-mode . ("clangd" "--compile-commands-dir=/tmp")))) + +@end lisp + +@noindent +Another way is to have Eglot pass a JSON object to the server during +the LSP handshake. This is done using the +@code{:initializationOptions} syntax of @code{eglot-server-programs}: + +@lisp +(with-eval-after-load 'eglot + (add-to-list 'eglot-server-programs + `(c++-mode . ("clangd" :initializationOptions + (:compilationDatabasePath "/tmp"))))) +@end lisp + +@noindent +The argument @code{(:compilationDatabasePath "/tmp")} is Emacs's +representation in plist format of a simple JSON object +@code{@{"compilationDatabasePath": "/tmp"@}}. To learn how to +represent more deeply nested options in this format, @xref{JSONRPC +objects in Elisp}. + +In this case, the two examples achieve exactly the same, but notice +how the option's name has changed between them. +@node Project-specific configuration +@section Project-specific configuration @vindex eglot-workspace-configuration -@cindex server workspace configuration -@item eglot-workspace-configuration -This variable is meant to be set in the @file{.dir-locals.el} file, to -provide per-project settings, as described below in more detail. -@end table +@cindex workspace configuration + +To set project-specific settings, which the LSP specification calls +@dfn{workspace configuration}, the variable +@code{eglot-workspace-configuration} may be used. -Some language servers need to know project-specific settings, which -the LSP calls @dfn{workspace configuration}. Eglot allows such fine -tuning of per-project settings via the variable -@code{eglot-workspace-configuration}. Eglot sends the settings in -this variable to each server, and each server applies the portion of the -settings relevant to it and ignores the rest. These settings are -communicated to the server initially (upon establishing the -connection) or when the settings are changed, or in response to a -configuration request from the server. - -In many cases, servers can be configured globally using a -configuration file in the user's home directory or in the project -directory, which the language server reads. For example, the -@command{pylsp} server for Python reads the file -@file{~/.config/pycodestyle} and the @command{clangd} server reads the -file @file{.clangd} anywhere in the current project's directory tree. -If possible, we recommend using those configuration files that are -independent of Eglot and Emacs; they have the advantage that they will -work with other LSP clients as well. - -If you do need to provide Emacs-specific configuration for a language -server, we recommend defining the appropriate value in the -@file{.dir-locals.el} file in the project's directory. The value of -this variable should be a property list of the following format: +This variable is a directory-local variable (@pxref{Directory +Variables, , Per-directory Local Variables, emacs, The GNU Emacs +Manual}). It's important to recognize that this variable really only +makes sense when set directory-locally. It usually does not make +sense to set it globally or in a major-mode hook. + +The most common way to set @code{eglot-workspace-configuration } is +using a @file{.dir-locals.el} file in the root of your project. If +you can't do that, you may also set it from Elisp code via the +@code{dir-locals-set-class-variables} function. (@pxref{Directory +Local Variables,,, elisp, GNU Emacs Lisp Reference Manual}). + +However you choose to set it, the variable's value is a plist +(@pxref{Property Lists,,, elisp, GNU Emacs Lisp Reference Manual}) with +the following format: @lisp - (:@var{server} @var{plist}@dots{}) + (@var{:server1} @var{plist1} @var{:server2} @var{plist2} @dots{}) @end lisp @noindent -Here @code{:@var{server}} identifies a particular language server and -@var{plist} is the corresponding keyword-value property list of one or -more parameter settings for that server, serialized by Eglot as a JSON -object. @var{plist} may be arbitrarily complex, generally containing -other keyword-value property sublists corresponding to JSON subobjects. -The JSON values @code{true}, @code{false}, @code{null} and @code{@{@}} -are represented by the Lisp values @code{t}, @code{:json-false}, -@code{nil}, and @code{eglot-@{@}}, respectively. +Here, @var{:server1} and @var{:server2} are keywords whose names +identify the LSP language servers to target. Consult server +documentation to find out what name to use. @var{plist1} and +@var{plist2} are plists of options, possibly nesting other plists. @findex eglot-show-workspace-configuration When experimenting with workspace settings, you can use the command @kbd{M-x eglot-show-workspace-configuration} to inspect and debug the -JSON value to be sent to the server. This helper command works even -before actually connecting to the server. +value of this variable in its final JSON form, ready to be sent to the +server (@pxref{JSONRPC objects in Elisp}). This helper command works +even before actually connecting to the server. + +These variable's value doesn't take effect immediately. That happens +upon establishing the connection, in response to an explicit query +from the server, or when issuing the command @kbd{M-x +eglot-signal-didChangeConfiguration} which notifies the server during +an ongoing Eglot session. + +@subsection Examples + +For some users, setting @code{eglot-workspace-configuration} is a +somewhat daunting task. One of the reasons is having to manage the +general Elisp syntax of per-mode directory-local variables, which uses +alists (@pxref{Association Lists,,, elisp, GNU Emacs Lisp Reference +Manual}), and the specific syntax of Eglot's variable, which uses +plists. Some examples are useful. + +Let's say you want to configure two language servers to be used in a +project written in a combination of the Python and Go languages. You +want to use the @command{pylsp} and @command{gopls} LSP servers. In +the documentation of the servers in question(or in some other editor's +configuration file, or in some blog article), you find the following +configuration options in informal dotted-notation syntax: + +@example +pylsp.plugins.jedi_completion.include_params: true +pylsp.plugins.jedi_completion.fuzzy: true +pylsp.pylint.enabled: false +gopls.usePlaceholders: true +@end example + +To apply this to Eglot, and assuming you chose the +@file{.dir-locals.el} file method, the contents of that file could be: -Here's an example of defining the workspace-configuration settings for -a project that uses two different language servers, one for Python, -the other one for Go (presumably, the project is written in a -combination of these two languages). The server for Python in this -case is @command{pylsp}, the server for Go is @command{gopls}. The -value of @code{eglot-workspace-configuration} in this case should be: +@lisp +((nil + . ((eglot-workspace-configuration + . (:pylsp (:plugins (:jedi_completion (:include_params t + :fuzzy t) + :pylint (:enabled :json-false))) + :gopls (:usePlaceholders t))))) + (python-mode . ((indent-tabs-mode . nil))) + (go-mode . ((indent-tabs-mode . t)))) +@end lisp + +@noindent +This sets the value of @code{eglot-workspace-configuration} in all the +buffers inside the project; each server will use only the section of +the parameters intended for that server, and ignore the rest. Note +how alists are used for associating Emacs mode names with alists +associating variable names with variable values. Then notice how +plists are used inside the value of +@code{eglot-workspace-configuration}. + +This following form may also be used: @lisp ((python-mode . ((eglot-workspace-configuration . (:pylsp (:plugins (:jedi_completion (:include_params t :fuzzy t) - :pylint (:enabled :json-false))))))) + :pylint (:enabled :json-false))))) + (indent-tabs-mode . nil))) (go-mode . ((eglot-workspace-configuration - . (:gopls (:usePlaceholders t)))))) + . (:gopls (:usePlaceholders t))) + (indent-tabs-mode . t)))) @end lisp @noindent -This should go into the @file{.dir-locals.el} file in the project's -root directory. It sets up the value of -@code{eglot-workspace-configuration} separately for each major mode. - -Alternatively, the same configuration could be defined as follows: +This sets up the value of @code{eglot-workspace-configuration} +separately depending on the major mode of each of that project's +buffers. @code{python-mode} buffers will have the variable set to +@code{(:pylsp (:plugins ...))}. @code{go-mode} buffers will have the +variable set to @code{(:gopls (:usePlaceholders t))}. + +Some servers will issue workspace configuration for specific files +inside your project. For example, if you know @code{gopls} is asking +about specific files in the @code{src/imported} subdirectory and you +want to set a different option for @code{gopls.usePlaceholders} , you +may use something like: @lisp -((nil +((python-mode . ((eglot-workspace-configuration . (:pylsp (:plugins (:jedi_completion (:include_params t :fuzzy t) - :pylint (:enabled :json-false))) - :gopls (:usePlaceholders t)))))) + :pylint (:enabled :json-false))))) + (indent-tabs-mode nil))) + (go-mode + . ((eglot-workspace-configuration + . (:gopls (:usePlaceholders t))) + (indent-tabs-mode t))) + ("src/imported" + . ((eglot-workspace-configuration + . (:gopls (:usePlaceholders nil)))))) @end lisp -This is an equivalent setup which sets the value for all the -major-modes inside the project; each server will use only the section -of the parameters intended for that server, and ignore the rest. - -As yet another alternative, you can set the value of -@code{eglot-workspace-configuration} programmatically, via the -@code{dir-locals-set-class-variables} function, @pxref{Directory Local -Variables,,, elisp, GNU Emacs Lisp Reference Manual}. - Finally, if one needs to determine the workspace configuration based on some dynamic context, @code{eglot-workspace-configuration} can be set to a function. The function is called with the @code{eglot-lsp-server} instance of the connected server (if any) and with @code{default-directory} set to the root of the project. The -function should return a value of the form described above. +function should return a plist suitable for use as the variable's +value. -Some servers need special hand-holding to operate correctly. If your -server has some quirks or non-conformity, it's possible to extend -Eglot via Elisp to adapt to it, by defining a suitable -@code{eglot-initialization-options} method via @code{cl-defmethod} -(@pxref{Generic Functions,,, elisp, GNU Emacs Lisp Reference Manual}). +@node JSONRPC objects in Elisp +@section JSONRPC objects in Elisp -Here's an example: +Emacs's preferred way of representing JSON is via Lisp lists. In +Eglot, the syntax of this list is the simplest possible (the one with +fewer parenthesis), a plist (@pxref{Property Lists,,, elisp, GNU Emacs +Lisp Reference Manual}). -@lisp -(require 'eglot) +The plist may be arbitrarily complex, and generally containing other +keyword-value property sub-plists corresponding to JSON sub-objects. -(add-to-list 'eglot-server-programs - '((c++-mode c-mode) . (eglot-cquery "cquery"))) +For representing the JSON leaf values @code{true}, @code{false}, +@code{null} and @code{@{@}}, you can use the Lisp values @code{t}, +@code{:json-false}, @code{nil}, and @code{eglot-@{@}}, respectively. -(defclass eglot-cquery (eglot-lsp-server) () - :documentation "A custom class for cquery's C/C++ langserver.") +For example, this plist: -(cl-defmethod eglot-initialization-options ((server eglot-cquery)) - "Passes through required cquery initialization options" - (let* ((root (car (project-roots (eglot--project server)))) - (cache (expand-file-name ".cquery_cached_index/" root))) - (list :cacheDirectory (file-name-as-directory cache) - :progressReportFrequencyMs -1))) +@lisp +(:pylsp (:plugins (:jedi_completion (:include_params t + :fuzzy t) + :pylint (:enabled :json-false))) + :gopls (:usePlaceholders t)) @end lisp -@noindent -See the doc string of @code{eglot-initialization-options} for more -details. -@c FIXME: The doc string of eglot-initialization-options should be -@c enhanced and extended. +Is serialized by Eglot to the following JSON text: + +@example +@{ + "pylsp": @{ + "plugins": @{ + "jedi_completion": @{ + "include_params": true, + "fuzzy": true + @}, + "pylint": @{ + "enabled": false + @} + @} + @}, + "gopls": @{ + "usePlaceholders":true + @}, +@} +@end example @node Troubleshooting Eglot @chapter Troubleshooting Eglot commit 2e7460c231532cd9f79e4c394d8004cbf75c2605 Author: Eli Zaretskii Date: Thu Mar 9 12:23:14 2023 +0200 ; * lisp/progmodes/java-ts-mode.el (treesit-query-capture): Declare. diff --git a/lisp/progmodes/java-ts-mode.el b/lisp/progmodes/java-ts-mode.el index fb1081a5f2e..fca00cdce4f 100644 --- a/lisp/progmodes/java-ts-mode.el +++ b/lisp/progmodes/java-ts-mode.el @@ -36,6 +36,8 @@ (declare-function treesit-node-start "treesit.c") (declare-function treesit-node-type "treesit.c") (declare-function treesit-node-child-by-field-name "treesit.c") +(declare-function treesit-node-child-by-field-name "treesit.c") +(declare-function treesit-query-capture "treesit.c") (defcustom java-ts-mode-indent-offset 4 "Number of spaces for each indentation step in `java-ts-mode'." commit 255eeee0e06abd5c395b136867e6a9a440916eea Author: Vincenzo Pupillo Date: Mon Mar 6 12:24:34 2023 +0100 java-ts-mode: detect if text_block is supported. A recent commit in tree-sitter-java (issue #141) removed support for the text_block node type from the grammar. To support the old released version and the new one, a helper function was added on which the string syntax highlighting now depends. (bug#61913) * lisp/progmodes/java-ts-mode.el (java-ts-mode--string-highlight-helper): New helper function that return the right query string (java-ts-mode--font-lock-settings): Use it Copyright-paperwork-exempt: yes diff --git a/lisp/progmodes/java-ts-mode.el b/lisp/progmodes/java-ts-mode.el index 5cd4acd301d..fb1081a5f2e 100644 --- a/lisp/progmodes/java-ts-mode.el +++ b/lisp/progmodes/java-ts-mode.el @@ -145,6 +145,16 @@ java-ts-mode--operators "|=" "~" ">>" ">>>" "<<" "::" "?" "&=") "Java operators for tree-sitter font-locking.") +(defun java-ts-mode--string-highlight-helper () +"Returns, for strings, a query based on what is supported by +the available version of Tree-sitter for java." + (condition-case nil + (progn (treesit-query-capture 'java '((text_block) @font-lock-string-face)) + `((string_literal) @font-lock-string-face + (text_block) @font-lock-string-face)) + (error + `((string_literal) @font-lock-string-face)))) + (defvar java-ts-mode--font-lock-settings (treesit-font-lock-rules :language 'java @@ -182,8 +192,7 @@ java-ts-mode--font-lock-settings :language 'java :override t :feature 'string - `((string_literal) @font-lock-string-face - (text_block) @font-lock-string-face) + (java-ts-mode--string-highlight-helper) :language 'java :override t :feature 'literal commit 6fe9075ff3814ce825c9869c901903edad9d0b44 Author: kobarity Date: Sun Mar 5 17:07:17 2023 +0900 Revert workaround introduced in Bug#56271 * lisp/progmodes/python.el (python-nav-end-of-statement) (python-nav-end-of-block): Revert workaround introduced in Bug#56271 as the bug is fixedin Bug#58780. diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index ccf78e13148..5b11d204de1 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -2062,10 +2062,6 @@ python-nav-end-of-statement ;; are somehow out of whack. This has been ;; observed when using `syntax-ppss' during ;; narrowing. - ;; It can also fail in cases where the buffer is in - ;; the process of being modified, e.g. when creating - ;; a string with `electric-pair-mode' disabled such - ;; that there can be an unmatched single quote (when (>= string-start last-string-end) (goto-char string-start) (if (python-syntax-context 'paren) @@ -2154,10 +2150,7 @@ python-nav-end-of-block (while (and (forward-line 1) (not (eobp)) (or (and (> (current-indentation) block-indentation) - (let ((start (point))) - (python-nav-end-of-statement) - ;; must move forward otherwise infinite loop - (> (point) start))) + (or (python-nav-end-of-statement) t)) (python-info-current-line-comment-p) (python-info-current-line-empty-p)))) (python-util-forward-comment -1) commit f175141aeade5d6795d22d40c1eb001c6ba49025 Author: kobarity Date: Sun Mar 5 17:06:26 2023 +0900 Fix searching for end of string in python-nav-end-of-statement * lisp/progmodes/python.el (python-nav-end-of-statement): Add searching for corresponding string-quote. * test/lisp/progmodes/python-tests.el (python-nav-end-of-statement-3) (python-nav-end-of-statement-4, python-info-current-defun-4): New tests. (Bug#58780) diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 630250c15c3..ccf78e13148 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -2076,10 +2076,16 @@ python-nav-end-of-statement (goto-char (+ (point) (python-syntax-count-quotes (char-after (point)) (point)))) - (setq last-string-end - (or (re-search-forward - (rx (syntax string-delimiter)) nil t) - (goto-char (point-max))))))) + (setq + last-string-end + (or (if (eq t (nth 3 (syntax-ppss))) + (re-search-forward + (rx (syntax string-delimiter)) nil t) + (ignore-error scan-error + (goto-char string-start) + (python-nav--lisp-forward-sexp) + (point))) + (goto-char (point-max))))))) ((python-syntax-context 'paren) ;; The statement won't end before we've escaped ;; at least one level of parenthesis. diff --git a/test/lisp/progmodes/python-tests.el b/test/lisp/progmodes/python-tests.el index 6928e313dc4..7e2f66e9095 100644 --- a/test/lisp/progmodes/python-tests.el +++ b/test/lisp/progmodes/python-tests.el @@ -2955,6 +2955,36 @@ python-nav-end-of-statement-2 "'\n''\n" (python-nav-end-of-statement))) +(ert-deftest python-nav-end-of-statement-3 () + "Test unmatched quotes (Bug#58780)." + (python-tests-with-temp-buffer + " +' \"\"\" +v = 1 +" + (python-tests-look-at "v =") + (should (= (save-excursion + (python-nav-end-of-statement) + (point)) + (save-excursion + (point-max)))))) + +(ert-deftest python-nav-end-of-statement-4 () + (python-tests-with-temp-buffer + " +abc = 'a\\ +b\\ +c' +d = '''d''' +" + (python-tests-look-at "b\\") + (should (= (save-excursion + (python-nav-end-of-statement) + (point)) + (save-excursion + (python-tests-look-at "c'") + (pos-eol)))))) + (ert-deftest python-nav-forward-statement-1 () (python-tests-with-temp-buffer " @@ -5221,6 +5251,20 @@ python-info-current-defun-3 (should (string= (python-info-current-defun t) "def decoratorFunctionWithArguments")))) +(ert-deftest python-info-current-defun-4 () + "Ensure unmatched quotes do not cause hang (Bug#58780)." + (python-tests-with-temp-buffer + " +def func(): + ' \"\"\" + v = 1 +" + (python-tests-look-at "v = 1") + (should (string= (python-info-current-defun) + "func")) + (should (string= (python-info-current-defun t) + "def func")))) + (ert-deftest python-info-current-symbol-1 () (python-tests-with-temp-buffer "