Merge from origin/emacs-29

e8c77d9abd Fix hfy-exclude-file-rules (bug#60562)
c1d32d9a20 CC Mode: Prevent ids in temporary "declarators" getting i...
140824dc09 ; Fix more quoting in w32fns.c.
f367ba3ed0 ; Avoid byte-compiler warning in eglot.el
1b458aced7 ; * lisp/progmodes/eglot.el: Remove stray space.
7c8eac8fbc ; * src/w32fns.c: Fix quoting.  Patch by Arash Esbati <ar...
67df34c143 Fix M-x eglot prompt when connection already exists (bug#...
3d1e74c82a Fix tree-sitter indent preset function (bug#60270)
352e41016b ruby-ts-mode: Support the option ruby-block-indent
44c9cb8653 Improve indentation for jsx
82ae9caadd * lisp/subr.el (while-let): Fix docs if-let->if-let* (bug...
f16bd1ead4 Revert "* lisp/subr.el (while-let): Use if-let, not if-le...
c8d5480972 Bump use-package version for Emacs 29.1
This commit is contained in:
Stefan Kangas 2023-01-17 06:30:08 +01:00
commit bb383a5491
13 changed files with 98 additions and 51 deletions

View file

@ -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

View file

@ -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

View file

@ -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.

View file

@ -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"

View file

@ -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)))

View file

@ -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

View file

@ -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))))))

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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
*/

View file

@ -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 ()

View file

@ -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)