Merge from origin/emacs-29
78b83a744f
; * etc/NEWS: Rearrange instructions for building tree-si...fb82d4e328
(treesit-simple-indent-presets): Have n-p-gp check for gr...25ddb3f7d9
; ruby-ts--indent-rules: Minor cleanupa0ce569d3b
ruby-toggle-block: Fix in ruby-ts-mode0d3b6518e3
(ruby-ts--indent-rules): Indent inside empty parens properly7fb69ce233
; * doc/emacs/modes.texi (Choosing Modes): Add index entr... # Conflicts: # etc/NEWS
This commit is contained in:
commit
0f9cf31ccd
6 changed files with 49 additions and 32 deletions
|
@ -429,8 +429,11 @@ For example, one element normally found in the list has the form
|
|||
@code{(@t{"\\.c\\'"} . c-mode)}, and it is responsible for selecting C
|
||||
mode for files whose names end in @file{.c}. (Note that @samp{\\} is
|
||||
needed in Lisp syntax to include a @samp{\} in the string, which must
|
||||
be used to suppress the special meaning of @samp{.} in regexps.) If
|
||||
the element has the form @w{@code{(@var{regexp} @var{mode-function}
|
||||
be used to suppress the special meaning of @samp{.} in regexps.)
|
||||
|
||||
@cindex backup files, choosing a major mode
|
||||
@cindex encrypted files, choosing a major mode
|
||||
If the element has the form @w{@code{(@var{regexp} @var{mode-function}
|
||||
@var{flag})}} and @var{flag} is non-@code{nil}, then after calling
|
||||
@var{mode-function} (if it is non-@code{nil}), Emacs discards the
|
||||
suffix that matched @var{regexp} and searches the list again for
|
||||
|
|
36
etc/NEWS.29
36
etc/NEWS.29
|
@ -53,29 +53,31 @@ yourself. Many libraries can be downloaded from the tree-sitter site:
|
|||
|
||||
https://github.com/tree-sitter
|
||||
|
||||
To compile such a library, compile the files "scanner.c" and "parser.c"
|
||||
(sometimes named "scanner.cc" and "parser.cc") in the "src" subdirectory
|
||||
of the library's source tree using the C or C++ compiler, then link
|
||||
these two files into a shared library named "libtree-sitter-LANG.so",
|
||||
where LANG is the name of the language supported by the grammar as it
|
||||
is expected by the Emacs major mode (for example, "c" for 'c-ts-mode',
|
||||
"cpp" for 'c++-ts-mode', "python" for 'python-ts-mode', etc.). Then place
|
||||
the shared library you've built in the same directory where you keep
|
||||
the other shared libraries used by Emacs, or in the "tree-sitter"
|
||||
subdirectory of your 'user-emacs-directory', or in a directory
|
||||
mentioned in the variable 'treesit-extra-load-path'.
|
||||
|
||||
You only need to install language grammar libraries required by the
|
||||
Emacs modes you will use, as Emacs loads these libraries only when the
|
||||
corresponding mode is turned on in some buffer for the first time in
|
||||
an Emacs session.
|
||||
|
||||
Emacs provides a user command, 'treesit-install-language-grammar',
|
||||
that automates the download and build process of a grammar library.
|
||||
It prompts for the language, the URL of the language grammar's VCS
|
||||
repository, and then uses the installed C/C++ compiler to build the
|
||||
library and install it.
|
||||
|
||||
You can also do this manually. To compile such a library after
|
||||
cloning its Git repository, compile the files "scanner.c" and
|
||||
"parser.c" (sometimes named "scanner.cc" and "parser.cc") in the "src"
|
||||
subdirectory of the library's source tree using the C or C++ compiler,
|
||||
then link these two files into a shared library named
|
||||
"libtree-sitter-LANG.so", where LANG is the name of the language
|
||||
supported by the grammar as it is expected by the Emacs major mode
|
||||
(for example, "c" for 'c-ts-mode', "cpp" for 'c++-ts-mode', "python"
|
||||
for 'python-ts-mode', etc.). Then place the shared library you've
|
||||
built in the same directory where you keep the other shared libraries
|
||||
used by Emacs, or in the "tree-sitter" subdirectory of your
|
||||
'user-emacs-directory', or in a directory mentioned in the variable
|
||||
'treesit-extra-load-path'.
|
||||
|
||||
You only need to install language grammar libraries required by the
|
||||
Emacs modes you will use, as Emacs loads these libraries only when the
|
||||
corresponding mode is turned on in some buffer for the first time in
|
||||
an Emacs session.
|
||||
|
||||
+++
|
||||
** Emacs can be built with built-in support for accessing SQLite databases.
|
||||
This uses the popular sqlite3 library, and can be disabled by using
|
||||
|
|
|
@ -1927,7 +1927,7 @@ If the result is do-end block, it will always be multiline."
|
|||
(end-of-line)
|
||||
(unless
|
||||
(if (and (re-search-backward "\\(?:[^#]\\)\\({\\)\\|\\(\\_<do\\_>\\)")
|
||||
(progn
|
||||
(let ((ruby-use-smie (and ruby-use-smie (consp smie-grammar))))
|
||||
(goto-char (or (match-beginning 1) (match-beginning 2)))
|
||||
(setq beg (point))
|
||||
(with-suppressed-warnings ((obsolete ruby-forward-sexp))
|
||||
|
|
|
@ -648,9 +648,6 @@ a statement container is a node that matches
|
|||
parent 0)
|
||||
((match "\\." "call") parent ruby-indent-level)
|
||||
|
||||
;; ruby-indent-after-block-in-continued-expression
|
||||
((match "begin" "assignment") parent ruby-indent-level)
|
||||
|
||||
;; method parameters -- four styles:
|
||||
;; 1) With paren, first arg on same line:
|
||||
((and (query "(method_parameters \"(\" _ @indent)")
|
||||
|
@ -680,7 +677,9 @@ a statement container is a node that matches
|
|||
((and (query "(argument_list \"(\" _ @indent)")
|
||||
(node-is ")"))
|
||||
ruby-ts--parent-call-or-bol 0)
|
||||
((query "(argument_list \"(\" _ @indent)")
|
||||
((or (query "(argument_list \"(\" _ @indent)")
|
||||
;; No arguments yet; NODE is nil in that case.
|
||||
(match "\\`\\'" "argument_list"))
|
||||
ruby-ts--parent-call-or-bol ruby-indent-level)
|
||||
;; 3) No paren, ruby-parenless-call-arguments-indent is t
|
||||
((and ruby-ts--parenless-call-arguments-indent-p (parent-is "argument_list"))
|
||||
|
@ -704,10 +703,9 @@ a statement container is a node that matches
|
|||
;; ruby-mode does not touch these...
|
||||
((match "bare_string" "string_array") no-indent 0)
|
||||
|
||||
;; hash and array other than assignments. Note that the
|
||||
;; first sibling is the "{" or "[". There is a special
|
||||
;; case where the hash is an argument to a method. These
|
||||
;; need to be processed first.
|
||||
;; hash and array. Note that the first sibling is the "{"
|
||||
;; or "[". There is a special case where the hash is an
|
||||
;; argument to a method. These need to be processed first.
|
||||
|
||||
((and ruby-ts--same-line-hash-array-p (match "}" "hash"))
|
||||
first-sibling 0)
|
||||
|
|
|
@ -1102,10 +1102,12 @@ See `treesit-simple-indent-presets'.")
|
|||
(string-match-p
|
||||
parent-t (treesit-node-type parent)))
|
||||
(or (null grand-parent-t)
|
||||
(string-match-p
|
||||
grand-parent-t
|
||||
(treesit-node-type
|
||||
(treesit-node-parent parent))))))))
|
||||
(and
|
||||
(treesit-node-parent parent)
|
||||
(string-match-p
|
||||
grand-parent-t
|
||||
(treesit-node-type
|
||||
(treesit-node-parent parent)))))))))
|
||||
(cons 'no-node (lambda (node &rest _) (null node)))
|
||||
(cons 'parent-is (lambda (type)
|
||||
(lambda (_n parent &rest _)
|
||||
|
|
|
@ -110,6 +110,18 @@ The whitespace before and including \"|\" on each line is removed."
|
|||
| 42
|
||||
| end")))
|
||||
|
||||
|
||||
(ert-deftest ruby-ts-indent-call-no-args ()
|
||||
(skip-unless (treesit-ready-p 'ruby t))
|
||||
(ruby-ts-with-temp-buffer
|
||||
"variable = foo(
|
||||
|
||||
)"
|
||||
(goto-char (point-min))
|
||||
(forward-line 1)
|
||||
(funcall indent-line-function)
|
||||
(should (= (current-indentation) ruby-indent-level))))
|
||||
|
||||
(ert-deftest ruby-ts-add-log-current-method-examples ()
|
||||
(skip-unless (treesit-ready-p 'ruby t))
|
||||
(let ((pairs '(("foo" . "#foo")
|
||||
|
|
Loading…
Add table
Reference in a new issue