diff options
| author | Stefan Kangas | 2023-01-04 06:30:13 +0100 |
|---|---|---|
| committer | Stefan Kangas | 2023-01-04 06:30:13 +0100 |
| commit | 1ddd31bf9843c0453af92a09f98935cfcbb4e250 (patch) | |
| tree | 169886ea0c3694832b5db6e355240a1bc4639435 | |
| parent | 0e1b03bbb87d0b09ba841c0318fce77533914208 (diff) | |
| parent | 0d98fac6bbc19c7728d42d6196adf4d392ba3132 (diff) | |
| download | emacs-1ddd31bf9843c0453af92a09f98935cfcbb4e250.tar.gz emacs-1ddd31bf9843c0453af92a09f98935cfcbb4e250.zip | |
Merge from origin/emacs-29
0d98fac6bbc (ruby-ts-add-log-current-function): Fix when between two ...
da69f116bfc ; * doc/lispref/positions.texi (List Motion): Minor wordi...
0b0eae0bf76 ; Improve documentation of 'treesit-language-source-alist'
ae0d218d0b3 ; * etc/NEWS: Mention treesit-install-language-grammar.
de3df3bc51e * lisp/vc/vc-git.el (vc-git-checkin): Pass vc-git-diff-sw...
# Conflicts:
# etc/NEWS
| -rw-r--r-- | doc/lispref/positions.texi | 2 | ||||
| -rw-r--r-- | etc/NEWS.29 | 6 | ||||
| -rw-r--r-- | lisp/progmodes/ruby-ts-mode.el | 7 | ||||
| -rw-r--r-- | lisp/treesit.el | 7 | ||||
| -rw-r--r-- | lisp/vc/vc-git.el | 13 | ||||
| -rw-r--r-- | test/lisp/progmodes/ruby-mode-tests.el | 3 | ||||
| -rw-r--r-- | test/lisp/progmodes/ruby-ts-mode-tests.el | 3 |
7 files changed, 35 insertions, 6 deletions
diff --git a/doc/lispref/positions.texi b/doc/lispref/positions.texi index f47720184a3..f3824436246 100644 --- a/doc/lispref/positions.texi +++ b/doc/lispref/positions.texi | |||
| @@ -852,7 +852,7 @@ matches either @code{"function_definition"} or @code{"class_definition"}. | |||
| 852 | @end defvar | 852 | @end defvar |
| 853 | 853 | ||
| 854 | @defvar treesit-defun-tactic | 854 | @defvar treesit-defun-tactic |
| 855 | This variable determines how does Emacs treat nested defuns. If the | 855 | This variable determines how Emacs treats nested defuns. If the |
| 856 | value is @code{top-level}, navigation functions only move across | 856 | value is @code{top-level}, navigation functions only move across |
| 857 | top-level defuns, if the value is @code{nested}, navigation functions | 857 | top-level defuns, if the value is @code{nested}, navigation functions |
| 858 | recognize nested defuns. | 858 | recognize nested defuns. |
diff --git a/etc/NEWS.29 b/etc/NEWS.29 index 355ba6ba8aa..38a8798507a 100644 --- a/etc/NEWS.29 +++ b/etc/NEWS.29 | |||
| @@ -68,6 +68,12 @@ Emacs modes you will use, as Emacs loads these libraries only when the | |||
| 68 | corresponding mode is turned on in some buffer for the first time in | 68 | corresponding mode is turned on in some buffer for the first time in |
| 69 | an Emacs session. | 69 | an Emacs session. |
| 70 | 70 | ||
| 71 | Emacs provides a user command, 'treesit-install-language-grammar', | ||
| 72 | that automates the download and build process of a grammar library. | ||
| 73 | It prompts for the language, the URL of the language grammar's VCS | ||
| 74 | repository, and then uses the installed C/C++ compiler to build the | ||
| 75 | library and install it. | ||
| 76 | |||
| 71 | +++ | 77 | +++ |
| 72 | ** Emacs can be built with built-in support for accessing SQLite databases. | 78 | ** Emacs can be built with built-in support for accessing SQLite databases. |
| 73 | This uses the popular sqlite3 library, and can be disabled by using | 79 | This uses the popular sqlite3 library, and can be disabled by using |
diff --git a/lisp/progmodes/ruby-ts-mode.el b/lisp/progmodes/ruby-ts-mode.el index c086214a11d..5c173ad24c7 100644 --- a/lisp/progmodes/ruby-ts-mode.el +++ b/lisp/progmodes/ruby-ts-mode.el | |||
| @@ -850,7 +850,12 @@ The hash (#) is for instance methods only which are methods | |||
| 850 | dot (.) is used. Double colon (::) is used between classes. The | 850 | dot (.) is used. Double colon (::) is used between classes. The |
| 851 | leading double colon is not added." | 851 | leading double colon is not added." |
| 852 | (let* ((node (treesit-node-at (point))) | 852 | (let* ((node (treesit-node-at (point))) |
| 853 | (method (treesit-parent-until node (ruby-ts--type-pred ruby-ts--method-regex))) | 853 | (method-pred |
| 854 | (lambda (node) | ||
| 855 | (and (<= (treesit-node-start node) (point)) | ||
| 856 | (>= (treesit-node-end node) (point)) | ||
| 857 | (string-match-p ruby-ts--method-regex (treesit-node-type node))))) | ||
| 858 | (method (treesit-parent-until node method-pred t)) | ||
| 854 | (class (or method node)) | 859 | (class (or method node)) |
| 855 | (result nil) | 860 | (result nil) |
| 856 | (sep "#") | 861 | (sep "#") |
diff --git a/lisp/treesit.el b/lisp/treesit.el index bcdc9daeac5..e141f872c73 100644 --- a/lisp/treesit.el +++ b/lisp/treesit.el | |||
| @@ -2671,7 +2671,7 @@ CC and C++ are C and C++ compilers, defaulting to \"cc\" and | |||
| 2671 | \"c++\", respectively.") | 2671 | \"c++\", respectively.") |
| 2672 | 2672 | ||
| 2673 | (defun treesit--install-language-grammar-build-recipe (lang) | 2673 | (defun treesit--install-language-grammar-build-recipe (lang) |
| 2674 | "Interactively build a recipe for LANG and return it. | 2674 | "Interactively produce a download/build recipe for LANG and return it. |
| 2675 | See `treesit-language-source-alist' for details." | 2675 | See `treesit-language-source-alist' for details." |
| 2676 | (when (y-or-n-p (format "There is no recipe for %s, do you want to build it interactively?" lang)) | 2676 | (when (y-or-n-p (format "There is no recipe for %s, do you want to build it interactively?" lang)) |
| 2677 | (cl-labels ((empty-string-to-nil (string) | 2677 | (cl-labels ((empty-string-to-nil (string) |
| @@ -2693,9 +2693,14 @@ See `treesit-language-source-alist' for details." | |||
| 2693 | (read-string | 2693 | (read-string |
| 2694 | "Enter the C++ compiler to use (default: auto-detect): ")))))) | 2694 | "Enter the C++ compiler to use (default: auto-detect): ")))))) |
| 2695 | 2695 | ||
| 2696 | ;;;###autoload | ||
| 2696 | (defun treesit-install-language-grammar (lang) | 2697 | (defun treesit-install-language-grammar (lang) |
| 2697 | "Build and install the tree-sitter language grammar library for LANG. | 2698 | "Build and install the tree-sitter language grammar library for LANG. |
| 2698 | 2699 | ||
| 2700 | Interactively, if `treesit-language-source-alist' doesn't already | ||
| 2701 | have data for building the grammar for LANG, prompt for its | ||
| 2702 | repository URL and the C/C++ compiler to use. | ||
| 2703 | |||
| 2699 | This command requires Git, a C compiler and (sometimes) a C++ compiler, | 2704 | This command requires Git, a C compiler and (sometimes) a C++ compiler, |
| 2700 | and the linker to be installed and on PATH. It also requires that the | 2705 | and the linker to be installed and on PATH. It also requires that the |
| 2701 | recipe for LANG exists in `treesit-language-source-alist'. | 2706 | recipe for LANG exists in `treesit-language-source-alist'. |
diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el index 7a34357811e..7689d5f879f 100644 --- a/lisp/vc/vc-git.el +++ b/lisp/vc/vc-git.el | |||
| @@ -1036,6 +1036,8 @@ It is based on `log-edit-mode', and has Git-specific extensions." | |||
| 1036 | (let ((vc-git-patch-string patch-string)) | 1036 | (let ((vc-git-patch-string patch-string)) |
| 1037 | (vc-git-checkin nil comment))) | 1037 | (vc-git-checkin nil comment))) |
| 1038 | 1038 | ||
| 1039 | (autoload 'vc-switches "vc") | ||
| 1040 | |||
| 1039 | (defun vc-git-checkin (files comment &optional _rev) | 1041 | (defun vc-git-checkin (files comment &optional _rev) |
| 1040 | (let* ((file1 (or (car files) default-directory)) | 1042 | (let* ((file1 (or (car files) default-directory)) |
| 1041 | (root (vc-git-root file1)) | 1043 | (root (vc-git-root file1)) |
| @@ -1078,7 +1080,14 @@ It is based on `log-edit-mode', and has Git-specific extensions." | |||
| 1078 | ;; want to commit any changes to that file, we need to | 1080 | ;; want to commit any changes to that file, we need to |
| 1079 | ;; stash those changes before committing. | 1081 | ;; stash those changes before committing. |
| 1080 | (with-temp-buffer | 1082 | (with-temp-buffer |
| 1081 | (vc-git-command (current-buffer) t nil "diff" "--cached") | 1083 | ;; If the user has switches like -D, -M etc. in their |
| 1084 | ;; `vc-git-diff-switches', we must pass them here too, or | ||
| 1085 | ;; our string matches will fail. | ||
| 1086 | (if vc-git-diff-switches | ||
| 1087 | (apply #'vc-git-command (current-buffer) t nil | ||
| 1088 | "diff" "--cached" (vc-switches 'git 'diff)) | ||
| 1089 | ;; Following code doesn't understand plain diff(1) output. | ||
| 1090 | (user-error "Cannot commit patch with nil `vc-git-diff-switches'")) | ||
| 1082 | (goto-char (point-min)) | 1091 | (goto-char (point-min)) |
| 1083 | (let ((pos (point)) file-name file-header file-diff file-beg) | 1092 | (let ((pos (point)) file-name file-header file-diff file-beg) |
| 1084 | (while (not (eobp)) | 1093 | (while (not (eobp)) |
| @@ -1410,8 +1419,6 @@ This prompts for a branch to merge from." | |||
| 1410 | :type 'boolean | 1419 | :type 'boolean |
| 1411 | :version "26.1") | 1420 | :version "26.1") |
| 1412 | 1421 | ||
| 1413 | (autoload 'vc-switches "vc") | ||
| 1414 | |||
| 1415 | (defun vc-git-print-log (files buffer &optional shortlog start-revision limit) | 1422 | (defun vc-git-print-log (files buffer &optional shortlog start-revision limit) |
| 1416 | "Print commit log associated with FILES into specified BUFFER. | 1423 | "Print commit log associated with FILES into specified BUFFER. |
| 1417 | If SHORTLOG is non-nil, use a short format based on `vc-git-root-log-format'. | 1424 | If SHORTLOG is non-nil, use a short format based on `vc-git-root-log-format'. |
diff --git a/test/lisp/progmodes/ruby-mode-tests.el b/test/lisp/progmodes/ruby-mode-tests.el index 9687231dbfa..8a75c83d2c3 100644 --- a/test/lisp/progmodes/ruby-mode-tests.el +++ b/test/lisp/progmodes/ruby-mode-tests.el | |||
| @@ -537,9 +537,12 @@ VALUES-PLIST is a list with alternating index and value elements." | |||
| 537 | | def foo | 537 | | def foo |
| 538 | | end | 538 | | end |
| 539 | | _ | 539 | | _ |
| 540 | | def bar | ||
| 541 | | end | ||
| 540 | | end | 542 | | end |
| 541 | |end") | 543 | |end") |
| 542 | (search-backward "_") | 544 | (search-backward "_") |
| 545 | (delete-char 1) | ||
| 543 | (should (string= (ruby-add-log-current-method)"M::C")))) | 546 | (should (string= (ruby-add-log-current-method)"M::C")))) |
| 544 | 547 | ||
| 545 | (ert-deftest ruby-add-log-current-method-in-singleton-class () | 548 | (ert-deftest ruby-add-log-current-method-in-singleton-class () |
diff --git a/test/lisp/progmodes/ruby-ts-mode-tests.el b/test/lisp/progmodes/ruby-ts-mode-tests.el index aa1ab1e2605..b2c990f8e56 100644 --- a/test/lisp/progmodes/ruby-ts-mode-tests.el +++ b/test/lisp/progmodes/ruby-ts-mode-tests.el | |||
| @@ -141,9 +141,12 @@ The whitespace before and including \"|\" on each line is removed." | |||
| 141 | | def foo | 141 | | def foo |
| 142 | | end | 142 | | end |
| 143 | | _ | 143 | | _ |
| 144 | | def bar | ||
| 145 | | end | ||
| 144 | | end | 146 | | end |
| 145 | |end") | 147 | |end") |
| 146 | (search-backward "_") | 148 | (search-backward "_") |
| 149 | (delete-char 1) | ||
| 147 | (should (string= (ruby-ts-add-log-current-function) "M::C")))) | 150 | (should (string= (ruby-ts-add-log-current-function) "M::C")))) |
| 148 | 151 | ||
| 149 | (ert-deftest ruby-ts-add-log-current-method-in-singleton-class () | 152 | (ert-deftest ruby-ts-add-log-current-method-in-singleton-class () |