emacs-diffs
[Top][All Lists]
Advanced

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

master 03892d4f7c: Merge from origin/emacs-29


From: Stefan Kangas
Subject: master 03892d4f7c: Merge from origin/emacs-29
Date: Fri, 16 Dec 2022 02:46:51 -0500 (EST)

branch: master
commit 03892d4f7c1253bc1affeedd227eb0a1520de90e
Merge: b52d0147e9 033071692c
Author: Stefan Kangas <stefankangas@gmail.com>
Commit: Stefan Kangas <stefankangas@gmail.com>

    Merge from origin/emacs-29
    
    033071692c7 ; Fix typos
    f4a513344d9 Add lambda_expression-rule to java-ts-mode (bug#60091)
    546aed35434 eglot: Add support for new language server csharp-ls
    cb761eb7ac4 Use the new tree-sitter commands
    037407ad95a Add "function" feature to python-ts-mode (bug#59977)
    fee2efe1b03 Add go-ts-mode and go-mod-ts-mode (Bug#60025)
    e8f7ab67ad1 Add basic support for hideshow in python-ts-mode (bug#60044)
    cac070b23e4 Add "this" keyword to java-ts-mode (bug#60086)
    c8d75046a2f When completing relative project file names, use relative...
    3b618d0e3ed Avoid segfaults due to invalid selected-window's buffer
    
    # Conflicts:
    #       lisp/progmodes/sh-script.el
---
 ChangeLog.2                                        |   2 +-
 ChangeLog.3                                        |  40 +--
 admin/notes/tree-sitter/build-module/batch.sh      |   1 +
 admin/notes/tree-sitter/build-module/build.sh      |   5 +
 doc/lispref/ChangeLog.1                            |   2 +-
 doc/lispref/modes.texi                             |   2 +-
 doc/lispref/sequences.texi                         |   2 +-
 etc/NEWS                                           |   8 +
 lisp/ChangeLog.16                                  |   4 +-
 lisp/ChangeLog.17                                  |   2 +-
 lisp/epa-ks.el                                     |   2 +-
 lisp/gnus/ChangeLog.2                              |   2 +-
 lisp/gnus/ChangeLog.3                              |   2 +-
 lisp/org/ChangeLog.1                               |   2 +-
 lisp/progmodes/c-ts-mode.el                        |  35 +-
 lisp/progmodes/eglot.el                            |   7 +-
 lisp/progmodes/go-ts-mode.el                       | 354 +++++++++++++++++++++
 lisp/progmodes/idlwave.el                          |   2 +-
 lisp/progmodes/java-ts-mode.el                     |   8 +-
 lisp/progmodes/js.el                               |   4 +-
 lisp/progmodes/project.el                          |  10 +-
 lisp/progmodes/python.el                           |  42 ++-
 lisp/progmodes/sh-script.el                        |   2 +
 lisp/simple.el                                     |   7 +-
 lisp/so-long.el                                    |   2 +-
 lisp/startup.el                                    |   2 +-
 lisp/textmodes/toml-ts-mode.el                     |   2 +-
 lisp/treesit.el                                    |  77 +++--
 oldXMenu/ChangeLog.1                               |   2 +-
 src/ChangeLog.12                                   |   2 +-
 src/ChangeLog.13                                   |   2 +-
 src/fns.c                                          |   2 +-
 test/lisp/delim-col-tests.el                       |   2 +-
 test/lisp/emacs-lisp/cconv-tests.el                |   4 +-
 test/lisp/emacs-lisp/checkdoc-tests.el             |  12 +-
 test/lisp/emacs-lisp/find-func-tests.el            |   2 +-
 .../erc/resources/services/auth-source/recon.eld   |   2 +-
 37 files changed, 540 insertions(+), 120 deletions(-)

diff --git a/ChangeLog.2 b/ChangeLog.2
index 143be59c9e..5d4c1afc36 100644
--- a/ChangeLog.2
+++ b/ChangeLog.2
@@ -28676,7 +28676,7 @@
        * lisp/faces.el (set-face-attribute): Don't be fooled too easily
        by a hyphen in a font's name.
 
-       Fix value of posn-at-pont in R2L lines
+       Fix value of posn-at-point in R2L lines
        * src/keyboard.c (Fposn_at_x_y, Fposn_at_point): Allow X pixel
        coordinate of -1, for a newline in a right-to-left line that
        overflowed into the left fringe.
diff --git a/ChangeLog.3 b/ChangeLog.3
index b162f96cb1..4b3507bae3 100644
--- a/ChangeLog.3
+++ b/ChangeLog.3
@@ -14724,7 +14724,7 @@
 
        * lisp/icomplete.el (icomplete-vertical-mode):
        (fido-vertical-mode): Tweak docstring.  Turn on
-       icomplete-mode. and fido-mdoe
+       icomplete-mode. and fido-mode
 
 2021-08-16  Glenn Morris  <rgm@gnu.org>
 
@@ -20654,7 +20654,7 @@
        * lisp/progmodes/cc-engine.el (c-clear-<-pair-props, 
c-clear->-pair-props)
        (c-clear-<-pair-props-if-match-after, 
c-clear->-pair-props-if-match-before)
        (c-forward-<>-arglist-recur):
-       Invalidate caches with c-trunctate-lit-pos-cache.
+       Invalidate caches with c-truncate-lit-pos-cache.
        (c-forward-<>-arglist-recur): If in a matching <...> expression, the < 
has a
        syntax-table property, but the > not, remove that property.
 
@@ -28297,7 +28297,7 @@
 
 2021-04-17  Eli Zaretskii  <eliz@gnu.org>
 
-       * src/emacs.c (load_pdump): Fix compilation on picky-complier platforms.
+       * src/emacs.c (load_pdump): Fix compilation on picky-compiler platforms.
 
 2021-04-17  Daniel Martín  <mardani29@yahoo.es>
 
@@ -29362,7 +29362,7 @@
        Make the function correctly recognize a brace block preceded by an
        introductory line without a parameter list.
 
-       * lisp/progmodes/cc-cmds.el (c-where-wrt-brace-contruct): Reintroduce 
the use
+       * lisp/progmodes/cc-cmds.el (c-where-wrt-brace-construct): Reintroduce 
the use
        of c-beginning-of-decl-1, which was removed some weeks ago, in place of 
a
        c-syntactic-skip-backward.  Reformulate the code generally.
 
@@ -31051,7 +31051,7 @@
 
 2021-03-28  Lars Ingebrigtsen  <larsi@gnus.org>
 
-       Clarify the doc string of plist-memeber and plist-put
+       Clarify the doc string of plist-member and plist-put
 
        * src/fns.c (Fplist_member):
        (Fplist_put): Clarify what comparison function is used for PROP
@@ -35236,7 +35236,7 @@
 
 2021-03-04  Andrea Corallo  <akrl@sdf.org>
 
-       * src/comp.c (hash_native_abi): Account for 
`system-configuraton-options'.
+       * src/comp.c (hash_native_abi): Account for 
`system-configuration-options'.
 
 2021-03-04  Glenn Morris  <rgm@gnu.org>
 
@@ -46491,7 +46491,7 @@
 
        Fix Quit button in dictionary buffer
 
-       * lisp/net/dictionary.el (dictionay-close): Changing the arity of the
+       * lisp/net/dictionary.el (dictionary-close): Changing the arity of the
        function in cc5f2803785c5dc785f09a292313cf799e8d29bb was a mistake.
        Restore it, but mark the argument as unused to avoid a
        wrong-number-of-arguments error when using the Quit button.
@@ -80628,7 +80628,7 @@
 
 2020-05-17  Andrea Corallo  <akrl@sdf.org>
 
-       Fix Garbage Collector for missing calle-saved regs content (Bug#41357)
+       Fix Garbage Collector for missing callee-saved regs content (Bug#41357)
 
        * src/alloc.c (SET_STACK_TOP_ADDRESS): Do not call
        __builtin_unwind_init.
@@ -88998,7 +88998,7 @@
 
 2020-01-19  Stefan Kangas  <stefankangas@gmail.com>
 
-       Make arguments to dired-chage-marks non-optional
+       Make arguments to dired-change-marks non-optional
 
        * lisp/dired.el (dired-change-marks): Make arguments
        non-optional.  (Bug#29842)
@@ -103735,7 +103735,7 @@
 
        Fixes bug#38131.
 
-       This is not the best way to have fido-mdoe emulate that particular bit
+       This is not the best way to have fido-mode emulate that particular bit
        of ido-mode.
 
        This reverts commit 5761a1a3939e23d8e8c725241dd9398a12f191b0.
@@ -118445,7 +118445,7 @@
        internal variable...
        (browse-url-browser-function, browse-url-external-browser): Used
        by these two; the latter of which is a new variable.
-       (browse-url-botton-regexp): New variable.
+       (browse-url-button-regexp): New variable.
        (browse-url-button-map): New keymap.
        (browse-url-button): New face.
        (browse-url-add-buttons): New function to add clickable browse-url
@@ -139023,7 +139023,7 @@
        Add 'breakpoint' to builtins for Python
 
        * lisp/progmodes/python.el (python-font-lock-keywords-level-2)
-       (python-font-lock-keywords-maxiumum-decoration): Add 'breakpoint'
+       (python-font-lock-keywords-maximum-decoration): Add 'breakpoint'
        to the list of builtins, it's new as of Python 3.7.
 
 2019-03-01  Eli Zaretskii  <eliz@gnu.org>
@@ -143055,7 +143055,7 @@
 
 2019-01-05  João Távora  <joaotavora@gmail.com>
 
-       New flymake-supress-zero-counters defcustom
+       New flymake-suppress-zero-counters defcustom
 
        A feature suggested by Yuri Khan <yurivkhan@gmail.com>.
 
@@ -185861,7 +185861,7 @@
        (flymake-start-syntax-check-on-find-file): Obsolete alias for
        flymake-start-on-flymake-mode.
        (flymake-start): Redesign.  Affect the global post-command-hook
-       and local window-configuraiton-change-hook.
+       and local window-configuration-change-hook.
        (flymake--schedule-timer-maybe)
        (flymake-after-change-function, flymake-after-save-hook): Pass
        t to flymake-start.
@@ -190903,7 +190903,7 @@
        (initFrameFromEmacs) [NS_IMPL_COCOA]: Handle ns-appearance and
        ns-transparent-titlebar frame parameters.
        * doc/lispref/frames.texi (Window Management Parameters): Document
-       ns-apperance and ns-transparent-titlebar.
+       ns-appearance and ns-transparent-titlebar.
 
 2017-08-22  Alan Mackenzie  <acm@muc.de>
 
@@ -204016,7 +204016,7 @@
 
 2017-04-02  Michael Albinus  <michael.albinus@gmx.de>
 
-       Apply connecion-local variables for shells
+       Apply connection-local variables for shells
 
        * doc/misc/tramp.texi (Remote processes): Show use of connection-local
        variables.  Don't mention Emacs 23 anymore.
@@ -204027,7 +204027,7 @@
        (connection-local-set-profiles, with-connection-local-profiles):
        Adapt docstring.
 
-       * lisp/shell.el (shell): Apply connecion-local variables.
+       * lisp/shell.el (shell): Apply connection-local variables.
 
 2017-04-01  Evgeni Kolev  <evgenysw@gmail.com>  (tiny change)
 
@@ -206673,7 +206673,7 @@
        * lisp/emacs-lisp/package.el (package-initialize): Check
        `after-init-time' rather than `load-file-name' to decide if
        `package--ensure-init-file' should be called.  Depending on
-       `load-file-name' will fail if the user calls `pacakge-initialize' in
+       `load-file-name' will fail if the user calls `package-initialize' in
        file which is loaded from the init file (Bug#24643, Bug#25819).
 
 2017-02-26  Eli Zaretskii  <eliz@gnu.org>
@@ -229958,7 +229958,7 @@
        Use #' read syntax for functions.
        (file-notify-test05-dir-validity)
        (file-notify-test06-many-events): Simplify directory creation.
-       (file-notify-test09-sufficient-ressources): New test.
+       (file-notify-test09-sufficient-resources): New test.
 
 2016-03-04  Lars Ingebrigtsen  <larsi@gnus.org>
 
@@ -231088,7 +231088,7 @@
        * lisp/gnus/gnus-rfc1843.el: New file for Gnus/rfc1843
        interface functions.
 
-       * lisp/gnus/gnus-rfc1843.el: Move all Gnus-specifig functions to
+       * lisp/gnus/gnus-rfc1843.el: Move all Gnus-specific functions to
        gnus-rfc1843.
 
 2016-02-22  Lars Ingebrigtsen  <larsi@gnus.org>
diff --git a/admin/notes/tree-sitter/build-module/batch.sh 
b/admin/notes/tree-sitter/build-module/batch.sh
index e7ef45cf57..c50b9df37e 100755
--- a/admin/notes/tree-sitter/build-module/batch.sh
+++ b/admin/notes/tree-sitter/build-module/batch.sh
@@ -9,6 +9,7 @@ languages=(
     'c-sharp'
     'dockerfile'
     'go'
+    'go-mod'
     'html'
     'javascript'
     'json'
diff --git a/admin/notes/tree-sitter/build-module/build.sh 
b/admin/notes/tree-sitter/build-module/build.sh
index 4195ea58c3..b6c83ea9b9 100755
--- a/admin/notes/tree-sitter/build-module/build.sh
+++ b/admin/notes/tree-sitter/build-module/build.sh
@@ -26,6 +26,11 @@ case "${lang}" in
     "cmake")
         org="uyha"
         ;;
+    "go-mod")
+        # The parser is called "gomod".
+        lang="gomod"
+        org="camdencheek"
+        ;;
     "typescript")
         sourcedir="tree-sitter-typescript/typescript/src"
         grammardir="tree-sitter-typescript/typescript"
diff --git a/doc/lispref/ChangeLog.1 b/doc/lispref/ChangeLog.1
index 7c7d49967c..82840aed1d 100644
--- a/doc/lispref/ChangeLog.1
+++ b/doc/lispref/ChangeLog.1
@@ -886,7 +886,7 @@
 2014-03-15  Dmitry Gutov  <dgutov@yandex.ru>
 
        * display.texi (Blinking): Update WRT to the new
-       `blink-matchin-paren' behavior.
+       `blink-matching-paren' behavior.
 
 2014-03-14  Martin Rudalics  <rudalics@gmx.at>
 
diff --git a/doc/lispref/modes.texi b/doc/lispref/modes.texi
index c472f9b441..9ff9614a66 100644
--- a/doc/lispref/modes.texi
+++ b/doc/lispref/modes.texi
@@ -5015,7 +5015,7 @@ expression @code{treesit-comment-start} 
(@pxref{Tree-sitter major
 modes, treesit-comment-start}).  This function assumes @var{parent} is
 the comment node.
 
-@item coment-start-skip
+@item comment-start-skip
 This anchor is a function that is called with 3 arguments: @var{node},
 @var{parent}, and @var{bol}, and returns the position after the
 comment-start token and any whitespace characters following that
diff --git a/doc/lispref/sequences.texi b/doc/lispref/sequences.texi
index bc5a4cf24a..58f2703c8b 100644
--- a/doc/lispref/sequences.texi
+++ b/doc/lispref/sequences.texi
@@ -719,7 +719,7 @@ calling @var{function} on the elements in @var{sequence}.
 then with that result and the third element of @var{sequence}, etc.
 @var{function} should be a function of two arguments.
 
-@var{function} is called with two arguments.  @var{intial-value}
+@var{function} is called with two arguments.  @var{initial-value}
 (and then the accumulated value) is used as the first argument, and
 the elements in @var{sequence} are used for the second argument.
 
diff --git a/etc/NEWS b/etc/NEWS
index af7f1050b7..4efa75fce2 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -99,6 +99,14 @@ point is not in a comment or a string.  It is by default 
bound to
 
 * Incompatible Lisp Changes in Emacs 30.1
 
+*** New major mode 'go-ts-mode'.
+A major mode based on the tree-sitter library for editing programs in
+the Go language.  It is auto-enabled for files with the ".go" extension.
+
+*** New major mode 'go-mod-ts-mode'.
+A major mode based on the tree-sitter library for editing "go.mod"
+files.  It is auto-enabled for files which are named "go.mod".
+
 
 * Lisp Changes in Emacs 30.1
 
diff --git a/lisp/ChangeLog.16 b/lisp/ChangeLog.16
index 1d7684be81..ef230bf9ed 100644
--- a/lisp/ChangeLog.16
+++ b/lisp/ChangeLog.16
@@ -4866,7 +4866,7 @@
 2012-10-12  Fabián Ezequiel Gallina  <fgallina@cuca>
 
        * progmodes/python.el (python-mode-map):
-       Replace subtitute-key-definition with proper command remapping.
+       Replace substitute-key-definition with proper command remapping.
        (python-nav--up-list): Fix behavior for blocks on the same level.
 
 2012-10-11  Stefan Monnier  <monnier@iro.umontreal.ca>
@@ -24325,7 +24325,7 @@
        Pass nil for `after-find-file-from-revert-buffer'.
 
        * saveplace.el (save-place-find-file-hook): Use new variable
-       `rever-buffer-in-progress-p', not `after-find-file-from-revert-buffer'.
+       `revert-buffer-in-progress-p', not `after-find-file-from-revert-buffer'.
 
 2011-04-06  Glenn Morris  <rgm@gnu.org>
 
diff --git a/lisp/ChangeLog.17 b/lisp/ChangeLog.17
index c494f43896..57620513e3 100644
--- a/lisp/ChangeLog.17
+++ b/lisp/ChangeLog.17
@@ -25522,7 +25522,7 @@
 
        * textmodes/ispell.el (ispell-add-per-file-word-list):
        Fix `flyspell-correct-word-before-point' error when accepting
-       words and `coment-padding' is an integer by using
+       words and `comment-padding' is an integer by using
        `comment-normalize-vars' (Bug #14214).
 
 2013-04-17  Fabián Ezequiel Gallina  <fgallina@gnu.org>
diff --git a/lisp/epa-ks.el b/lisp/epa-ks.el
index 4c539b56a3..bb64b61b8f 100644
--- a/lisp/epa-ks.el
+++ b/lisp/epa-ks.el
@@ -109,7 +109,7 @@ When all keys have been selected, use 
\\[epa-ks-do-key-to-fetch] to
 actually import the keys.
 
 When called interactively, `epa-ks-mark-key-to-fetch' will always
-add a \"F\" tag.  Non-interactivly the tag must be specified by
+add a \"F\" tag.  Non-interactively the tag must be specified by
 setting the TAG parameter."
   (interactive (list "F"))
   (if (region-active-p)
diff --git a/lisp/gnus/ChangeLog.2 b/lisp/gnus/ChangeLog.2
index fd5fa0542f..4ac69b575f 100644
--- a/lisp/gnus/ChangeLog.2
+++ b/lisp/gnus/ChangeLog.2
@@ -10070,7 +10070,7 @@
        * gnus-group.el (gnus-group-delete-group): Nix the entry in
        gnus-cache-active-hashtb.
 
-       * gnus-agent.el (gnus-agent-mark-unread-afer-downloaded): New variable.
+       * gnus-agent.el (gnus-agent-mark-unread-after-downloaded): New variable.
        (gnus-agent-summary-fetch-group): Use it.
 
        * gnus-msg.el (gnus-debug-files): New variable.
diff --git a/lisp/gnus/ChangeLog.3 b/lisp/gnus/ChangeLog.3
index 3b41e9edc9..8c1073dc8d 100644
--- a/lisp/gnus/ChangeLog.3
+++ b/lisp/gnus/ChangeLog.3
@@ -6032,7 +6032,7 @@
        Make `default' the default, for compatibility with open-network-stream.
        Handle the no-parameter case exactly as open-network-stream, with no
        additional stream processing.  Search plists using plist-get.
-       Explicitly add :end-of-commend parameter if it is missing.
+       Explicitly add :end-of-comment parameter if it is missing.
        (proto-stream-open-default): Rename from
        proto-stream-open-network-only.  Return 'default as the type.
        (proto-stream-open-starttls): Rename from proto-stream-open-network.
diff --git a/lisp/org/ChangeLog.1 b/lisp/org/ChangeLog.1
index f79d8bf674..4f51c6a1eb 100644
--- a/lisp/org/ChangeLog.1
+++ b/lisp/org/ChangeLog.1
@@ -1867,7 +1867,7 @@
 
        * org.el: Use
        `org-define-obsolete-{function,variable}-alias´instead of
-       `define-obsolate{function,variable}-alias´.
+       `define-obsolete-{function,variable}-alias´.
 
        * org-compat.el (user-error): Defalias to `error´ for Emacsen that
        don't have it.
diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el
index 864dfa81c4..c420386853 100644
--- a/lisp/progmodes/c-ts-mode.el
+++ b/lisp/progmodes/c-ts-mode.el
@@ -531,6 +531,27 @@ the subtrees."
       (if (looking-at "\\s<\\|\n")
          (forward-line 1)))))
 
+(defun c-ts-mode--defun-valid-p (node)
+  (if (string-match-p
+       (rx (or "struct_specifier"
+               "enum_specifier"
+               "union_specifier"))
+       (treesit-node-type node))
+      (null
+       (treesit-node-top-level
+        node (rx (or "function_definition"
+                     "type_definition"))))
+    t))
+
+(defun c-ts-mode--defun-skipper ()
+  "Custom defun skipper for `c-ts-mode' and friends.
+Structs in C ends with a semicolon, but the semicolon is not
+considered part of the struct node, so point would stop before
+the semicolon.  This function skips the semicolon."
+  (when (looking-at (rx (* (or " " "\t")) ";"))
+    (goto-char (match-end 0)))
+  (treesit-default-defun-skipper))
+
 (defun c-ts-mode-indent-defun ()
   "Indent the current top-level declaration syntactically.
 
@@ -559,12 +580,14 @@ the subtrees."
 
   ;; Navigation.
   (setq-local treesit-defun-type-regexp
-              (regexp-opt '("function_definition"
-                            "type_definition"
-                            "struct_specifier"
-                            "enum_specifier"
-                            "union_specifier"
-                            "class_specifier")))
+              (cons (regexp-opt '("function_definition"
+                                  "type_definition"
+                                  "struct_specifier"
+                                  "enum_specifier"
+                                  "union_specifier"
+                                  "class_specifier"))
+                    #'c-ts-mode--defun-valid-p))
+  (setq-local treesit-defun-skipper #'c-ts-mode--defun-skipper)
 
   ;; Nodes like struct/enum/union_specifier can appear in
   ;; function_definitions, so we need to find the top-level node.
diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index 9c5a361df7..bb07a06dde 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -211,7 +211,8 @@ chosen (interactively or automatically)."
                                 (elm-mode . ("elm-language-server"))
                                 (mint-mode . ("mint" "ls"))
                                 (kotlin-mode . ("kotlin-language-server"))
-                                ((go-mode go-dot-mod-mode go-dot-work-mode) . 
("gopls"))
+                                ((go-mode go-dot-mod-mode go-dot-work-mode 
go-ts-mode go-mod-ts-mode)
+                                 . ("gopls"))
                                 ((R-mode ess-r-mode) . ("R" "--slave" "-e"
                                                         
"languageserver::run()"))
                                 ((java-mode java-ts-mode) . ("jdtls"))
@@ -240,7 +241,9 @@ chosen (interactively or automatically)."
                                 ((clojure-mode clojurescript-mode 
clojurec-mode)
                                  . ("clojure-lsp"))
                                 ((csharp-mode csharp-ts-mode)
-                                 . ("omnisharp" "-lsp"))
+                                 . ,(eglot-alternatives
+                                     '(("omnisharp" "-lsp")
+                                       ("csharp-ls"))))
                                 (purescript-mode . 
("purescript-language-server" "--stdio"))
                                 ((perl-mode cperl-mode) . ("perl" 
"-MPerl::LanguageServer" "-e" "Perl::LanguageServer::run"))
                                 (markdown-mode . ("marksman" "server")))
diff --git a/lisp/progmodes/go-ts-mode.el b/lisp/progmodes/go-ts-mode.el
new file mode 100644
index 0000000000..124d9b044a
--- /dev/null
+++ b/lisp/progmodes/go-ts-mode.el
@@ -0,0 +1,354 @@
+;;; go-ts-mode.el --- tree-sitter support for Go  -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2022 Free Software Foundation, Inc.
+
+;; Author     : Randy Taylor <dev@rjt.dev>
+;; Maintainer : Randy Taylor <dev@rjt.dev>
+;; Created    : December 2022
+;; Keywords   : go languages tree-sitter
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; GNU Emacs is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+;;
+
+;;; Code:
+
+(require 'treesit)
+(eval-when-compile (require 'rx))
+
+(declare-function treesit-parser-create "treesit.c")
+(declare-function treesit-induce-sparse-tree "treesit.c")
+(declare-function treesit-node-child "treesit.c")
+(declare-function treesit-node-child-by-field-name "treesit.c")
+(declare-function treesit-node-start "treesit.c")
+(declare-function treesit-node-type "treesit.c")
+
+(defcustom go-ts-mode-indent-offset 4
+  "Number of spaces for each indentation step in `go-ts-mode'."
+  :version "29.1"
+  :type 'integer
+  :safe 'integerp
+  :group 'go)
+
+(defvar go-ts-mode--syntax-table
+  (let ((table (make-syntax-table)))
+    (modify-syntax-entry ?+   "."      table)
+    (modify-syntax-entry ?-   "."      table)
+    (modify-syntax-entry ?=   "."      table)
+    (modify-syntax-entry ?%   "."      table)
+    (modify-syntax-entry ?&   "."      table)
+    (modify-syntax-entry ?|   "."      table)
+    (modify-syntax-entry ?^   "."      table)
+    (modify-syntax-entry ?!   "."      table)
+    (modify-syntax-entry ?<   "."      table)
+    (modify-syntax-entry ?>   "."      table)
+    (modify-syntax-entry ?\\  "\\"     table)
+    (modify-syntax-entry ?/   ". 124b" table)
+    (modify-syntax-entry ?*   ". 23"   table)
+    (modify-syntax-entry ?\n  "> b"    table)
+    table)
+  "Syntax table for `go-ts-mode'.")
+
+(defvar go-ts-mode--indent-rules
+  `((go
+     ((node-is ")") parent-bol 0)
+     ((node-is "]") parent-bol 0)
+     ((node-is "}") parent-bol 0)
+     ((node-is "labeled_statement") no-indent)
+     ((parent-is "argument_list") parent-bol go-ts-mode-indent-offset)
+     ((parent-is "block") parent-bol go-ts-mode-indent-offset)
+     ((parent-is "const_declaration") parent-bol go-ts-mode-indent-offset)
+     ((parent-is "default_case") parent-bol go-ts-mode-indent-offset)
+     ((parent-is "expression_case") parent-bol go-ts-mode-indent-offset)
+     ((parent-is "expression_switch_statement") parent-bol 0)
+     ((parent-is "field_declaration_list") parent-bol go-ts-mode-indent-offset)
+     ((parent-is "import_spec_list") parent-bol go-ts-mode-indent-offset)
+     ((parent-is "labeled_statement") parent-bol go-ts-mode-indent-offset)
+     ((parent-is "literal_value") parent-bol go-ts-mode-indent-offset)
+     ((parent-is "type_spec") parent-bol go-ts-mode-indent-offset)
+     ((parent-is "var_declaration") parent-bol go-ts-mode-indent-offset)
+     (no-node parent-bol 0)))
+  "Tree-sitter indent rules for `go-ts-mode'.")
+
+(defvar go-ts-mode--keywords
+  '("break" "case" "chan" "const" "continue" "default" "defer" "else"
+    "fallthrough" "for" "func" "go" "goto" "if" "import" "interface" "map"
+    "package" "range" "return" "select" "struct" "switch" "type" "var")
+  "Go keywords for tree-sitter font-locking.")
+
+(defvar go-ts-mode--operators
+  '("+" "&" "+=" "&=" "&&" "==" "!=" "-" "|" "-=" "|=" "||" "<" "<="
+    "*" "^" "*=" "^=" "<-" ">" ">=" "/" "<<" "/=" "<<=" "++" "=" ":=" "%"
+    ">>" "%=" ">>=" "--" "!"  "..."  "&^" "&^=" "~")
+  "Go operators for tree-sitter font-locking.")
+
+(defvar go-ts-mode--font-lock-settings
+  (treesit-font-lock-rules
+   :language 'go
+   :feature 'bracket
+   '((["(" ")" "[" "]" "{" "}"]) @font-lock-bracket-face)
+
+   :language 'go
+   :feature 'comment
+   '((comment) @font-lock-comment-face)
+
+   :language 'go
+   :feature 'constant
+   '([(false) (iota) (nil) (true)] @font-lock-constant-face
+     (const_declaration
+      (const_spec name: (identifier) @font-lock-constant-face)))
+
+   :language 'go
+   :feature 'delimiter
+   '((["," "." ";" ":"]) @font-lock-delimiter-face)
+
+   :language 'go
+   :feature 'function
+   '((call_expression
+      function: (identifier) @font-lock-function-name-face)
+     (call_expression
+      function: (selector_expression
+                 field: (field_identifier) @font-lock-function-name-face))
+     (function_declaration
+      name: (identifier) @font-lock-function-name-face)
+     (method_declaration
+      name: (field_identifier) @font-lock-function-name-face))
+
+   :language 'go
+   :feature 'keyword
+   `([,@go-ts-mode--keywords] @font-lock-keyword-face)
+
+   :language 'go
+   :feature 'label
+   '((label_name) @font-lock-constant-face)
+
+   :language 'go
+   :feature 'number
+   '([(float_literal)
+      (imaginary_literal)
+      (int_literal)] @font-lock-number-face)
+
+   :language 'go
+   :feature 'string
+   '([(interpreted_string_literal)
+      (raw_string_literal)
+      (rune_literal)] @font-lock-string-face)
+
+   :language 'go
+   :feature 'type
+   '([(package_identifier) (type_identifier)] @font-lock-type-face)
+
+   :language 'go
+   :feature 'variable
+   '((identifier) @font-lock-variable-name-face)
+
+   :language 'go
+   :feature 'escape-sequence
+   :override t
+   '((escape_sequence) @font-lock-escape-face)
+
+   :language 'go
+   :feature 'property
+   :override t
+   '((field_identifier) @font-lock-property-face
+     (keyed_element (_ (identifier) @font-lock-property-face)))
+
+   :language 'go
+   :feature 'error
+   :override t
+   '((ERROR) @font-lock-warning-face))
+  "Tree-sitter font-lock settings for `go-ts-mode'.")
+
+(defun go-ts-mode--imenu ()
+  "Return Imenu alist for the current buffer."
+  (let* ((node (treesit-buffer-root-node))
+         (func-tree (treesit-induce-sparse-tree
+                     node "function_declaration" nil 1000))
+         (type-tree (treesit-induce-sparse-tree
+                     node "type_spec" nil 1000))
+         (func-index (go-ts-mode--imenu-1 func-tree))
+         (type-index (go-ts-mode--imenu-1 type-tree)))
+    (append
+     (when func-index `(("Function" . ,func-index)))
+     (when type-index `(("Type" . ,type-index))))))
+
+(defun go-ts-mode--imenu-1 (node)
+  "Helper for `go-ts-mode--imenu'.
+Find string representation for NODE and set marker, then recurse
+the subtrees."
+  (let* ((ts-node (car node))
+         (children (cdr node))
+         (subtrees (mapcan #'go-ts-mode--imenu-1
+                           children))
+         (name (when ts-node
+                 (treesit-node-text
+                  (pcase (treesit-node-type ts-node)
+                    ("function_declaration"
+                     (treesit-node-child-by-field-name ts-node "name"))
+                    ("type_spec"
+                     (treesit-node-child-by-field-name ts-node "name"))))))
+         (marker (when ts-node
+                   (set-marker (make-marker)
+                               (treesit-node-start ts-node)))))
+    (cond
+     ((or (null ts-node) (null name)) subtrees)
+     (subtrees
+      `((,name ,(cons name marker) ,@subtrees)))
+     (t
+      `((,name . ,marker))))))
+
+;;;###autoload
+(add-to-list 'auto-mode-alist '("\\.go\\'" . go-ts-mode))
+
+;;;###autoload
+(define-derived-mode go-ts-mode prog-mode "Go"
+  "Major mode for editing Go, powered by tree-sitter."
+  :group 'go
+  :syntax-table go-ts-mode--syntax-table
+
+  (when (treesit-ready-p 'go)
+    (treesit-parser-create 'go)
+
+    ;; Comments.
+    (setq-local comment-start "// ")
+    (setq-local comment-end "")
+    (setq-local comment-start-skip (rx "//" (* (syntax whitespace))))
+
+    ;; Imenu.
+    (setq-local imenu-create-index-function #'go-ts-mode--imenu)
+    (setq-local which-func-functions nil)
+
+    ;; Indent.
+    (setq-local indent-tabs-mode t
+                treesit-simple-indent-rules go-ts-mode--indent-rules)
+
+    ;; Font-lock.
+    (setq-local treesit-font-lock-settings go-ts-mode--font-lock-settings)
+    (setq-local treesit-font-lock-feature-list
+                '(( comment)
+                  ( keyword string type)
+                  ( constant escape-sequence function label number
+                    property variable)
+                  ( bracket delimiter error operator)))
+
+    (treesit-major-mode-setup)))
+
+;; go.mod support.
+
+(defvar go-mod-ts-mode--syntax-table
+  (let ((table (make-syntax-table)))
+    (modify-syntax-entry ?/   ". 124b" table)
+    (modify-syntax-entry ?\n  "> b"    table)
+    table)
+  "Syntax table for `go-mod-ts-mode'.")
+
+(defvar go-mod-ts-mode--indent-rules
+  `((gomod
+     ((node-is ")") parent-bol 0)
+     ((parent-is "exclude_directive") parent-bol go-ts-mode-indent-offset)
+     ((parent-is "module_directive") parent-bol go-ts-mode-indent-offset)
+     ((parent-is "replace_directive") parent-bol go-ts-mode-indent-offset)
+     ((parent-is "require_directive") parent-bol go-ts-mode-indent-offset)
+     ((parent-is "retract_directive") parent-bol go-ts-mode-indent-offset)
+     ((go-mod-ts-mode--in-directive-p) no-indent go-ts-mode-indent-offset)
+     (no-node no-indent 0)))
+  "Tree-sitter indent rules for `go-mod-ts-mode'.")
+
+(defun go-mod-ts-mode--in-directive-p ()
+  "Return non-nil if inside a directive.
+When entering an empty directive or adding a new entry to one, no node
+will be present meaning none of the indentation rules will match,
+because there is no parent to match against.  This function determines
+what the parent of the node would be if it were a node."
+  (lambda (node _ _ &rest _)
+    (unless (treesit-node-type node)
+      (save-excursion
+        (backward-up-list)
+        (back-to-indentation)
+        (pcase (treesit-node-type (treesit-node-at (point)))
+          ("exclude" t)
+          ("module" t)
+          ("replace" t)
+          ("require" t)
+          ("retract" t))))))
+
+(defvar go-mod-ts-mode--keywords
+  '("exclude" "go" "module" "replace" "require" "retract")
+  "go.mod keywords for tree-sitter font-locking.")
+
+(defvar go-mod-ts-mode--font-lock-settings
+  (treesit-font-lock-rules
+   :language 'gomod
+   :feature 'bracket
+   '((["(" ")"]) @font-lock-bracket-face)
+
+   :language 'gomod
+   :feature 'comment
+   '((comment) @font-lock-comment-face)
+
+   :language 'gomod
+   :feature 'keyword
+   `([,@go-mod-ts-mode--keywords] @font-lock-keyword-face)
+
+   :language 'gomod
+   :feature 'number
+   '([(go_version) (version)] @font-lock-number-face)
+
+   :language 'gomod
+   :feature 'operator
+   '((["=>"]) @font-lock-operator-face)
+
+   :language 'gomod
+   :feature 'error
+   :override t
+   '((ERROR) @font-lock-warning-face))
+  "Tree-sitter font-lock settings for `go-mod-ts-mode'.")
+
+;;;###autoload
+(add-to-list 'auto-mode-alist '("/go\\.mod\\'" . go-mod-ts-mode))
+
+;;;###autoload
+(define-derived-mode go-mod-ts-mode prog-mode "Go Mod"
+  "Major mode for editing go.mod files, powered by tree-sitter."
+  :group 'go
+  :syntax-table go-mod-ts-mode--syntax-table
+
+  (when (treesit-ready-p 'gomod)
+    (treesit-parser-create 'gomod)
+
+    ;; Comments.
+    (setq-local comment-start "// ")
+    (setq-local comment-end "")
+    (setq-local comment-start-skip (rx "//" (* (syntax whitespace))))
+
+    ;; Indent.
+    (setq-local indent-tabs-mode t
+                treesit-simple-indent-rules go-mod-ts-mode--indent-rules)
+
+    ;; Font-lock.
+    (setq-local treesit-font-lock-settings go-mod-ts-mode--font-lock-settings)
+    (setq-local treesit-font-lock-feature-list
+                '((comment)
+                  (keyword)
+                  (number)
+                  (bracket error operator)))
+
+    (treesit-major-mode-setup)))
+
+(provide 'go-ts-mode)
+
+;;; go-ts-mode.el ends here
diff --git a/lisp/progmodes/idlwave.el b/lisp/progmodes/idlwave.el
index cd2fc7c707..395c51d542 100644
--- a/lisp/progmodes/idlwave.el
+++ b/lisp/progmodes/idlwave.el
@@ -133,7 +133,7 @@
 ;;   limited to comments only and occurs only when a comment
 ;;   paragraph is filled via `idlwave-fill-paragraph'.
 ;;
-;;   Muti-statement lines (using "&") on block begin and end lines can
+;;   Multi-statement lines (using "&") on block begin and end lines can
 ;;   ruin the formatting.  For example, multiple end statements on a
 ;;   line: endif & endif.  Using "&" outside of block begin/end lines
 ;;   should be okay.
diff --git a/lisp/progmodes/java-ts-mode.el b/lisp/progmodes/java-ts-mode.el
index 39d02bbfe4..bd6a8aa474 100644
--- a/lisp/progmodes/java-ts-mode.el
+++ b/lisp/progmodes/java-ts-mode.el
@@ -86,6 +86,7 @@
      ((parent-is "method_invocation") parent-bol java-ts-mode-indent-offset)
      ((parent-is "switch_rule") parent-bol java-ts-mode-indent-offset)
      ((parent-is "ternary_expression") parent-bol java-ts-mode-indent-offset)
+     ((parent-is "lambda_expression") parent-bol java-ts-mode-indent-offset)
      ((parent-is "element_value_array_initializer") parent-bol 
java-ts-mode-indent-offset)
      ((parent-is "function_definition") parent-bol 0)
      ((parent-is "conditional_expression") first-sibling 0)
@@ -144,9 +145,10 @@
    :language 'java
    :override t
    :feature 'keyword
-   `([,@java-ts-mode--keywords] @font-lock-keyword-face
-     (labeled_statement
-      (identifier) @font-lock-keyword-face))
+   `([,@java-ts-mode--keywords
+      (this)] @font-lock-keyword-face
+      (labeled_statement
+       (identifier) @font-lock-keyword-face))
    :language 'java
    :override t
    :feature 'operator
diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el
index e0625951b6..b8bfd5620d 100644
--- a/lisp/progmodes/js.el
+++ b/lisp/progmodes/js.el
@@ -1928,7 +1928,7 @@ This performs fontification according to 
`js--class-styles'."
 ;; identified as such), then the `syntax-propertize' region won’t be
 ;; extended backwards to the start of the JSXOpeningElement:
 ;;
-;;   <div         ← This line wasn’t JSX when last edited.
+;;   <div         ← This line wasn't JSX when last edited.
 ;;     attr="">   ← Despite completing the JSX, the next
 ;;             ^    `syntax-propertize' region wouldn’t magically
 ;;                  extend back a few lines.
@@ -2090,7 +2090,7 @@ JSXElement or a JSXOpeningElement/JSXClosingElement pair."
                         ;; JSXOpeningElement has been found, so keep
                         ;; looking backwards for an enclosing one).
                         (or (not close-tag-pos) (<= start 
close-tag-pos)))))))))
-      ;; Don’t return the last tag pos, as it wasn’t enclosing.
+      ;; Don't return the last tag pos, as it wasn't enclosing.
       (setq tag-beg nil close-tag-pos nil))
     (and tag-beg (list tag-beg-pos tag-end-pos close-tag-pos))))
 
diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index 4fd855255b..559da6dd64 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -174,6 +174,7 @@
 ;;; Code:
 
 (require 'cl-generic)
+(require 'cl-lib)
 (require 'seq)
 (eval-when-compile (require 'subr-x))
 
@@ -1038,7 +1039,14 @@ by the user at will."
          (_ (when included-cpd
               (setq substrings (cons "./" substrings))))
          (new-collection (project--file-completion-table substrings))
-         (relname (let ((history-add-new-input nil))
+         (abbr-cpd (abbreviate-file-name common-parent-directory))
+         (relname (cl-letf ((history-add-new-input nil)
+                            ((symbol-value hist)
+                             (mapcan
+                              (lambda (s)
+                                (and (string-prefix-p abbr-cpd s)
+                                     (list (substring s (length abbr-cpd)))))
+                              (symbol-value hist))))
                     (project--completing-read-strict prompt
                                                      new-collection
                                                      predicate
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index ee05862550..bdc9e6fa78 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -1095,6 +1095,14 @@ fontified."
      (class_definition
       name: (identifier) @font-lock-type-face))
 
+   :feature 'function
+   :language 'python
+   '((function_definition
+      name: (identifier) @font-lock-function-name-face)
+     (call function: (identifier) @font-lock-function-name-face)
+     (call function: (attribute
+                      attribute: (identifier) @font-lock-function-name-face)))
+
    :feature 'keyword
    :language 'python
    `([,@python--treesit-keywords] @font-lock-keyword-face
@@ -6564,19 +6572,21 @@ implementations: `python-mode' and `python-ts-mode'."
         (add-function :before-until (local 'eldoc-documentation-function)
                       #'python-eldoc-function))))
 
-  (add-to-list
-   'hs-special-modes-alist
-   `(python-mode
-     ,python-nav-beginning-of-block-regexp
-     ;; Use the empty string as end regexp so it doesn't default to
-     ;; "\\s)".  This way parens at end of defun are properly hidden.
-     ""
-     "#"
-     python-hideshow-forward-sexp-function
-     nil
-     python-nav-beginning-of-block
-     python-hideshow-find-next-block
-     python-info-looking-at-beginning-of-block))
+  ;; TODO: Use tree-sitter to figure out the block in `python-ts-mode'.
+  (dolist (mode '(python-mode python-ts-mode))
+    (add-to-list
+     'hs-special-modes-alist
+     `(,mode
+       ,python-nav-beginning-of-block-regexp
+       ;; Use the empty string as end regexp so it doesn't default to
+       ;; "\\s)".  This way parens at end of defun are properly hidden.
+       ""
+       "#"
+       python-hideshow-forward-sexp-function
+       nil
+       python-nav-beginning-of-block
+       python-hideshow-find-next-block
+       python-info-looking-at-beginning-of-block)))
 
   (setq-local outline-regexp (python-rx (* space) block-start))
   (setq-local outline-level
@@ -6627,7 +6637,7 @@ implementations: `python-mode' and `python-ts-mode'."
                   ( keyword string type)
                   ( assignment builtin constant decorator
                     escape-sequence number property string-interpolation )
-                  ( bracket delimiter operator)))
+                  ( function bracket delimiter operator)))
     (setq-local treesit-font-lock-settings python--treesit-settings)
     (setq-local imenu-create-index-function
                 #'python-imenu-treesit-create-index)
@@ -6635,8 +6645,8 @@ implementations: `python-mode' and `python-ts-mode'."
                                               "_definition"))
     (treesit-major-mode-setup)
 
-  (when python-indent-guess-indent-offset
-    (python-indent-guess-indent-offset))))
+    (when python-indent-guess-indent-offset
+      (python-indent-guess-indent-offset))))
 
 ;;; Completion predicates for M-x
 ;; Commands that only make sense when editing Python code
diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el
index 458697dd22..3f995d17b5 100644
--- a/lisp/progmodes/sh-script.el
+++ b/lisp/progmodes/sh-script.el
@@ -1613,6 +1613,7 @@ This mode automatically falls back to `sh-mode' if the 
buffer is
 not written in Bash or sh."
   :syntax-table sh-mode-syntax-table
   (when (treesit-ready-p 'bash)
+    (treesit-parser-create 'bash)
     (setq-local treesit-font-lock-feature-list
                 '(( comment function)
                   ( command declaration-command keyword string)
@@ -1624,6 +1625,7 @@ not written in Bash or sh."
                 (regexp-opt '("comment"
                               "heredoc_start"
                               "heredoc_body")))
+    (setq-local treesit-defun-type-regexp "function_definition")
     (treesit-major-mode-setup)))
 
 (advice-add 'bash-ts-mode :around #'sh--redirect-bash-ts-mode
diff --git a/lisp/simple.el b/lisp/simple.el
index 654b56a088..dcc2242e49 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -10683,7 +10683,12 @@ too short to have a dst element.
         ;; we just created it.
         (with-current-buffer scratch
           (when initial-scratch-message
-            (insert (substitute-command-keys initial-scratch-message))
+            ;; We used to run this through substitute-command-keys,
+            ;; but that might be unsafe in some rare cases, and this
+            ;; function must never fail and signal an error, because
+            ;; it is called from other_buffer_safely, which must
+            ;; always produce a valid buffer.
+            (insert initial-scratch-message)
             (set-buffer-modified-p nil))
           (funcall initial-major-mode))
         scratch)))
diff --git a/lisp/so-long.el b/lisp/so-long.el
index 661f5ee57a..fc99162325 100644
--- a/lisp/so-long.el
+++ b/lisp/so-long.el
@@ -986,7 +986,7 @@ See also `so-long-mode-line-info'."
 ;; Modes that go slowly and line lengths excessive
 ;; Font-lock performance becoming oppressive
 ;; All of my CPU tied up with strings
-;; These are a few of my least-favourite things
+;; These are a few of my least-favorite things
 
 (defvar-local so-long-original-values nil
   "Alist holding the buffer's original `major-mode' value, and other data.
diff --git a/lisp/startup.el b/lisp/startup.el
index 6270de2ace..7f8e8d55db 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -1669,7 +1669,7 @@ Changed settings will be marked as \"CHANGED outside of 
Customize\"."
 
 (defcustom initial-scratch-message (purecopy "\
 ;; This buffer is for text that is not saved, and for Lisp evaluation.
-;; To create a file, visit it with \\[find-file] and enter text in its buffer.
+;; To create a file, visit it with \"C-x C-f\" and enter text in its buffer.
 
 ")
   "Initial documentation displayed in *scratch* buffer at startup.
diff --git a/lisp/textmodes/toml-ts-mode.el b/lisp/textmodes/toml-ts-mode.el
index 26a3eb69d8..bca6a5e81a 100644
--- a/lisp/textmodes/toml-ts-mode.el
+++ b/lisp/textmodes/toml-ts-mode.el
@@ -159,7 +159,7 @@ the subtrees."
 
     ;; Comments
     (setq-local comment-start "# ")
-    (setq-local commend-end "")
+    (setq-local comment-end "")
 
     ;; Indent.
     (setq-local treesit-simple-indent-rules toml-ts-mode--indent-rules)
diff --git a/lisp/treesit.el b/lisp/treesit.el
index ba81f55bb7..0df71d12ed 100644
--- a/lisp/treesit.el
+++ b/lisp/treesit.el
@@ -1624,40 +1624,37 @@ For the detailed semantic see 
`treesit-defun-prefer-top-level'."
       finally return node))))
 
 (defun treesit-beginning-of-defun (&optional arg)
-  "Tree-sitter `beginning-of-defun' function.
-ARG is the same as in `beginning-of-defun'."
-  (let ((arg (or arg 1))
-        (node (treesit-node-at (point))))
-    (if (> arg 0)
-        ;; Go backward.
-        (while (and (> arg 0)
-                    (setq node (treesit-search-forward-goto
-                                node treesit-defun-type-regexp t t)))
-          (setq node (treesit--defun-maybe-top-level node))
-          (setq arg (1- arg)))
-      ;; Go forward.
-      (while (and (< arg 0)
-                  (setq node (treesit-search-forward-goto
-                              node treesit-defun-type-regexp)))
-        (setq node (treesit--defun-maybe-top-level node))
-        (setq arg (1+ arg))))
-    (when node
-      (goto-char (treesit-node-start node))
-      t)))
-
-(defun treesit-end-of-defun ()
-  "Tree-sitter `end-of-defun' function."
-  ;; Why not simply get the largest node at point: when point is at
-  ;; (point-min), that gives us the root node.
-  (let* ((node (treesit-search-forward
-                (treesit-node-at (point)) treesit-defun-type-regexp t t))
-         (top (treesit--defun-maybe-top-level node)))
-    ;; Technically `end-of-defun' should only call this function when
-    ;; point is at the beginning of a defun, so TOP should always be
-    ;; non-nil, but things happen, and we want to be safe, so check
-    ;; for TOP anyway.
-    (when top
-      (goto-char (treesit-node-end top)))))
+  "Move backward to the beginning of a defun.
+
+With argument ARG, do it that many times.  Negative ARG means
+move forward to the ARGth following beginning of defun.
+
+If search is successful, return t, otherwise return nil.
+
+This is a tree-sitter equivalent of `beginning-of-defun'.
+Behavior of this function depends on `treesit-defun-type-regexp'
+and `treesit-defun-skipper'."
+  (interactive "^p")
+  (when-let ((dest (treesit--navigate-defun (point) (- arg) 'beg)))
+    (goto-char dest)
+    (when treesit-defun-skipper
+      (funcall treesit-defun-skipper))
+    t))
+
+(defun treesit-end-of-defun (&optional arg _)
+  "Move forward to next end of defun.
+
+With argument ARG, do it that many times.
+Negative argument -N means move back to Nth preceding end of defun.
+
+This is a tree-sitter equivalent of `end-of-defun'.  Behavior of
+this function depends on `treesit-defun-type-regexp' and
+`treesit-defun-skipper'."
+  (interactive "^p\nd")
+  (when-let ((dest (treesit--navigate-defun (point) arg 'end)))
+    (goto-char dest)
+    (when treesit-defun-skipper
+      (funcall treesit-defun-skipper))))
 
 (defvar-local treesit-text-type-regexp "\\`comment\\'"
   "A regexp that matches the node type of textual nodes.
@@ -1962,8 +1959,10 @@ before calling this function."
     (setq-local indent-region-function #'treesit-indent-region))
   ;; Navigation.
   (when treesit-defun-type-regexp
-    (setq-local beginning-of-defun-function #'treesit-beginning-of-defun)
-    (setq-local end-of-defun-function #'treesit-end-of-defun)))
+    (keymap-set (current-local-map) "<remap> <beginning-of-defun>"
+                #'treesit-beginning-of-defun)
+    (keymap-set (current-local-map) "<remap> <end-of-defun>"
+                #'treesit-end-of-defun)))
 
 ;;; Debugging
 
@@ -1987,9 +1986,9 @@ in `treesit-parser-list'."
                    collect node))
          (largest-node (car (last node-list)))
          (parent (treesit-node-parent largest-node))
-         ;; node-list-acending contains all the node bottom-up, then
+         ;; node-list-ascending contains all the node bottom-up, then
          ;; the parent.
-         (node-list-acending
+         (node-list-ascending
           (if (null largest-node)
               ;; If there are no nodes that start at point, just show
               ;; the node at point and its parent.
@@ -2000,7 +1999,7 @@ in `treesit-parser-list'."
          (name ""))
     ;; We draw nodes like (parent field-name: (node)) recursively,
     ;; so it could be (node1 field-name: (node2 field-name: (node3))).
-    (dolist (node node-list-acending)
+    (dolist (node node-list-ascending)
       (setq
        name
        (concat
diff --git a/oldXMenu/ChangeLog.1 b/oldXMenu/ChangeLog.1
index ebbbcd2df2..b739a231f5 100644
--- a/oldXMenu/ChangeLog.1
+++ b/oldXMenu/ChangeLog.1
@@ -46,7 +46,7 @@
 
        * Makefile.in (mostlyclean, clean, distclean, maintainer-clean, tags):
        Declare as PHONY.
-       (boostrap-clean): New.
+       (bootstrap-clean): New.
 
 2013-10-24  Glenn Morris  <rgm@gnu.org>
 
diff --git a/src/ChangeLog.12 b/src/ChangeLog.12
index 7f77c0ca07..f455c4de38 100644
--- a/src/ChangeLog.12
+++ b/src/ChangeLog.12
@@ -10836,7 +10836,7 @@
        * gtkutil.c (xg_maybe_add_timer): Port to higher-res time stamps.
 
        * image.c (prepare_image_for_display, clear_image_cache)
-       (lookup_image): Port to higer-resolution time stamps.
+       (lookup_image): Port to higher-resolution time stamps.
 
        * keyboard.c (start_polling, bind_polling_period):
        Check for time stamp overflow.
diff --git a/src/ChangeLog.13 b/src/ChangeLog.13
index 91f8005ac5..0c4e2909ce 100644
--- a/src/ChangeLog.13
+++ b/src/ChangeLog.13
@@ -10579,7 +10579,7 @@
        (../src/$(OLDXMENU), $(OLDXMENU)): Remove.
        (temacs$(EXEEXT)): Depend on $(LIBXMENU), not stamp-oldxmenu.
        ($(lwlibdir)/liblw.a, $(oldXMenudir)/libXMenu11.a, FORCE): New targets.
-       (boostrap-clean): No need to remove stamp-oldxmenu.
+       (bootstrap-clean): No need to remove stamp-oldxmenu.
 
        Fix recently introduced bool vector overrun.
        This was due to an optimization that went awry.
diff --git a/src/fns.c b/src/fns.c
index d8744c1a4d..b6e871ad49 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -3938,7 +3938,7 @@ system.
 If the region can't be decoded, signal an error and don't modify the buffer.
 Optional third argument BASE64URL determines whether to use the URL variant
 of the base 64 encoding, as defined in RFC 4648.
-If optional fourth argument INGORE-INVALID is non-nil invalid characters
+If optional fourth argument IGNORE-INVALID is non-nil invalid characters
 are ignored instead of signaling an error.  */)
      (Lisp_Object beg, Lisp_Object end, Lisp_Object base64url,
       Lisp_Object ignore_invalid)
diff --git a/test/lisp/delim-col-tests.el b/test/lisp/delim-col-tests.el
index 97fa0f1e8f..2bf54d9b44 100644
--- a/test/lisp/delim-col-tests.el
+++ b/test/lisp/delim-col-tests.el
@@ -100,7 +100,7 @@
                             "aaa       [ bbb, cccc    ]        dddd\n"
                             "aa        [ bb,  ccccccc ]        ddd\n"))))))
 
-(ert-deftest delim-col-tests-delimit-colummns-before-after ()
+(ert-deftest delim-col-tests-delimit-columns-before-after ()
   (let ((delimit-columns-before "<")
         (delimit-columns-after ">"))
     (with-temp-buffer
diff --git a/test/lisp/emacs-lisp/cconv-tests.el 
b/test/lisp/emacs-lisp/cconv-tests.el
index e666fe0a4c..537f6bfe72 100644
--- a/test/lisp/emacs-lisp/cconv-tests.el
+++ b/test/lisp/emacs-lisp/cconv-tests.el
@@ -60,7 +60,7 @@
                    "cl-defun documentation"))
   (should (eq (cconv-tests-cl-defun) 'cl-defun-result)))
 
-;; FIXME: The byte-complier croaks on this.  See Bug#28557.
+;; FIXME: The byte-compiler croaks on this.  See Bug#28557.
 ;; (defmacro cconv-tests-defmacro ()
 ;;   (:documentation (concat "defmacro" " documentation"))
 ;;   '(quote defmacro-result))
@@ -70,7 +70,7 @@
 ;;                    "defmacro documentation"))
 ;;   (should (eq (cconv-tests-defmacro) 'defmacro-result)))
 
-;; FIXME: The byte-complier croaks on this.  See Bug#28557.
+;; FIXME: The byte-compiler croaks on this.  See Bug#28557.
 ;; (cl-defmacro cconv-tests-cl-defmacro ()
 ;;   (:documentation (concat "cl-defmacro" " documentation"))
 ;;   '(quote cl-defmacro-result))
diff --git a/test/lisp/emacs-lisp/checkdoc-tests.el 
b/test/lisp/emacs-lisp/checkdoc-tests.el
index 289476f024..c17415cbdd 100644
--- a/test/lisp/emacs-lisp/checkdoc-tests.el
+++ b/test/lisp/emacs-lisp/checkdoc-tests.el
@@ -130,25 +130,25 @@ See the comments in Bug#24998."
     (re-search-forward goto-string)
     (checkdoc-in-abbreviation-p (point))))
 
-(ert-deftest checkdoc-tests-in-abbrevation-p/basic-case ()
+(ert-deftest checkdoc-tests-in-abbreviation-p/basic-case ()
   (should (checkdoc-tests--abbrev-test "foo bar e.g. baz" "e.g"))
   (should (checkdoc-tests--abbrev-test "behavior/errors etc. that" "etc"))
   (should (checkdoc-tests--abbrev-test "foo vs. bar" "vs"))
   (should (checkdoc-tests--abbrev-test "spy a.k.a. spy" "a.k.a")))
 
-(ert-deftest checkdoc-tests-in-abbrevation-p/with-parens ()
+(ert-deftest checkdoc-tests-in-abbreviation-p/with-parens ()
   (should (checkdoc-tests--abbrev-test "foo bar (e.g. baz)" "e.g")))
 
-(ert-deftest checkdoc-tests-in-abbrevation-p/with-escaped-parens ()
+(ert-deftest checkdoc-tests-in-abbreviation-p/with-escaped-parens ()
   (should (checkdoc-tests--abbrev-test "foo\n\\(e.g. baz)" "e.g")))
 
-(ert-deftest checkdoc-tests-in-abbrevation-p/single-char ()
+(ert-deftest checkdoc-tests-in-abbreviation-p/single-char ()
   (should (checkdoc-tests--abbrev-test "a. foo bar" "a")))
 
-(ert-deftest checkdoc-tests-in-abbrevation-p/with-em-dash ()
+(ert-deftest checkdoc-tests-in-abbreviation-p/with-em-dash ()
   (should (checkdoc-tests--abbrev-test "foo bar baz---e.g." "e.g")))
 
-(ert-deftest checkdoc-tests-in-abbrevation-p/incorrect-abbreviation ()
+(ert-deftest checkdoc-tests-in-abbreviation-p/incorrect-abbreviation ()
   (should-not (checkdoc-tests--abbrev-test "foo bar a.b.c." "a.b.c")))
 
 (defun checkdoc-test-error-format-is-good (msg &optional reverse literal)
diff --git a/test/lisp/emacs-lisp/find-func-tests.el 
b/test/lisp/emacs-lisp/find-func-tests.el
index d18a9dc1a9..8c432f8720 100644
--- a/test/lisp/emacs-lisp/find-func-tests.el
+++ b/test/lisp/emacs-lisp/find-func-tests.el
@@ -87,7 +87,7 @@ expected function symbol and function library, respectively."
   (test-locate-helper #'forward-char '(forward-char . "cmds.c"))
   (should-error (test-locate-helper 'wrong-function)))
 
-(ert-deftest find-func-tests--locate-adviced-symbols ()
+(ert-deftest find-func-tests--locate-advised-symbols ()
   (defun my-message ()
     (message "Hello!"))
   (advice-add #'mark-sexp :around 'my-message)
diff --git a/test/lisp/erc/resources/services/auth-source/recon.eld 
b/test/lisp/erc/resources/services/auth-source/recon.eld
index 40ea3c9157..2ab52c9bec 100644
--- a/test/lisp/erc/resources/services/auth-source/recon.eld
+++ b/test/lisp/erc/resources/services/auth-source/recon.eld
@@ -21,7 +21,7 @@
  (0.00 ":irc.foonet.net 376 tester :End of message of the day."))
 
 ((mode-a 10 "MODE tester +i")
- (0.00 ":irc.foonet.net 501 tester x :is not a recognised user mode.")
+ (0.00 ":irc.foonet.net 501 tester x :is not a recognized user mode.")
  (0.04 ":tester!tester@10.0.2.100 MODE tester :+i")
  (0.00 ":NickServ!NickServ@services.int NOTICE tester :This nickname is 
registered. Please choose a different nickname, or identify via \2/msg NickServ 
identify <password>\2."))
 



reply via email to

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