1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

Merge from origin/emacs-29

0d98fac6bb (ruby-ts-add-log-current-function): Fix when between two ...
da69f116bf ; * doc/lispref/positions.texi (List Motion): Minor wordi...
0b0eae0bf7 ; Improve documentation of 'treesit-language-source-alist'
ae0d218d0b ; * etc/NEWS: Mention treesit-install-language-grammar.
de3df3bc51 * lisp/vc/vc-git.el (vc-git-checkin): Pass vc-git-diff-sw...

# Conflicts:
#	etc/NEWS
This commit is contained in:
Stefan Kangas 2023-01-04 06:30:13 +01:00
commit 1ddd31bf98
7 changed files with 35 additions and 6 deletions

View file

@ -852,7 +852,7 @@ matches either @code{"function_definition"} or @code{"class_definition"}.
@end defvar
@defvar treesit-defun-tactic
This variable determines how does Emacs treat nested defuns. If the
This variable determines how Emacs treats nested defuns. If the
value is @code{top-level}, navigation functions only move across
top-level defuns, if the value is @code{nested}, navigation functions
recognize nested defuns.

View file

@ -68,6 +68,12 @@ 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.
+++
** Emacs can be built with built-in support for accessing SQLite databases.
This uses the popular sqlite3 library, and can be disabled by using

View file

@ -850,7 +850,12 @@ The hash (#) is for instance methods only which are methods
dot (.) is used. Double colon (::) is used between classes. The
leading double colon is not added."
(let* ((node (treesit-node-at (point)))
(method (treesit-parent-until node (ruby-ts--type-pred ruby-ts--method-regex)))
(method-pred
(lambda (node)
(and (<= (treesit-node-start node) (point))
(>= (treesit-node-end node) (point))
(string-match-p ruby-ts--method-regex (treesit-node-type node)))))
(method (treesit-parent-until node method-pred t))
(class (or method node))
(result nil)
(sep "#")

View file

@ -2671,7 +2671,7 @@ CC and C++ are C and C++ compilers, defaulting to \"cc\" and
\"c++\", respectively.")
(defun treesit--install-language-grammar-build-recipe (lang)
"Interactively build a recipe for LANG and return it.
"Interactively produce a download/build recipe for LANG and return it.
See `treesit-language-source-alist' for details."
(when (y-or-n-p (format "There is no recipe for %s, do you want to build it interactively?" lang))
(cl-labels ((empty-string-to-nil (string)
@ -2693,9 +2693,14 @@ See `treesit-language-source-alist' for details."
(read-string
"Enter the C++ compiler to use (default: auto-detect): "))))))
;;;###autoload
(defun treesit-install-language-grammar (lang)
"Build and install the tree-sitter language grammar library for LANG.
Interactively, if `treesit-language-source-alist' doesn't already
have data for building the grammar for LANG, prompt for its
repository URL and the C/C++ compiler to use.
This command requires Git, a C compiler and (sometimes) a C++ compiler,
and the linker to be installed and on PATH. It also requires that the
recipe for LANG exists in `treesit-language-source-alist'.

View file

@ -1036,6 +1036,8 @@ It is based on `log-edit-mode', and has Git-specific extensions."
(let ((vc-git-patch-string patch-string))
(vc-git-checkin nil comment)))
(autoload 'vc-switches "vc")
(defun vc-git-checkin (files comment &optional _rev)
(let* ((file1 (or (car files) default-directory))
(root (vc-git-root file1))
@ -1078,7 +1080,14 @@ It is based on `log-edit-mode', and has Git-specific extensions."
;; want to commit any changes to that file, we need to
;; stash those changes before committing.
(with-temp-buffer
(vc-git-command (current-buffer) t nil "diff" "--cached")
;; If the user has switches like -D, -M etc. in their
;; `vc-git-diff-switches', we must pass them here too, or
;; our string matches will fail.
(if vc-git-diff-switches
(apply #'vc-git-command (current-buffer) t nil
"diff" "--cached" (vc-switches 'git 'diff))
;; Following code doesn't understand plain diff(1) output.
(user-error "Cannot commit patch with nil `vc-git-diff-switches'"))
(goto-char (point-min))
(let ((pos (point)) file-name file-header file-diff file-beg)
(while (not (eobp))
@ -1410,8 +1419,6 @@ This prompts for a branch to merge from."
:type 'boolean
:version "26.1")
(autoload 'vc-switches "vc")
(defun vc-git-print-log (files buffer &optional shortlog start-revision limit)
"Print commit log associated with FILES into specified BUFFER.
If SHORTLOG is non-nil, use a short format based on `vc-git-root-log-format'.

View file

@ -537,9 +537,12 @@ VALUES-PLIST is a list with alternating index and value elements."
| def foo
| end
| _
| def bar
| end
| end
|end")
(search-backward "_")
(delete-char 1)
(should (string= (ruby-add-log-current-method)"M::C"))))
(ert-deftest ruby-add-log-current-method-in-singleton-class ()

View file

@ -141,9 +141,12 @@ The whitespace before and including \"|\" on each line is removed."
| def foo
| end
| _
| def bar
| end
| end
|end")
(search-backward "_")
(delete-char 1)
(should (string= (ruby-ts-add-log-current-function) "M::C"))))
(ert-deftest ruby-ts-add-log-current-method-in-singleton-class ()