From 5dc163f592a779f759fc0b259dd4f4b50678655c Mon Sep 17 00:00:00 2001 From: Eli Zaretskii Date: Tue, 28 Feb 2023 15:15:27 +0200 Subject: [PATCH 1/7] ; Add a doc string for 'ediff-window-display-p' obsolescence * lisp/vc/ediff-init.el (ediff-window-display-p): Document how to prevent Ediff from creating additional frames, now that this function can no longer be used or advised for that. (Bug#61850) --- lisp/vc/ediff-init.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lisp/vc/ediff-init.el b/lisp/vc/ediff-init.el index d78f9ad9f36..28630792211 100644 --- a/lisp/vc/ediff-init.el +++ b/lisp/vc/ediff-init.el @@ -1527,7 +1527,10 @@ This default should work without changes." (define-obsolete-function-alias 'ediff-convert-standard-filename #'convert-standard-filename "28.1") (define-obsolete-function-alias 'ediff-hide-face #'ignore "28.1") (define-obsolete-function-alias 'ediff-file-remote-p #'file-remote-p "29.1") -(define-obsolete-function-alias 'ediff-window-display-p #'display-graphic-p "29.1") +(define-obsolete-function-alias 'ediff-window-display-p #'display-graphic-p "29.1" + "To prevent Ediff from creating frames, see `ediff-window-setup-function'. +Set it to `ediff-setup-windows-plain' to do everything in a single frame, +even on GUI terminal.") (define-obsolete-function-alias 'ediff-mouse-event-p #'mouse-event-p "29.1") (provide 'ediff-init) From eb2ab52fb0180daa792d4b7ff290f348fef12115 Mon Sep 17 00:00:00 2001 From: Manuel Giraud Date: Thu, 23 Feb 2023 16:42:48 +0100 Subject: [PATCH 2/7] Defaults to zero for image-dired--number-of-thumbnails * lisp/image/image-dired.el (image-dired--number-of-thumbnails): Defaults zero to avoid wrong type argument error. (Bug#61734) --- lisp/image/image-dired.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/image/image-dired.el b/lisp/image/image-dired.el index 8e2a75a418f..6ecb307ce12 100644 --- a/lisp/image/image-dired.el +++ b/lisp/image/image-dired.el @@ -546,7 +546,7 @@ Restore any changes to the window configuration made by calling (t (image-dired-line-up-dynamic)))) -(defvar-local image-dired--number-of-thumbnails nil) +(defvar-local image-dired--number-of-thumbnails 0) ;;;###autoload (defun image-dired-display-thumbs (&optional arg append do-not-pop) From c2b5c6acc586cc6a2e66e23a6208045d456ae41a Mon Sep 17 00:00:00 2001 From: Felix Date: Mon, 27 Feb 2023 16:15:02 +0100 Subject: [PATCH 3/7] Implement prefix arg for 'c-ts-mode-toggle-comment-style' * lisp/progmodes/c-ts-mode.el (c-ts-mode-toggle-comment-style): Actually implement the optional numeric arg mentioned in the docstring. Copyright-paperwork-exempt: yes --- lisp/progmodes/c-ts-mode.el | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el index 4b66824c44f..53f7839e4af 100644 --- a/lisp/progmodes/c-ts-mode.el +++ b/lisp/progmodes/c-ts-mode.el @@ -88,19 +88,23 @@ :safe 'integerp :group 'c) -(defun c-ts-mode-toggle-comment-style () +(defun c-ts-mode-toggle-comment-style (&optional arg) "Toggle the comment style between block and line comments. Optional numeric ARG, if supplied, switches to block comment style when positive, to line comment style when negative, and just toggles it when zero or left out." - (interactive) - (pcase-let ((`(,starter . ,ender) - (if (string= comment-start "// ") - (cons "/* " " */") - (cons "// " "")))) - (setq-local comment-start starter - comment-end ender)) - (c-ts-mode-set-modeline)) + (interactive "P") + (let ((prevstate-line (string= comment-start "// "))) + (when (or (not arg) + (zerop (setq arg (prefix-numeric-value arg))) + (xor (> 0 arg) prevstate-line)) + (pcase-let ((`(,starter . ,ender) + (if prevstate-line + (cons "/* " " */") + (cons "// " "")))) + (setq-local comment-start starter + comment-end ender)) + (c-ts-mode-set-modeline)))) (defun c-ts-mode-set-modeline () (setq mode-name From b371697cdca6069378c713ac8e36ec98b06c5cc3 Mon Sep 17 00:00:00 2001 From: Felix Date: Sun, 26 Feb 2023 14:14:59 +0100 Subject: [PATCH 4/7] Minor change in 'dired--find-possibly-alternative-file' * lisp/dired.el (dired--find-possibly-alternative-file): Don't kill the buffer if the directory is shown in other windows. Copyright-paperwork-exempt: yes --- lisp/dired.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/dired.el b/lisp/dired.el index 2bcb28a0e00..4a4ecc901c4 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -2728,7 +2728,8 @@ directory in another window." (defun dired--find-possibly-alternative-file (file) "Find FILE, but respect `dired-kill-when-opening-new-dired-buffer'." (if (and dired-kill-when-opening-new-dired-buffer - (file-directory-p file)) + (file-directory-p file) + (< (length (get-buffer-window-list)) 2)) (progn (set-buffer-modified-p nil) (dired--find-file #'find-alternate-file file)) From 16d012cf3bd788bc622b00936ad0786128085316 Mon Sep 17 00:00:00 2001 From: Michael Albinus Date: Tue, 28 Feb 2023 16:42:11 +0100 Subject: [PATCH 5/7] * lisp/net/tramp.el (tramp-remote-path): Improve docstring. --- lisp/net/tramp.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index eaddc36b54a..b24bd33de82 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -1372,7 +1372,9 @@ special value `tramp-default-remote-path'. `Private Directories' are the settings of the $PATH environment, as given in your `~/.profile'. This entry is represented in -the list by the special value `tramp-own-remote-path'." +the list by the special value `tramp-own-remote-path'. + +For a full discussion, see Info node `(tramp) Remote programs'." :group 'tramp :type '(repeat (choice (const :tag "Default Directories" tramp-default-remote-path) From 48a0804d10d02c2aa94664e0db8315239950225f Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Tue, 28 Feb 2023 23:00:42 +0200 Subject: [PATCH 6/7] ruby-mode: Fix method call indentation in rhs of multiple assignment * lisp/progmodes/ruby-mode.el (ruby-smie-rules): Special-case assignment that follows a comma-separated list (bug#61871). * test/lisp/progmodes/ruby-mode-resources/ruby.rb: Add case. --- lisp/progmodes/ruby-mode.el | 13 ++++++++----- test/lisp/progmodes/ruby-mode-resources/ruby.rb | 5 +++++ 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el index 559b62fef54..beccb8182a7 100644 --- a/lisp/progmodes/ruby-mode.el +++ b/lisp/progmodes/ruby-mode.el @@ -916,11 +916,14 @@ This only affects the output of the command `ruby-toggle-block'." (smie-indent--hanging-p)) ruby-indent-level))) (`(:before . "=") - (save-excursion - (and (smie-rule-parent-p " @ ") - (goto-char (nth 1 (smie-indent--parent))) - (smie-rule-prev-p "def=") - (cons 'column (+ (current-column) ruby-indent-level -3))))) + (or + (save-excursion + (and (smie-rule-parent-p " @ ") + (goto-char (nth 1 (smie-indent--parent))) + (smie-rule-prev-p "def=") + (cons 'column (+ (current-column) ruby-indent-level -3)))) + (and (smie-rule-parent-p ",") + (smie-rule-parent)))) (`(:after . ,(or "?" ":")) (if ruby-after-operator-indent ruby-indent-level diff --git a/test/lisp/progmodes/ruby-mode-resources/ruby.rb b/test/lisp/progmodes/ruby-mode-resources/ruby.rb index 3f0dfdf68ba..81d0dfd75c9 100644 --- a/test/lisp/progmodes/ruby-mode-resources/ruby.rb +++ b/test/lisp/progmodes/ruby-mode-resources/ruby.rb @@ -163,6 +163,11 @@ def test2 (arg) ) end +# Bug#61871 +foo, bar = baz.( + some_arg +) + # Bug#17097 if x == :!= something From 97a83ff31fa9e3e2455d3168a789649dcd20a635 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20T=C3=A1vora?= Date: Wed, 1 Mar 2023 01:22:15 +0000 Subject: [PATCH 7/7] Eglot: fix M-x eglot-show-workspace-configuration (bug#61866) Now consult .dir-locals.el every time the workspace configuration is needed: - workspace/configuration server request - workspace/didChangeConfiguration signal - M-x eglot-show-workspace-configuration The major-mode/hack-dir-local-variables-non-file-buffer trick is used. When there is more than one, the server connection's "main" major mode is used to find the relevant .dir-locals.el section. * lisp/progmodes/eglot.el (eglot--lookup-mode): Fix docstring. (eglot--connect): Simplify. (eglot-show-workspace-configuration): Fix. (eglot--workspace-configuration): Remove. (eglot--workspace-configuration-plist): Rework. (eglot-handle-request): Simplify. --- lisp/progmodes/eglot.el | 66 +++++++++++++++++++---------------------- 1 file changed, 31 insertions(+), 35 deletions(-) diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index ffc9511469f..40fc8f8a12f 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -961,7 +961,7 @@ PRESERVE-BUFFERS as in `eglot-shutdown', which see." "Lookup `eglot-server-programs' for MODE. Return (MANAGED-MODES LANGUAGE-ID CONTACT-PROXY). -MANAGED-MODES is a list with MODE as its first elements. +MANAGED-MODES is a list with MODE as its first element. Subsequent elements are other major modes also potentially managed by the server that is to manage MODE. @@ -1335,10 +1335,7 @@ This docstring appeases checkdoc, that's all." (lambda () (setf (eglot--inhibit-autoreconnect server) (null eglot-autoreconnect))))))) - (let ((default-directory (project-root project)) - (major-mode (car managed-modes))) - (hack-dir-local-variables-non-file-buffer) - (run-hook-with-args 'eglot-connect-hook server)) + (run-hook-with-args 'eglot-connect-hook server) (eglot--message "Connected! Server `%s' now managing `%s' buffers \ in project `%s'." @@ -2444,9 +2441,7 @@ format described above.") (defun eglot-show-workspace-configuration (&optional server) "Dump `eglot-workspace-configuration' as JSON for debugging." - (interactive (list (and (eglot-current-server) - (eglot--read-server "Server configuration" - (eglot-current-server))))) + (interactive (list (eglot--read-server "Show workspace configuration for" t))) (let ((conf (eglot--workspace-configuration-plist server))) (with-current-buffer (get-buffer-create "*EGLOT workspace configuration*") (erase-buffer) @@ -2457,14 +2452,23 @@ format described above.") (json-pretty-print-buffer)) (pop-to-buffer (current-buffer))))) -(defun eglot--workspace-configuration (server) - (if (functionp eglot-workspace-configuration) - (funcall eglot-workspace-configuration server) - eglot-workspace-configuration)) - -(defun eglot--workspace-configuration-plist (server) - "Returns `eglot-workspace-configuration' suitable for serialization." - (let ((val (eglot--workspace-configuration server))) +(defun eglot--workspace-configuration-plist (server &optional path) + "Returns SERVER's workspace configuration as a plist. +If PATH consider that file's `file-name-directory' to get the +local value of the `eglot-workspace-configuration' variable, else +use the root of SERVER's `eglot--project'." + (let ((val (with-temp-buffer + (setq default-directory + (if path + (file-name-directory path) + (project-root (eglot--project server)))) + ;; Set the major mode to be the first of the managed + ;; modes. This is the one the user started eglot in. + (setq major-mode (car (eglot--major-modes server))) + (hack-dir-local-variables-non-file-buffer)() + (if (functionp eglot-workspace-configuration) + (funcall eglot-workspace-configuration server) + eglot-workspace-configuration)))) (or (and (consp (car val)) (cl-loop for (section . v) in val collect (if (keywordp section) section @@ -2489,25 +2493,17 @@ When called interactively, use the currently active server" (apply #'vector (mapcar (eglot--lambda ((ConfigurationItem) scopeUri section) - (with-temp-buffer - (let* ((uri-path (eglot--uri-to-path scopeUri)) - (default-directory - (if (and uri-path - (not (string-empty-p uri-path)) - (file-directory-p uri-path)) - (file-name-as-directory uri-path) - (project-root (eglot--project server))))) - (setq-local major-mode (car (eglot--major-modes server))) - (hack-dir-local-variables-non-file-buffer) - (cl-loop for (wsection o) - on (eglot--workspace-configuration-plist server) - by #'cddr - when (string= - (if (keywordp wsection) - (substring (symbol-name wsection) 1) - wsection) - section) - return o)))) + (cl-loop + with scope-uri-path = (and scopeUri (eglot--uri-to-path scopeUri)) + for (wsection o) + on (eglot--workspace-configuration-plist server scope-uri-path) + by #'cddr + when (string= + (if (keywordp wsection) + (substring (symbol-name wsection) 1) + wsection) + section) + return o)) items))) (defun eglot--signal-textDocument/didChange ()