emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 4a5335158dd 1/2: Merge from origin/emacs-29


From: Stefan Kangas
Subject: master 4a5335158dd 1/2: Merge from origin/emacs-29
Date: Wed, 1 Mar 2023 00:45:18 -0500 (EST)

branch: master
commit 4a5335158dd7e38beeccd315cbda3a0f53708d08
Merge: 5b037331f6a 97a83ff31fa
Author: Stefan Kangas <stefankangas@gmail.com>
Commit: Stefan Kangas <stefankangas@gmail.com>

    Merge from origin/emacs-29
    
    97a83ff31fa Eglot: fix M-x eglot-show-workspace-configuration (bug#61...
    48a0804d10d ruby-mode: Fix method call indentation in rhs of multiple...
    16d012cf3bd * lisp/net/tramp.el (tramp-remote-path): Improve docstring.
    b371697cdca Minor change in 'dired--find-possibly-alternative-file'
    c2b5c6acc58 Implement prefix arg for 'c-ts-mode-toggle-comment-style'
    eb2ab52fb01 Defaults to zero for image-dired--number-of-thumbnails
    5dc163f592a ; Add a doc string for 'ediff-window-display-p' obsolescence
---
 lisp/dired.el                                   |  3 +-
 lisp/image/image-dired.el                       |  2 +-
 lisp/net/tramp.el                               |  4 +-
 lisp/progmodes/c-ts-mode.el                     | 22 +++++----
 lisp/progmodes/eglot.el                         | 66 ++++++++++++-------------
 lisp/progmodes/ruby-mode.el                     | 13 +++--
 lisp/vc/ediff-init.el                           |  5 +-
 test/lisp/progmodes/ruby-mode-resources/ruby.rb |  5 ++
 8 files changed, 67 insertions(+), 53 deletions(-)

diff --git a/lisp/dired.el b/lisp/dired.el
index 76499d0f520..55a5bbd9800 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))
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)
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 633086fc822..1b434a726a1 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -1370,7 +1370,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)
diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el
index 8122115c102..abe929bd777 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
diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index 0a3189a0263..bee86a38bb0 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 ()
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/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)
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 @@ if something == :==
   )
 end
 
+# Bug#61871
+foo, bar = baz.(
+  some_arg
+)
+
 # Bug#17097
 if x == :!=
   something



reply via email to

[Prev in Thread] Current Thread [Next in Thread]