emacs-diffs
[Top][All Lists]
Advanced

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

master bb383a5491: Merge from origin/emacs-29


From: Stefan Kangas
Subject: master bb383a5491: Merge from origin/emacs-29
Date: Tue, 17 Jan 2023 00:45:15 -0500 (EST)

branch: master
commit bb383a54910c3094e5d228e0af62bf70e36203ca
Merge: 0bb8a011d5 e8c77d9abd
Author: Stefan Kangas <stefankangas@gmail.com>
Commit: Stefan Kangas <stefankangas@gmail.com>

    Merge from origin/emacs-29
    
    e8c77d9abda Fix hfy-exclude-file-rules (bug#60562)
    c1d32d9a20d CC Mode: Prevent ids in temporary "declarators" getting i...
    140824dc099 ; Fix more quoting in w32fns.c.
    f367ba3ed03 ; Avoid byte-compiler warning in eglot.el
    1b458aced72 ; * lisp/progmodes/eglot.el: Remove stray space.
    7c8eac8fbcb ; * src/w32fns.c: Fix quoting.  Patch by Arash Esbati <ar...
    67df34c143d Fix M-x eglot prompt when connection already exists (bug#...
    3d1e74c82a8 Fix tree-sitter indent preset function (bug#60270)
    352e41016bc ruby-ts-mode: Support the option ruby-block-indent
    44c9cb8653d Improve indentation for jsx
    82ae9caaddb * lisp/subr.el (while-let): Fix docs if-let->if-let* (bug...
    f16bd1ead43 Revert "* lisp/subr.el (while-let): Use if-let, not if-le...
    c8d54809727 Bump use-package version for Emacs 29.1
---
 lisp/htmlfontify.el                                | 14 +++++-----
 lisp/progmodes/cc-engine.el                        |  8 +++++-
 lisp/progmodes/eglot.el                            | 24 ++++++++--------
 lisp/progmodes/js.el                               | 15 ++++++----
 lisp/progmodes/ruby-ts-mode.el                     | 32 ++++++++++++++++++----
 lisp/progmodes/typescript-ts-mode.el               | 14 ++++++----
 lisp/subr.el                                       |  6 ++--
 lisp/treesit.el                                    |  1 -
 lisp/use-package/use-package-core.el               |  2 +-
 lisp/use-package/use-package.el                    |  2 +-
 src/w32fns.c                                       | 16 +++++------
 .../lisp/progmodes/c-ts-mode-resources/indent.erts | 14 ++++++++++
 test/lisp/progmodes/ruby-ts-mode-tests.el          |  1 +
 13 files changed, 98 insertions(+), 51 deletions(-)

diff --git a/lisp/htmlfontify.el b/lisp/htmlfontify.el
index 0959405081..1ab33cc641 100644
--- a/lisp/htmlfontify.el
+++ b/lisp/htmlfontify.el
@@ -373,13 +373,13 @@ otherwise."
   :type  '(string))
 
 (defcustom hfy-exclude-file-rules
-  '("\\.flc$"
-    "/CVS/.*"
-    ".*~$"
-    "/\\.git\\(?:/.*\\)?$")
-  "Define some regular expressions to exclude files"
+  '("\\.flc\\'"
+    "/CVS/"
+    "~\\'"
+    "/\\.git\\(?:/\\|\\'\\)")
+  "Regular expressions matching files to exclude."
   :tag "exclude-rules"
-  :type '(list string)
+  :type '(repeat regexp)
   :version "29.1")
 
 (defcustom hfy-display-class nil
@@ -1835,7 +1835,7 @@ Strips any leading \"./\" from each filename."
                       (seq-some (lambda (r)
                                   (string-match r f))
                                 hfy-exclude-file-rules)))
-                (directory-files-recursively "." ".*" nil t)))
+                (directory-files-recursively "." "" nil t)))
 
 ;; strip the filename off, return a directory name
 ;; not a particularly thorough implementation, but it will be
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index 8ac3ef6808..45d90ea243 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -10863,7 +10863,13 @@ This function might do hidden buffer changes."
                      ;; types; other identifiers could just as well be
                      ;; constants in C++.
                      (memq at-type '(known found)))))
-                  (throw 'at-decl-or-cast t)
+                  (progn
+                    ;; The user may be part way through typing a statement
+                    ;; beginning with an identifier.  This makes a 'maybe
+                    ;; type in the following "declarator"'s arglist suspect.
+                    (when (eq at-type 'maybe)
+                      (setq unsafe-maybe t))
+                    (throw 'at-decl-or-cast t))
                 ;; CASE 7
                 ;; Can't be a valid declaration or cast, but if we've found a
                 ;; specifier it can't be anything else either, so treat it as
diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index a846baa1b1..8ce1a8b7ba 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -1075,7 +1075,7 @@ suitable root directory for a given LSP server's 
purposes."
 
 ;;;###autoload
 (defun eglot (managed-major-mode project class contact language-id
-                                 &optional interactive)
+                                 &optional _interactive)
   "Start LSP server in support of PROJECT's buffers under MANAGED-MAJOR-MODE.
 
 This starts a Language Server Protocol (LSP) server suitable for the
@@ -1112,17 +1112,17 @@ described in `eglot-server-programs', which see.
 LANGUAGE-ID is the language ID string to send to the server for
 MANAGED-MAJOR-MODE, which matters to a minority of servers.
 
-INTERACTIVE is t if called interactively."
-  (interactive (append (eglot--guess-contact t) '(t)))
-  (setq managed-major-mode (eglot--ensure-list managed-major-mode))
-  (let* ((current-server (eglot-current-server))
-         (live-p (and current-server (jsonrpc-running-p current-server))))
-    (if (and live-p
-             interactive
-             (y-or-n-p "[eglot] Live process found, reconnect instead? "))
-        (eglot-reconnect current-server interactive)
-      (when live-p (ignore-errors (eglot-shutdown current-server)))
-      (eglot--connect managed-major-mode project class contact language-id))))
+INTERACTIVE is ignored and provided for backward compatibility."
+  (interactive
+   (let ((current-server (eglot-current-server)))
+     (unless (or (null current-server)
+                 (y-or-n-p "\
+[eglot] Shut down current connection before attempting new one?"))
+       (user-error "[eglot] Connection attempt aborted by user."))
+     (prog1 (append (eglot--guess-contact t) '(t))
+       (when current-server (ignore-errors (eglot-shutdown current-server))))))
+  (eglot--connect (eglot--ensure-list managed-major-mode)
+                  project class contact language-id))
 
 (defun eglot-reconnect (server &optional interactive)
   "Reconnect to SERVER.
diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el
index fa3b4687ef..28305a0b39 100644
--- a/lisp/progmodes/js.el
+++ b/lisp/progmodes/js.el
@@ -3454,13 +3454,16 @@ This function is intended for use in 
`after-change-functions'."
        ((parent-is "statement_block") parent-bol js-indent-level)
 
        ;; JSX
-       ((node-is "jsx_fragment") parent typescript-ts-mode-indent-offset)
-       ((node-is "jsx_element") parent typescript-ts-mode-indent-offset)
-       ((node-is "jsx_expression") parent typescript-ts-mode-indent-offset)
-       ((node-is "jsx_self_closing_element") parent 
typescript-ts-mode-indent-offset)
+       ((match "<" "jsx_fragment") parent 0)
+       ((parent-is "jsx_fragment") parent js-indent-level)
        ((node-is "jsx_closing_element") parent 0)
-       ((node-is "/") parent 0)
-       ((node-is ">") parent 0)))))
+       ((node-is "jsx_element") parent js-indent-level)
+       ((parent-is "jsx_element") parent js-indent-level)
+       ((parent-is "jsx_opening_element") parent js-indent-level)
+       ((parent-is "jsx_expression") parent-bol js-indent-level)
+       ((match "/" "jsx_self_closing_element") parent 0)
+       ((parent-is "jsx_self_closing_element") parent js-indent-level)
+       (no-node parent-bol 0)))))
 
 (defvar js--treesit-keywords
   '("as" "async" "await" "break" "case" "catch" "class" "const" "continue"
diff --git a/lisp/progmodes/ruby-ts-mode.el b/lisp/progmodes/ruby-ts-mode.el
index d68b57966b..939c054b04 100644
--- a/lisp/progmodes/ruby-ts-mode.el
+++ b/lisp/progmodes/ruby-ts-mode.el
@@ -780,12 +780,20 @@ i.e. expr of def foo(args) = expr is returned."
            ;; but with node set to the statement and parent set to
            ;; body_statement for all others. ... Fine.  Be that way.
            ;; Ditto for "block" and "block_body"
-           ((node-is "body_statement") parent-bol ruby-indent-level)
-           ((parent-is "body_statement") (ruby-ts--bol 
ruby-ts--grand-parent-node) ruby-indent-level)
-           ((match "end" "do_block") parent-bol 0)
-           ((n-p-gp "block_body" "block" nil) parent-bol ruby-indent-level)
-           ((n-p-gp nil "block_body" "block") (ruby-ts--bol 
ruby-ts--grand-parent-node) ruby-indent-level)
-           ((match "}" "block") parent-bol 0)
+           ((node-is "body_statement")
+            (ruby-ts--block-indent-anchor ruby-ts--parent-node)
+            ruby-indent-level)
+           ((parent-is "body_statement")
+            (ruby-ts--block-indent-anchor ruby-ts--grand-parent-node)
+            ruby-indent-level)
+           ((match "end" "do_block") (ruby-ts--block-indent-anchor 
ruby-ts--parent-node) 0)
+           ((n-p-gp "block_body" "block" nil)
+            (ruby-ts--block-indent-anchor ruby-ts--parent-node)
+            ruby-indent-level)
+           ((n-p-gp nil "block_body" "block")
+            (ruby-ts--block-indent-anchor ruby-ts--grand-parent-node)
+            ruby-indent-level)
+           ((match "}" "block") (ruby-ts--block-indent-anchor 
ruby-ts--parent-node) 0)
 
            ;; Chained strings
            ((match "string" "chained_string") first-sibling 0)
@@ -794,6 +802,18 @@ i.e. expr of def foo(args) = expr is returned."
            (catch-all parent-bol ruby-indent-level))))
     `((ruby . ,common))))
 
+(defun ruby-ts--block-indent-anchor (block-node-getter)
+  (lambda (node parent _bol &rest _rest)
+    (let ((block-node (funcall block-node-getter node parent)))
+      (save-excursion
+        (goto-char
+         (treesit-node-start
+          (if ruby-block-indent
+              (ruby-ts--statement-ancestor block-node)
+            block-node)))
+        (back-to-indentation)
+        (point)))))
+
 (defun ruby-ts--class-or-module-p (node)
   "Predicate if NODE is a class or module."
   (string-match-p ruby-ts--class-or-module-regex (treesit-node-type node)))
diff --git a/lisp/progmodes/typescript-ts-mode.el 
b/lisp/progmodes/typescript-ts-mode.el
index cd631d048e..f7bf7ed7e4 100644
--- a/lisp/progmodes/typescript-ts-mode.el
+++ b/lisp/progmodes/typescript-ts-mode.el
@@ -97,13 +97,15 @@ Argument LANGUAGE is either `typescript' or `tsx'."
      ((parent-is "binary_expression") parent-bol 
typescript-ts-mode-indent-offset)
 
      ,@(when (eq language 'tsx)
-         `(((node-is "jsx_fragment") parent typescript-ts-mode-indent-offset)
-           ((node-is "jsx_element") parent typescript-ts-mode-indent-offset)
-           ((node-is "jsx_expression") parent typescript-ts-mode-indent-offset)
-           ((node-is "jsx_self_closing_element") parent 
typescript-ts-mode-indent-offset)
+         `(((match "<" "jsx_fragment") parent 0)
+           ((parent-is "jsx_fragment") parent typescript-ts-mode-indent-offset)
            ((node-is "jsx_closing_element") parent 0)
-           ((node-is "/") parent 0)
-           ((node-is ">") parent 0)))
+           ((node-is "jsx_element") parent typescript-ts-mode-indent-offset)
+           ((parent-is "jsx_element") parent typescript-ts-mode-indent-offset)
+           ((parent-is "jsx_opening_element") parent 
typescript-ts-mode-indent-offset)
+           ((parent-is "jsx_expression") parent-bol 
typescript-ts-mode-indent-offset)
+           ((match "/" "jsx_self_closing_element") parent 0)
+           ((parent-is "jsx_self_closing_element") parent 
typescript-ts-mode-indent-offset)))
      (no-node parent-bol 0))))
 
 (defvar typescript-ts-mode--keywords
diff --git a/lisp/subr.el b/lisp/subr.el
index 1762c94a43..f909b63aab 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -2562,12 +2562,14 @@ The variable list SPEC is the same as in `if-let'."
 Evaluate each binding in turn, stopping if a binding value is nil.
 If all bindings are non-nil, eval BODY and repeat.
 
-The variable list SPEC is the same as in `if-let'."
+The variable list SPEC is the same as in `if-let*'."
   (declare (indent 1) (debug if-let))
   (let ((done (gensym "done")))
     `(catch ',done
        (while t
-         (if-let ,spec
+         ;; This is `if-let*', not `if-let', deliberately, despite the
+         ;; name of this macro.  See bug#60758.
+         (if-let* ,spec
              (progn
                ,@body)
            (throw ',done nil))))))
diff --git a/lisp/treesit.el b/lisp/treesit.el
index e9f5a8b37b..69bfff21df 100644
--- a/lisp/treesit.el
+++ b/lisp/treesit.el
@@ -1152,7 +1152,6 @@ See `treesit-simple-indent-presets'.")
                     (and (>= (point) comment-start-bol)
                          adaptive-fill-regexp
                          (looking-at adaptive-fill-regexp)
-                         (> (match-end 0) (match-beginning 0))
                          (match-end 0))))))
         ;; TODO: Document.
         (cons 'grand-parent
diff --git a/lisp/use-package/use-package-core.el 
b/lisp/use-package/use-package-core.el
index 379e119b60..7ab5bdc276 100644
--- a/lisp/use-package/use-package-core.el
+++ b/lisp/use-package/use-package-core.el
@@ -65,7 +65,7 @@
   :link '(custom-manual "(use-package) Top")
   :version "29.1")
 
-(defconst use-package-version "2.4.4"
+(defconst use-package-version "2.4.5"
   "This version of `use-package'.")
 
 (defcustom use-package-keywords
diff --git a/lisp/use-package/use-package.el b/lisp/use-package/use-package.el
index 7682468522..1b63a6d651 100644
--- a/lisp/use-package/use-package.el
+++ b/lisp/use-package/use-package.el
@@ -5,7 +5,7 @@
 ;; Author: John Wiegley <johnw@newartisans.com>
 ;; Maintainer: John Wiegley <johnw@newartisans.com>
 ;; Created: 17 Jun 2012
-;; Version: 2.4.4
+;; Version: 2.4.5
 ;; Package-Requires: ((emacs "24.3") (bind-key "2.4"))
 ;; Keywords: dotemacs startup speed config package extensions
 ;; URL: https://github.com/jwiegley/use-package
diff --git a/src/w32fns.c b/src/w32fns.c
index 192d3ddf27..b4192a5ffa 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -10396,8 +10396,8 @@ to be converted to forward slashes by the caller.  */)
 #endif /* WINDOWSNT */
 
 /* Query a value from the Windows Registry (under HKCU and HKLM),
-   where `key` is the registry key, `name` is the name, and `lpdwtype`
-   is a pointer to the return value's type. `lpwdtype` can be NULL if
+   where `key' is the registry key, `name' is the name, and `lpdwtype'
+   is a pointer to the return value's type. `lpwdtype' can be NULL if
    you do not care about the type.
 
    Returns: pointer to the value, or null pointer if the key/name does
@@ -10664,7 +10664,7 @@ pops up the Windows Run dialog, <lwindow>-<Pause> pops 
up the "System
 Properties" dialog, etc.  On Windows 10, no \"Windows\" key
 combinations are normally handed to applications.  To enable Emacs to
 process \"Windows\" key combinations, use the function
-`w32-register-hot-key`.
+`w32-register-hot-key'.
 
 For Windows 98/ME, see the doc string of `w32-phantom-key-code'.  */);
   Vw32_pass_lwindow_to_system = Qt;
@@ -10683,7 +10683,7 @@ pops up the Windows Run dialog, <rwindow>-<Pause> pops 
up the "System
 Properties" dialog, etc.  On Windows 10, no \"Windows\" key
 combinations are normally handed to applications.  To enable Emacs to
 process \"Windows\" key combinations, use the function
-`w32-register-hot-key`.
+`w32-register-hot-key'.
 
 For Windows 98/ME, see the doc string of `w32-phantom-key-code'.  */);
   Vw32_pass_rwindow_to_system = Qt;
@@ -10698,7 +10698,7 @@ acting on \"Windows\" key events when 
`w32-pass-lwindow-to-system' or
 `w32-pass-rwindow-to-system' is nil.
 
 This variable is only used on Windows 98 and ME.  For other Windows
-versions, see the documentation of the `w32-register-hot-key`
+versions, see the documentation of the `w32-register-hot-key'
 function.  */);
   /* Although 255 is technically not a valid key code, it works and
      means that this hack won't interfere with any real key code.  */
@@ -10732,7 +10732,7 @@ The value can be hyper, super, meta, alt, control or 
shift for the
 respective modifier, or nil to appear as the `lwindow' key.
 Any other value will cause the key to be ignored.
 
-Also see the documentation of the `w32-register-hot-key` function.  */);
+Also see the documentation of the `w32-register-hot-key' function.  */);
   Vw32_lwindow_modifier = Qnil;
 
   DEFVAR_LISP ("w32-rwindow-modifier",
@@ -10742,7 +10742,7 @@ The value can be hyper, super, meta, alt, control or 
shift for the
 respective modifier, or nil to appear as the `rwindow' key.
 Any other value will cause the key to be ignored.
 
-Also see the documentation of the `w32-register-hot-key` function.  */);
+Also see the documentation of the `w32-register-hot-key' function.  */);
   Vw32_rwindow_modifier = Qnil;
 
   DEFVAR_LISP ("w32-apps-modifier",
@@ -11271,7 +11271,7 @@ globals_of_w32fns (void)
     get_proc_addr (hm_kernel32, "SetThreadDescription");
 
   /* Support OS dark mode on Windows 10 version 1809 and higher.
-     See `w32_applytheme` which uses appropriate APIs per version of Windows.
+     See `w32_applytheme' which uses appropriate APIs per version of Windows.
      For future wretches who may need to understand Windows build numbers:
      
https://docs.microsoft.com/en-us/windows/release-health/release-information
   */
diff --git a/test/lisp/progmodes/c-ts-mode-resources/indent.erts 
b/test/lisp/progmodes/c-ts-mode-resources/indent.erts
index 71524e273f..70fce68b0e 100644
--- a/test/lisp/progmodes/c-ts-mode-resources/indent.erts
+++ b/test/lisp/progmodes/c-ts-mode-resources/indent.erts
@@ -133,6 +133,20 @@ Name: Multiline Block Comments 4 (bug#60270)
  */
 =-=-=
 
+Name: Multiline Block Comments 5 (bug#60270)
+
+=-=
+/*
+line one
+line 2
+ */
+=-=
+/*
+  line one
+  line 2
+ */
+=-=-=
+
 
 Code:
   (lambda ()
diff --git a/test/lisp/progmodes/ruby-ts-mode-tests.el 
b/test/lisp/progmodes/ruby-ts-mode-tests.el
index b2c990f8e5..eaf6367a30 100644
--- a/test/lisp/progmodes/ruby-ts-mode-tests.el
+++ b/test/lisp/progmodes/ruby-ts-mode-tests.el
@@ -251,6 +251,7 @@ The whitespace before and including \"|\" on each line is 
removed."
          (kill-buffer buf)))))
 
 (ruby-ts-deftest-indent "ruby-method-params-indent.rb")
+(ruby-ts-deftest-indent "ruby-block-indent.rb")
 
 (provide 'ruby-ts-mode-tests)
 



reply via email to

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