2022-12-11 18:41:16 -05:00
|
|
|
;;; go-ts-mode.el --- tree-sitter support for Go -*- lexical-binding: t; -*-
|
|
|
|
|
2025-01-01 07:39:17 +00:00
|
|
|
;; Copyright (C) 2022-2025 Free Software Foundation, Inc.
|
2022-12-11 18:41:16 -05:00
|
|
|
|
|
|
|
;; 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/>.
|
|
|
|
|
2024-12-30 00:21:46 -08:00
|
|
|
;;; Tree-sitter language versions
|
|
|
|
;;
|
2025-06-20 19:56:01 +03:00
|
|
|
;; go-ts-mode has been tested with the following grammars and version:
|
2024-12-30 00:21:46 -08:00
|
|
|
;; - tree-sitter-go: v0.23.4-1-g12fe553
|
2024-11-20 23:07:28 -03:00
|
|
|
;; - tree-sitter-go-mod: v1.1.0-3b01edce
|
|
|
|
;; - tree-sitter-go-work: 949a8a47
|
2024-12-30 00:21:46 -08:00
|
|
|
;;
|
|
|
|
;; We try our best to make builtin modes work with latest grammar
|
2025-06-20 19:56:01 +03:00
|
|
|
;; versions, so a more recent grammar has a good chance to work too.
|
2024-12-30 00:21:46 -08:00
|
|
|
;; Send us a bug report if it doesn't.
|
|
|
|
|
2022-12-11 18:41:16 -05:00
|
|
|
;;; Commentary:
|
|
|
|
;;
|
2024-11-20 23:07:28 -03:00
|
|
|
;; Go uses tabs as a convention for indentation:
|
|
|
|
;; https://go.dev/doc/effective_go#formatting
|
|
|
|
;; so `indent-tabs-mode' is enabled for the modes.
|
2022-12-11 18:41:16 -05:00
|
|
|
|
|
|
|
;;; Code:
|
|
|
|
|
|
|
|
(require 'treesit)
|
2025-02-11 20:38:00 -08:00
|
|
|
(require 'c-ts-common)
|
2022-12-11 18:41:16 -05:00
|
|
|
(eval-when-compile (require 'rx))
|
2024-12-07 22:13:07 -08:00
|
|
|
(treesit-declare-unavailable-functions)
|
2022-12-11 18:41:16 -05:00
|
|
|
|
2025-04-18 19:22:50 +03:00
|
|
|
(add-to-list
|
|
|
|
'treesit-language-source-alist
|
2025-06-20 19:56:01 +03:00
|
|
|
'(go "https://github.com/tree-sitter/tree-sitter-go"
|
|
|
|
:commit "12fe553fdaaa7449f764bc876fd777704d4fb752")
|
2025-04-18 19:22:50 +03:00
|
|
|
t)
|
|
|
|
(add-to-list
|
|
|
|
'treesit-language-source-alist
|
2025-06-20 19:56:01 +03:00
|
|
|
'(gomod "https://github.com/camdencheek/tree-sitter-go-mod"
|
|
|
|
:commit "3b01edce2b9ea6766ca19328d1850e456fde3103")
|
2025-04-18 19:22:50 +03:00
|
|
|
t)
|
|
|
|
(add-to-list
|
|
|
|
'treesit-language-source-alist
|
2025-06-20 19:56:01 +03:00
|
|
|
'(gowork "https://github.com/omertuc/tree-sitter-go-work"
|
|
|
|
:commit "949a8a470559543857a62102c84700d291fc984c")
|
2025-04-18 19:22:50 +03:00
|
|
|
t)
|
|
|
|
|
2023-01-24 21:20:48 -05:00
|
|
|
(defcustom go-ts-mode-indent-offset 8
|
2022-12-11 18:41:16 -05:00
|
|
|
"Number of spaces for each indentation step in `go-ts-mode'."
|
|
|
|
:version "29.1"
|
|
|
|
:type 'integer
|
|
|
|
:safe 'integerp
|
|
|
|
:group 'go)
|
|
|
|
|
2024-05-14 00:14:03 +05:30
|
|
|
(defcustom go-ts-mode-build-tags nil
|
|
|
|
"List of Go build tags for the test commands."
|
2024-07-21 11:13:35 +02:00
|
|
|
:version "31.1"
|
2024-05-14 00:14:03 +05:30
|
|
|
:type '(repeat string)
|
|
|
|
:group 'go)
|
|
|
|
|
2024-12-19 09:53:02 +00:00
|
|
|
(defcustom go-ts-mode-test-flags nil
|
|
|
|
"List of extra flags for the Go test commands."
|
|
|
|
:version "31.1"
|
|
|
|
:type '(repeat string)
|
|
|
|
:group 'go)
|
|
|
|
|
2022-12-11 18:41:16 -05:00
|
|
|
(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)
|
2023-05-26 17:23:26 +03:00
|
|
|
(modify-syntax-entry ?\' "\"" table)
|
2022-12-11 18:41:16 -05:00
|
|
|
(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
|
2023-03-04 19:45:39 +02:00
|
|
|
((parent-is "source_file") column-0 0)
|
2022-12-11 18:41:16 -05:00
|
|
|
((node-is ")") parent-bol 0)
|
|
|
|
((node-is "]") parent-bol 0)
|
|
|
|
((node-is "}") parent-bol 0)
|
2023-03-04 00:37:03 -08:00
|
|
|
((node-is "labeled_statement") no-indent 0)
|
|
|
|
((parent-is "raw_string_literal") no-indent 0)
|
2022-12-11 18:41:16 -05:00
|
|
|
((parent-is "argument_list") parent-bol go-ts-mode-indent-offset)
|
|
|
|
((parent-is "block") parent-bol go-ts-mode-indent-offset)
|
2023-02-02 21:00:02 +01:00
|
|
|
((parent-is "communication_case") parent-bol go-ts-mode-indent-offset)
|
2022-12-11 18:41:16 -05:00
|
|
|
((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)
|
2023-06-23 15:37:04 +02:00
|
|
|
((parent-is "selector_expression") parent-bol go-ts-mode-indent-offset)
|
2022-12-11 18:41:16 -05:00
|
|
|
((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)
|
2023-01-24 21:20:48 -05:00
|
|
|
((parent-is "interface_type") parent-bol go-ts-mode-indent-offset)
|
2022-12-11 18:41:16 -05:00
|
|
|
((parent-is "labeled_statement") parent-bol go-ts-mode-indent-offset)
|
|
|
|
((parent-is "literal_value") parent-bol go-ts-mode-indent-offset)
|
2023-01-24 21:20:48 -05:00
|
|
|
((parent-is "parameter_list") parent-bol go-ts-mode-indent-offset)
|
2023-02-02 21:00:02 +01:00
|
|
|
((parent-is "select_statement") parent-bol 0)
|
|
|
|
((parent-is "type_case") parent-bol go-ts-mode-indent-offset)
|
2025-01-23 11:16:34 -05:00
|
|
|
((parent-is "type_declaration") parent-bol go-ts-mode-indent-offset)
|
2022-12-11 18:41:16 -05:00
|
|
|
((parent-is "type_spec") parent-bol go-ts-mode-indent-offset)
|
2023-02-02 21:00:02 +01:00
|
|
|
((parent-is "type_switch_statement") parent-bol 0)
|
2022-12-11 18:41:16 -05:00
|
|
|
((parent-is "var_declaration") parent-bol go-ts-mode-indent-offset)
|
2025-01-05 16:48:00 -05:00
|
|
|
((parent-is "var_spec_list") parent-bol go-ts-mode-indent-offset)
|
2022-12-11 18:41:16 -05:00
|
|
|
(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.")
|
|
|
|
|
2024-04-12 22:38:28 -07:00
|
|
|
(defvar go-ts-mode--builtin-functions
|
|
|
|
'("append" "cap" "clear" "close" "complex" "copy" "delete" "imag" "len" "make"
|
|
|
|
"max" "min" "new" "panic" "print" "println" "real" "recover")
|
|
|
|
"Go built-in functions for tree-sitter font-locking.")
|
|
|
|
|
2023-04-26 11:15:45 -04:00
|
|
|
(defun go-ts-mode--iota-query-supported-p ()
|
2023-05-04 16:37:39 +03:00
|
|
|
"Return t if the iota query is supported by the tree-sitter-go grammar."
|
2023-04-26 11:15:45 -04:00
|
|
|
(ignore-errors
|
|
|
|
(or (treesit-query-string "" '((iota) @font-lock-constant-face) 'go) t)))
|
|
|
|
|
2024-04-08 20:20:25 -07:00
|
|
|
;; tree-sitter-go changed method_spec to method_elem in
|
|
|
|
;; https://github.com/tree-sitter/tree-sitter-go/commit/b82ab803d887002a0af11f6ce63d72884580bf33
|
|
|
|
(defun go-ts-mode--method-elem-supported-p ()
|
|
|
|
"Return t if Go grammar uses `method_elem' instead of `method_spec'."
|
|
|
|
(ignore-errors
|
|
|
|
(or (treesit-query-string "" '((method_elem) @cap) 'go) t)))
|
|
|
|
|
2022-12-11 18:41:16 -05:00
|
|
|
(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)
|
|
|
|
|
2024-04-18 13:30:20 +03:00
|
|
|
:language 'go
|
|
|
|
:feature 'builtin
|
|
|
|
`((call_expression
|
|
|
|
function: ((identifier) @font-lock-builtin-face
|
|
|
|
(:match ,(rx-to-string
|
|
|
|
`(seq bol
|
|
|
|
(or ,@go-ts-mode--builtin-functions)
|
|
|
|
eol))
|
|
|
|
@font-lock-builtin-face))))
|
|
|
|
|
2022-12-11 18:41:16 -05:00
|
|
|
:language 'go
|
|
|
|
:feature 'constant
|
2023-04-26 11:15:45 -04:00
|
|
|
`([(false) (nil) (true)] @font-lock-constant-face
|
|
|
|
,@(when (go-ts-mode--iota-query-supported-p)
|
|
|
|
'((iota) @font-lock-constant-face))
|
2022-12-11 18:41:16 -05:00
|
|
|
(const_declaration
|
2025-02-16 15:51:43 -05:00
|
|
|
(const_spec name: (identifier) @font-lock-constant-face
|
|
|
|
("," name: (identifier) @font-lock-constant-face)*)))
|
2022-12-11 18:41:16 -05:00
|
|
|
|
|
|
|
:language 'go
|
|
|
|
:feature 'delimiter
|
|
|
|
'((["," "." ";" ":"]) @font-lock-delimiter-face)
|
|
|
|
|
2024-04-12 22:09:17 -07:00
|
|
|
:language 'go
|
|
|
|
:feature 'operator
|
|
|
|
`([,@go-ts-mode--operators] @font-lock-operator-face)
|
|
|
|
|
2023-02-05 15:46:28 +02:00
|
|
|
:language 'go
|
|
|
|
:feature 'definition
|
2024-04-08 20:20:25 -07:00
|
|
|
`((function_declaration
|
2023-02-05 15:46:28 +02:00
|
|
|
name: (identifier) @font-lock-function-name-face)
|
|
|
|
(method_declaration
|
|
|
|
name: (field_identifier) @font-lock-function-name-face)
|
2024-04-08 20:20:25 -07:00
|
|
|
(,(if (go-ts-mode--method-elem-supported-p)
|
|
|
|
'method_elem
|
|
|
|
'method_spec)
|
2023-02-05 15:46:28 +02:00
|
|
|
name: (field_identifier) @font-lock-function-name-face)
|
|
|
|
(field_declaration
|
2023-02-25 03:15:46 +02:00
|
|
|
name: (field_identifier) @font-lock-property-name-face)
|
2023-02-05 15:46:28 +02:00
|
|
|
(parameter_declaration
|
2023-02-06 04:42:12 +02:00
|
|
|
name: (identifier) @font-lock-variable-name-face)
|
2024-06-01 17:47:13 +03:00
|
|
|
(variadic_parameter_declaration
|
|
|
|
name: (identifier) @font-lock-variable-name-face)
|
2023-02-06 04:42:12 +02:00
|
|
|
(short_var_declaration
|
|
|
|
left: (expression_list
|
|
|
|
(identifier) @font-lock-variable-name-face
|
|
|
|
("," (identifier) @font-lock-variable-name-face)*))
|
|
|
|
(var_spec name: (identifier) @font-lock-variable-name-face
|
2024-05-26 05:34:34 -07:00
|
|
|
("," name: (identifier) @font-lock-variable-name-face)*)
|
|
|
|
(range_clause
|
|
|
|
left: (expression_list
|
|
|
|
(identifier) @font-lock-variable-name-face)))
|
2023-02-05 15:46:28 +02:00
|
|
|
|
2022-12-11 18:41:16 -05:00
|
|
|
:language 'go
|
|
|
|
:feature 'function
|
|
|
|
'((call_expression
|
2023-02-25 03:15:46 +02:00
|
|
|
function: (identifier) @font-lock-function-call-face)
|
2022-12-11 18:41:16 -05:00
|
|
|
(call_expression
|
|
|
|
function: (selector_expression
|
2023-02-25 03:15:46 +02:00
|
|
|
field: (field_identifier) @font-lock-function-call-face)))
|
2022-12-11 18:41:16 -05:00
|
|
|
|
|
|
|
: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)
|
|
|
|
|
2023-02-06 04:12:25 +02:00
|
|
|
:language 'go
|
|
|
|
:feature 'property
|
2023-02-28 04:07:55 +02:00
|
|
|
'((selector_expression field: (field_identifier) @font-lock-property-use-face)
|
|
|
|
(keyed_element (_ (identifier) @font-lock-property-use-face)))
|
2023-02-06 04:12:25 +02:00
|
|
|
|
2022-12-11 18:41:16 -05:00
|
|
|
:language 'go
|
|
|
|
:feature 'variable
|
2023-02-28 04:07:55 +02:00
|
|
|
'((identifier) @font-lock-variable-use-face)
|
2022-12-11 18:41:16 -05:00
|
|
|
|
|
|
|
:language 'go
|
|
|
|
:feature 'escape-sequence
|
|
|
|
:override t
|
|
|
|
'((escape_sequence) @font-lock-escape-face)
|
|
|
|
|
|
|
|
:language 'go
|
|
|
|
:feature 'error
|
|
|
|
:override t
|
|
|
|
'((ERROR) @font-lock-warning-face))
|
|
|
|
"Tree-sitter font-lock settings for `go-ts-mode'.")
|
|
|
|
|
2023-01-14 08:28:06 +02:00
|
|
|
(defvar-keymap go-ts-mode-map
|
|
|
|
:doc "Keymap used in Go mode, powered by tree-sitter"
|
|
|
|
:parent prog-mode-map
|
2024-05-14 00:14:03 +05:30
|
|
|
"C-c C-d" #'go-ts-mode-docstring
|
|
|
|
"C-c C-t t" #'go-ts-mode-test-function-at-point
|
|
|
|
"C-c C-t f" #'go-ts-mode-test-this-file
|
|
|
|
"C-c C-t p" #'go-ts-mode-test-this-package)
|
2023-01-14 08:28:06 +02:00
|
|
|
|
2022-12-11 18:41:16 -05:00
|
|
|
;;;###autoload
|
|
|
|
(define-derived-mode go-ts-mode prog-mode "Go"
|
2023-01-14 08:28:06 +02:00
|
|
|
"Major mode for editing Go, powered by tree-sitter.
|
|
|
|
|
|
|
|
\\{go-ts-mode-map}"
|
2022-12-11 18:41:16 -05:00
|
|
|
:group 'go
|
|
|
|
:syntax-table go-ts-mode--syntax-table
|
|
|
|
|
2025-04-18 19:22:50 +03:00
|
|
|
(when (treesit-ensure-installed 'go)
|
2024-10-07 17:24:32 -07:00
|
|
|
(setq treesit-primary-parser (treesit-parser-create 'go))
|
2022-12-11 18:41:16 -05:00
|
|
|
|
|
|
|
;; Comments.
|
2025-02-11 20:38:00 -08:00
|
|
|
(c-ts-common-comment-setup)
|
2022-12-11 18:41:16 -05:00
|
|
|
|
2022-12-29 17:49:40 +02:00
|
|
|
;; Navigation.
|
|
|
|
(setq-local treesit-defun-type-regexp
|
|
|
|
(regexp-opt '("method_declaration"
|
|
|
|
"function_declaration"
|
|
|
|
"type_declaration")))
|
|
|
|
(setq-local treesit-defun-name-function #'go-ts-mode--defun-name)
|
|
|
|
|
2025-03-15 20:37:46 +02:00
|
|
|
(setq-local treesit-thing-settings
|
|
|
|
`((go
|
|
|
|
(list
|
|
|
|
,(rx bos (or "import_spec_list"
|
|
|
|
"var_spec_list"
|
|
|
|
"type_parameter_list"
|
|
|
|
"parameter_list"
|
|
|
|
"parenthesized_type"
|
|
|
|
"type_arguments"
|
|
|
|
"field_declaration_list"
|
|
|
|
"block"
|
|
|
|
"parenthesized_expression"
|
|
|
|
"special_argument_list"
|
|
|
|
"argument_list"
|
|
|
|
"literal_value")
|
|
|
|
eos))
|
2025-04-10 19:20:35 +03:00
|
|
|
(sexp-default
|
|
|
|
;; For `C-M-f' in "switch a |{ }"
|
|
|
|
(lambda (node)
|
|
|
|
(equal (treesit-node-type (treesit-node-parent node))
|
|
|
|
"expression_switch_statement")))
|
2025-03-15 20:37:46 +02:00
|
|
|
(sentence
|
|
|
|
(or "declaration" "statement")))))
|
|
|
|
|
2022-12-11 18:41:16 -05:00
|
|
|
;; Imenu.
|
2022-12-29 17:49:40 +02:00
|
|
|
(setq-local treesit-simple-imenu-settings
|
|
|
|
`(("Function" "\\`function_declaration\\'" nil nil)
|
|
|
|
("Method" "\\`method_declaration\\'" nil nil)
|
|
|
|
("Struct" "\\`type_declaration\\'" go-ts-mode--struct-node-p nil)
|
|
|
|
("Interface" "\\`type_declaration\\'" go-ts-mode--interface-node-p nil)
|
|
|
|
("Type" "\\`type_declaration\\'" go-ts-mode--other-type-node-p nil)
|
|
|
|
("Alias" "\\`type_declaration\\'" go-ts-mode--alias-node-p nil)))
|
2022-12-11 18:41:16 -05:00
|
|
|
|
|
|
|
;; Indent.
|
|
|
|
(setq-local indent-tabs-mode t
|
|
|
|
treesit-simple-indent-rules go-ts-mode--indent-rules)
|
|
|
|
|
2022-12-29 17:49:40 +02:00
|
|
|
;; Electric
|
|
|
|
(setq-local electric-indent-chars
|
|
|
|
(append "{}()" electric-indent-chars))
|
|
|
|
|
2022-12-11 18:41:16 -05:00
|
|
|
;; Font-lock.
|
|
|
|
(setq-local treesit-font-lock-settings go-ts-mode--font-lock-settings)
|
|
|
|
(setq-local treesit-font-lock-feature-list
|
2023-02-05 15:46:28 +02:00
|
|
|
'(( comment definition)
|
2022-12-11 18:41:16 -05:00
|
|
|
( keyword string type)
|
2024-04-18 09:38:28 -04:00
|
|
|
( builtin constant escape-sequence label number)
|
2023-02-05 15:46:28 +02:00
|
|
|
( bracket delimiter error function operator property variable)))
|
2022-12-11 18:41:16 -05:00
|
|
|
|
|
|
|
(treesit-major-mode-setup)))
|
|
|
|
|
2024-03-08 12:58:11 -05:00
|
|
|
(derived-mode-add-parents 'go-ts-mode '(go-mode))
|
|
|
|
|
2023-01-20 10:28:26 +02:00
|
|
|
(if (treesit-ready-p 'go)
|
2024-03-03 23:08:16 -05:00
|
|
|
;; FIXME: Should we instead put `go-mode' in `auto-mode-alist'
|
|
|
|
;; and then use `major-mode-remap-defaults' to map it to `go-ts-mode'?
|
2023-01-20 10:28:26 +02:00
|
|
|
(add-to-list 'auto-mode-alist '("\\.go\\'" . go-ts-mode)))
|
|
|
|
|
2023-02-08 17:16:02 +02:00
|
|
|
(defun go-ts-mode--defun-name (node &optional skip-prefix)
|
2022-12-29 17:49:40 +02:00
|
|
|
"Return the defun name of NODE.
|
2023-02-08 17:16:02 +02:00
|
|
|
Return nil if there is no name or if NODE is not a defun node.
|
|
|
|
Methods are prefixed with the receiver name, unless SKIP-PREFIX is t."
|
2022-12-29 17:49:40 +02:00
|
|
|
(pcase (treesit-node-type node)
|
|
|
|
("function_declaration"
|
|
|
|
(treesit-node-text
|
|
|
|
(treesit-node-child-by-field-name
|
|
|
|
node "name")
|
|
|
|
t))
|
|
|
|
("method_declaration"
|
|
|
|
(let* ((receiver-node (treesit-node-child-by-field-name node "receiver"))
|
2023-02-08 17:16:02 +02:00
|
|
|
(receiver (treesit-node-text (treesit-search-subtree receiver-node "type_identifier")))
|
|
|
|
(method (treesit-node-text (treesit-node-child-by-field-name node "name"))))
|
|
|
|
(if skip-prefix method
|
|
|
|
(concat "(" receiver ")." method))))
|
2022-12-29 17:49:40 +02:00
|
|
|
("type_declaration"
|
|
|
|
(treesit-node-text
|
|
|
|
(treesit-node-child-by-field-name
|
|
|
|
(treesit-node-child node 0 t) "name")
|
|
|
|
t))))
|
|
|
|
|
|
|
|
(defun go-ts-mode--interface-node-p (node)
|
|
|
|
"Return t if NODE is an interface."
|
|
|
|
(and
|
|
|
|
(string-equal "type_declaration" (treesit-node-type node))
|
|
|
|
(treesit-search-subtree node "interface_type" nil nil 2)))
|
|
|
|
|
|
|
|
(defun go-ts-mode--struct-node-p (node)
|
|
|
|
"Return t if NODE is a struct."
|
|
|
|
(and
|
|
|
|
(string-equal "type_declaration" (treesit-node-type node))
|
|
|
|
(treesit-search-subtree node "struct_type" nil nil 2)))
|
|
|
|
|
|
|
|
(defun go-ts-mode--alias-node-p (node)
|
|
|
|
"Return t if NODE is a type alias."
|
|
|
|
(and
|
|
|
|
(string-equal "type_declaration" (treesit-node-type node))
|
|
|
|
(treesit-search-subtree node "type_alias" nil nil 1)))
|
|
|
|
|
|
|
|
(defun go-ts-mode--other-type-node-p (node)
|
2023-05-04 16:37:39 +03:00
|
|
|
"Return t if NODE is a type other than interface, struct, or alias."
|
2022-12-29 17:49:40 +02:00
|
|
|
(and
|
|
|
|
(string-equal "type_declaration" (treesit-node-type node))
|
|
|
|
(not (go-ts-mode--interface-node-p node))
|
|
|
|
(not (go-ts-mode--struct-node-p node))
|
|
|
|
(not (go-ts-mode--alias-node-p node))))
|
|
|
|
|
2023-01-14 08:28:06 +02:00
|
|
|
(defun go-ts-mode-docstring ()
|
|
|
|
"Add a docstring comment for the current defun.
|
|
|
|
The added docstring is prefilled with the defun's name. If the
|
|
|
|
comment already exists, jump to it."
|
|
|
|
(interactive)
|
Mark if-let and when-let obsolete
* lisp/subr.el (if-let*, when-let*, if-let, when-let): Mark
if-let and when-let obsolete (bug#73853 and elsewhere). Move
docstring text around so that if-let* and when-let* descriptions
no longer refer to if-let and when-let.
* etc/NEWS: Announce the change.
* admin/admin.el (reminder-for-release-blocking-bugs):
* doc/misc/erc.texi (display-buffer):
* lisp/ansi-color.el (ansi-color-apply)
(ansi-color--face-vec-face):
* lisp/ansi-osc.el (ansi-osc-apply-on-region)
(ansi-osc-hyperlink):
* lisp/arc-mode.el (archive-goto-file)
(archive-next-file-displayer):
* lisp/auth-source-pass.el (auth-source-pass-search)
(auth-source-pass--parse-data)
(auth-source-pass--find-match-many):
* lisp/autorevert.el (auto-revert-notify-rm-watch):
* lisp/buff-menu.el (Buffer-menu-unmark-all-buffers)
(Buffer-menu-group-by-root):
* lisp/calendar/parse-time.el (parse-iso8601-time-string):
* lisp/cedet/pulse.el (pulse-tick):
* lisp/comint.el (comint--fontify-input-ppss-flush-indirect)
(comint--intersect-regions):
* lisp/completion-preview.el (completion-preview--try-table)
(completion-preview--capf-wrapper, completion-preview--update):
* lisp/cus-edit.el (setopt--set)
(custom-dirlocals-maybe-update-cons, custom-dirlocals-validate):
* lisp/custom.el (load-theme):
* lisp/descr-text.el (describe-char):
* lisp/desktop.el (desktop--emacs-pid-running-p):
* lisp/dired-x.el (menu):
* lisp/dired.el (dired-font-lock-keywords)
(dired-insert-directory, dired--insert-disk-space, dired-mode):
* lisp/dnd.el (dnd-handle-multiple-urls):
* lisp/dom.el (dom-remove-attribute):
* lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker):
* lisp/emacs-lisp/bytecomp.el (bytecomp--custom-declare):
* lisp/emacs-lisp/comp-common.el (comp-function-type-spec):
* lisp/emacs-lisp/comp-cstr.el (comp--all-classes)
(comp-cstr-set-range-for-arithm, comp--cstr-union-1-no-mem)
(comp-cstr-intersection-no-mem, comp-cstr-fixnum-p)
(comp-cstr-type-p):
* lisp/emacs-lisp/comp-run.el (comp-subr-trampoline-install)
(native--compile-async):
* lisp/emacs-lisp/comp.el (comp--get-function-cstr)
(comp--function-pure-p, comp--intern-func-in-ctxt)
(comp--addr-to-bb-name, comp--emit-assume, comp--maybe-add-vmvar)
(comp--add-call-cstr, comp--compute-dominator-tree)
(comp--dom-tree-walker, comp--ssa-rename)
(comp--function-call-maybe-fold, comp--fwprop-call)
(comp--call-optim-func):
* lisp/emacs-lisp/edebug.el (edebug-global-prefix)
(edebug-remove-instrumentation):
* lisp/emacs-lisp/eieio.el (initialize-instance):
* lisp/emacs-lisp/ert-x.el (ert-resource-directory):
* lisp/emacs-lisp/ert.el (ert--expand-should-1)
(ert-test-location, ert-write-junit-test-report)
(ert-test--erts-test):
* lisp/emacs-lisp/icons.el (icon-complete-spec, icon-string)
(icons--create):
* lisp/emacs-lisp/lisp-mode.el (lisp--local-defform-body-p):
* lisp/emacs-lisp/loaddefs-gen.el
(loaddefs-generate--make-autoload)
(loaddefs-generate--parse-file):
* lisp/emacs-lisp/multisession.el
(multisession-edit-mode--revert, multisession-edit-value):
* lisp/emacs-lisp/package-vc.el (package-vc--read-archive-data)
(package-vc--version, package-vc--clone):
* lisp/emacs-lisp/package.el (package--reload-previously-loaded):
* lisp/emacs-lisp/pp.el (pp--insert-lisp):
* lisp/emacs-lisp/subr-x.el (add-display-text-property):
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-print):
* lisp/emacs-lisp/timer.el (run-at-time):
* lisp/emacs-lisp/vtable.el (vtable-goto-table)
(vtable-goto-column, vtable-update-object, vtable--insert-line)
(vtable--compute-widths, vtable--make-keymap):
* lisp/emacs-lisp/warnings.el (display-warning):
* lisp/epa-file.el (epa-file-insert-file-contents):
* lisp/epa.el (epa-show-key):
* lisp/erc/erc-backend.el (erc--split-line, erc--conceal-prompt)
(PRIVMSG, erc--get-isupport-entry):
* lisp/erc/erc-button.el (erc-button-add-nickname-buttons)
(erc--button-next):
* lisp/erc/erc-common.el (erc--find-group):
* lisp/erc/erc-fill.el (erc-fill, erc-fill-static)
(erc-fill--wrap-escape-hidden-speaker)
(erc-fill--wrap-unmerge-on-date-stamp)
(erc-fill--wrap-massage-initial-message-post-clear)
(erc-fill-wrap, erc-fill--wrap-rejigger-region):
* lisp/erc/erc-goodies.el (erc--scrolltobottom-all)
(erc--keep-place-indicator-on-window-buffer-change)
(keep-place-indicator, erc--keep-place-indicator-adjust-on-clear)
(erc-keep-place-move, erc--command-indicator-display):
* lisp/erc/erc-ibuffer.el (erc-members):
* lisp/erc/erc-join.el (erc-join--remove-requested-channel)
(erc-autojoin--join):
* lisp/erc/erc-networks.el
(erc-networks--id-qualifying-init-parts, erc-networks--id-reload)
(erc-networks--id-ensure-comparable)
(erc-networks--reclaim-orphaned-target-buffers)
(erc-networks--server-select):
* lisp/erc/erc-nicks.el (erc-nicks-invert)
(erc-nicks--redirect-face-widget-link, erc-nicks--highlight)
(erc-nicks--highlight-button)
(erc-nicks--list-faces-help-button-action, erc-nicks-list-faces)
(erc-nicks-refresh, erc-nicks--colors-from-faces)
(erc-nicks--track-prioritize)
(erc-nicks--remember-face-for-track):
* lisp/erc/erc-notify.el (querypoll, erc--querypoll-get-next)
(erc--querypoll-on-352, erc--querypoll-send):
* lisp/erc/erc-sasl.el (erc-sasl--read-password):
* lisp/erc/erc-services.el
(erc-services-issue-ghost-and-retry-nick):
* lisp/erc/erc-speedbar.el (erc-speedbar--ensure, nickbar)
(erc-speedbar-toggle-nicknames-window-lock)
(erc-speedbar--compose-nicks-face):
* lisp/erc/erc-stamp.el (erc-stamp--recover-on-reconnect)
(erc-stamp-prefix-log-filter, erc--conceal-prompt)
(erc--insert-timestamp-left, erc-insert-timestamp-right)
(erc-stamp--defer-date-insertion-on-post-modify)
(erc-insert-timestamp-left-and-right)
(erc-stamp--redo-right-stamp-post-clear)
(erc-stamp--reset-on-clear, erc-stamp--dedupe-date-stamps):
* lisp/erc/erc-status-sidebar.el (bufbar)
(erc-status-sidebar-prefer-target-as-name)
(erc-status-sidebar-default-allsort, erc-status-sidebar-click):
* lisp/erc/erc-track.el (erc-track--shortened-names-get)
(erc-track--setup, erc-track--select-mode-line-face)
(erc-track-modified-channels, erc-track--collect-faces-in)
(erc-track--switch-buffer, erc-track--replace-killed-buffer):
* lisp/erc/erc-truncate.el (erc-truncate--setup)
(erc-truncate-buffer):
* lisp/erc/erc.el (erc--ensure-query-member)
(erc--ensure-query-members, erc--remove-channel-users-but)
(erc--cusr-change-status, erc--find-mode, erc--update-modules)
(erc-log-irc-protocol, erc--refresh-prompt)
(erc--restore-important-text-props)
(erc--order-text-properties-from-hash, erc-send-input-line)
(erc-cmd-IGNORE, erc--unignore-user, erc-cmd-QUERY)
(erc-cmd-BANLIST, erc--speakerize-nick)
(erc--format-speaker-input-message, erc-channel-receive-names)
(erc-send-current-line, erc-format-target-and/or-network)
(erc-kill-buffer-function, erc-restore-text-properties)
(erc--get-eq-comparable-cmd):
* lisp/eshell/em-alias.el (eshell-maybe-replace-by-alias--which)
(eshell-maybe-replace-by-alias):
* lisp/eshell/em-glob.el (eshell-glob-convert):
* lisp/eshell/em-pred.el (eshell-pred-user-or-group)
(eshell-pred-file-time, eshell-pred-file-type)
(eshell-pred-file-mode, eshell-pred-file-links)
(eshell-pred-file-size):
* lisp/eshell/em-prompt.el (eshell-forward-paragraph)
(eshell-next-prompt):
* lisp/eshell/esh-arg.el (eshell-resolve-current-argument):
* lisp/eshell/esh-cmd.el (eshell-do-eval, eshell/which)
(eshell-plain-command--which, eshell-plain-command):
* lisp/eshell/esh-io.el (eshell-duplicate-handles)
(eshell-protect-handles, eshell-get-target, eshell-close-target):
* lisp/eshell/esh-proc.el (eshell-sentinel):
* lisp/eshell/esh-var.el (eshell-parse-variable-ref)
(eshell-get-variable, eshell-set-variable):
* lisp/faces.el (face-at-point):
* lisp/ffap.el (ffap-in-project):
* lisp/filenotify.el (file-notify--rm-descriptor):
* lisp/files-x.el (read-dir-locals-file)
(connection-local-update-profile-variables)
(connection-local-value):
* lisp/files.el (file-remote-p, abbreviate-file-name)
(set-auto-mode, hack-local-variables)
(revert-buffer-restore-read-only):
* lisp/find-dired.el (find-dired-sort-by-filename):
* lisp/font-lock.el (font-lock--filter-keywords):
* lisp/gnus/gnus-art.el (article-emojize-symbols):
* lisp/gnus/gnus-int.el (gnus-close-server):
* lisp/gnus/gnus-search.el (gnus-search-transform)
(gnus-search-indexed-parse-output, gnus-search-server-to-engine):
* lisp/gnus/gnus-sum.el (gnus-collect-urls, gnus-shorten-url):
* lisp/gnus/gnus.el (gnus-check-backend-function):
* lisp/gnus/message.el (message-send-mail):
* lisp/gnus/mml.el (mml-generate-mime, mml-insert-mime-headers):
* lisp/gnus/nnatom.el (nnatom--read-feed, nnatom--read-article)
(nnatom--read-article-or-group-authors, nnatom--read-publish)
(nnatom--read-update, nnatom--read-links):
* lisp/gnus/nnfeed.el (nnfeed--read-server, nnfeed--write-server)
(nnfeed--parse-feed, nnfeed--group-data, nnfeed-retrieve-article)
(nnfeed-retrieve-headers, nnfeed--print-part)
(nnfeed-request-article, nnfeed-request-group)
(nnfeed-request-list, nnfeed--group-description)
(nnfeed-request-group-description)
(nnfeed-request-list-newsgroups, nnfeed-request-rename-group):
* lisp/gnus/nnmh.el (nnmh-update-gnus-unreads):
* lisp/help-fns.el (help-find-source)
(help-fns--insert-menu-bindings, help-fns--mention-first-release)
(help-fns--mention-shortdoc-groups)
(help-fns--customize-variable-version)
(help-fns--face-custom-version-info, describe-mode):
* lisp/help-mode.el (help-make-xrefs):
* lisp/help.el (help-key-description, help--describe-command):
* lisp/hfy-cmap.el (htmlfontify-load-rgb-file):
* lisp/ibuf-ext.el (ibuffer-jump-to-filter-group)
(ibuffer-kill-filter-group, ibuffer-kill-line)
(ibuffer-save-filter-groups, ibuffer-save-filters, filename)
(basename, file-extension, ibuffer-diff-buffer-with-file-1)
(ibuffer-mark-by-file-name-regexp)
(ibuffer-mark-by-content-regexp):
* lisp/ibuf-macs.el (ibuffer-aif, ibuffer-awhen):
* lisp/ibuffer.el (ibuffer-mouse-toggle-mark)
(ibuffer-toggle-marks, ibuffer-mark-interactive)
(ibuffer-compile-format, process, ibuffer-map-lines):
* lisp/image.el (image--compute-map)
(image--compute-original-map):
* lisp/image/exif.el (exif-parse-buffer):
* lisp/image/image-converter.el (image-convert-p, image-convert)
(image-converter--find-converter):
* lisp/image/image-dired-util.el
(image-dired-file-name-at-point):
* lisp/image/image-dired.el (image-dired-track-original-file)
(image-dired--on-file-in-dired-buffer)
(image-dired--with-thumbnail-buffer)
(image-dired-jump-original-dired-buffer)
(image-dired--slideshow-step, image-dired-display-image):
* lisp/image/wallpaper.el (wallpaper--init-action-kill)
(wallpaper--find-setter, wallpaper--find-command)
(wallpaper--find-command-args, wallpaper--x-monitor-name):
* lisp/info-look.el (info-lookup-interactive-arguments)
(info-complete)::(:mode):
* lisp/info.el (info-pop-to-buffer, Info-read-node-name-1):
* lisp/international/emoji.el (emoji--adjust-displayable-1)
(emoji--add-recent):
* lisp/jsonrpc.el (jsonrpc--call-deferred)
(jsonrpc--process-sentinel, jsonrpc--remove):
* lisp/keymap.el (keymap-local-lookup):
* lisp/mail/emacsbug.el (report-emacs-bug-hook)
(submit-emacs-patch):
* lisp/mail/ietf-drums.el (ietf-drums-parse-addresses):
* lisp/mail/mailclient.el (mailclient-send-it):
* lisp/mail/rfc6068.el (rfc6068-parse-mailto-url):
* lisp/mail/undigest.el (rmail-digest-parse-mixed-mime):
* lisp/minibuffer.el (completion-metadata-get)
(completions--after-change)
(minibuffer-visible-completions--filter):
* lisp/net/browse-url.el (browse-url-url-at-point)
(browse-url-file-url, browse-url-emacs):
* lisp/net/dbus.el (dbus-byte-array-to-string)
(dbus-monitor-goto-serial):
* lisp/net/dictionary.el (dictionary-search):
* lisp/net/eww.el (eww--download-directory)
(eww-auto-rename-buffer, eww-open-in-new-buffer, eww-submit)
(eww-follow-link, eww-read-alternate-url)
(eww-copy-alternate-url):
* lisp/net/goto-addr.el (goto-address-at-point):
* lisp/net/mailcap.el (mailcap-mime-info):
* lisp/net/rcirc.el (rcirc, rcirc-connect, rcirc-send-string)
(rcirc-kill-buffer-hook, rcirc-print, rcirc-when)
(rcirc-color-attributes, rcirc-handler-NICK)
(rcirc-handler-TAGMSG, rcirc-handler-BATCH):
* lisp/net/shr.el (shr-descend, shr-adaptive-fill-function)
(shr-correct-dom-case, shr-tag-a):
* lisp/net/sieve.el (sieve-manage-quit):
* lisp/outline.el (outline-cycle-buffer):
* lisp/pcmpl-git.el (pcmpl-git--tracked-file-predicate):
* lisp/proced.el (proced-auto-update-timer):
* lisp/progmodes/bug-reference.el
(bug-reference-try-setup-from-vc):
* lisp/progmodes/c-ts-common.el (c-ts-common--fill-paragraph):
* lisp/progmodes/c-ts-mode.el (c-ts-mode--preproc-offset)
(c-ts-mode--anchor-prev-sibling, c-ts-mode-indent-defun):
* lisp/progmodes/compile.el (compilation-error-properties)
(compilation-find-file-1):
* lisp/progmodes/eglot.el (eglot--check-object)
(eglot--read-server, eglot-upgrade-eglot)
(eglot-handle-notification, eglot--CompletionParams)
(eglot-completion-at-point, eglot--sig-info)
(eglot-register-capability):
* lisp/progmodes/elisp-mode.el
(emacs-lisp-native-compile-and-load)
(elisp-eldoc-var-docstring-with-value):
* lisp/progmodes/erts-mode.el (erts-mode--goto-start-of-test):
* lisp/progmodes/flymake.el (flymake--update-eol-overlays)
(flymake-eldoc-function):
* lisp/progmodes/gdb-mi.el (gdb-breakpoints-list-handler-custom)
(gdb-frame-handler):
* lisp/progmodes/go-ts-mode.el (go-ts-mode-docstring)
(go-ts-mode--comment-on-previous-line-p)
(go-ts-mode--get-test-regexp-at-point)
(go-ts-mode-test-this-file):
* lisp/progmodes/grep.el (lgrep, rgrep-default-command)
(grep-file-at-point):
* lisp/progmodes/perl-mode.el (perl--end-of-format-p):
* lisp/progmodes/php-ts-mode.el
(php-ts-mode--anchor-prev-sibling, php-ts-mode--indent-defun):
* lisp/progmodes/project.el (project--other-place-command)
(project--find-default-from, project--transplant-file-name)
(project-prefixed-buffer-name, project--remove-from-project-list)
(project-prompt-project-name, project-remember-projects-under)
(project--switch-project-command)
(project-uniquify-dirname-transform, project-mode-line-format):
* lisp/progmodes/python.el
(python-font-lock-keywords-maximum-decoration)
(python--treesit-fontify-union-types)
(python-shell-get-process-name, python-shell-restart)
(python-shell-completion-at-point, python-ffap-module-path)
(python-util-comint-end-of-output-p, python--import-sources)
(python-add-import, python-remove-import, python-fix-imports):
* lisp/progmodes/xref.el (xref--add-log-current-defun):
* lisp/repeat.el (repeat-echo-message-string):
* lisp/saveplace.el (save-place-dired-hook):
* lisp/server.el (server-save-buffers-kill-terminal):
* lisp/shadowfile.el (shadow-make-fullname)
(shadow-contract-file-name, shadow-define-literal-group):
* lisp/shell.el (shell-highlight-undef-mode):
* lisp/simple.el (command-completion-using-modes-p)
(command-execute, file-user-uid, file-group-gid)
(first-completion, last-completion, switch-to-completions):
* lisp/startup.el (startup--load-user-init-file):
* lisp/tab-line.el (tab-line-tabs-buffer-group-by-project):
* lisp/tar-mode.el (tar-goto-file, tar-next-file-displayer):
* lisp/term/android-win.el (android-encode-select-string)
(gui-backend-set-selection):
* lisp/term/haiku-win.el (haiku-dnd-convert-string)
(haiku-select-encode-xstring, haiku-select-encode-utf-8-string):
* lisp/textmodes/emacs-news-mode.el (emacs-news--buttonize):
* lisp/textmodes/ispell.el (ispell-completion-at-point):
* lisp/textmodes/sgml-mode.el (sgml-validate)
(html-mode--complete-at-point):
* lisp/textmodes/tex-mode.el (tex-recenter-output-buffer)
(xref-backend-references):
* lisp/thingatpt.el (thing-at-point-file-at-point)
(thing-at-point-face-at-point):
* lisp/thread.el (thread-list--get-status):
* lisp/time.el (world-clock-copy-time-as-kill, world-clock):
* lisp/touch-screen.el (touch-screen-handle-touch):
* lisp/treesit.el (treesit-language-at, treesit-node-at)
(treesit-node-on, treesit-buffer-root-node)
(treesit-node-field-name, treesit-local-parsers-at)
(treesit-local-parsers-on, treesit--cleanup-local-range-overlays)
(treesit-font-lock-recompute-features)
(treesit-font-lock-fontify-region, treesit-transpose-sexps)
(treesit-add-log-current-defun, treesit-major-mode-setup)
(treesit--explorer-refresh, treesit-install-language-grammar):
* lisp/url/url.el (url-retrieve-synchronously):
* lisp/vc/smerge-mode.el (smerge-diff):
* lisp/vc/vc-dir.el (vc-dir):
* lisp/vc/vc-dispatcher.el (vc-do-async-command):
* lisp/vc/vc-git.el (vc-git-dir--branch-headers)
(vc-git-dir--stash-headers, vc-git--log-edit-summary-check)
(vc-git-stash-list):
* lisp/vc/vc.el (vc-responsible-backend, vc-buffer-sync-fileset)
(vc-clone):
* lisp/visual-wrap.el (visual-wrap--apply-to-line):
* lisp/wid-edit.el (widget-text)
(widget-editable-list-insert-before):
* lisp/window-tool-bar.el
(window-tool-bar--keymap-entry-to-string):
* lisp/window.el (display-buffer, display-buffer-full-frame)
(window-point-context-set, window-point-context-use)
(window-point-context-use-default-function):
* lisp/xdg.el (xdg-current-desktop):
* lisp/xwidget.el (xwidget-webkit-callback):
* lisp/yank-media.el (yank-media--get-selection)
(yank-media-types):
* test/lisp/comint-tests.el
(comint-tests/test-password-function):
* test/lisp/completion-preview-tests.el
(completion-preview-tests--capf):
* test/lisp/cus-edit-tests.el (with-cus-edit-test):
* test/lisp/erc/erc-scenarios-base-local-modules.el
(-phony-sblm-):
* test/lisp/erc/erc-scenarios-stamp.el
(erc-scenarios-stamp--on-post-modify):
* test/lisp/erc/erc-services-tests.el
(erc-services-tests--asp-parse-entry):
* test/lisp/erc/erc-tests.el (erc-modules--internal-property)
(erc--find-mode, erc-tests--update-modules):
* test/lisp/erc/resources/erc-d/erc-d-i.el
(erc-d-i--parse-message):
* test/lisp/erc/resources/erc-d/erc-d-t.el
(erc-d-t-kill-related-buffers, erc-d-t-with-cleanup):
* test/lisp/erc/resources/erc-d/erc-d-tests.el
(erc-d-i--parse-message--irc-parser-tests):
* test/lisp/erc/resources/erc-d/erc-d-u.el
(erc-d-u--read-exchange-slowly):
* test/lisp/erc/resources/erc-d/erc-d.el (erc-d--expire)
(erc-d--finalize-done, erc-d--command-handle-all):
* test/lisp/erc/resources/erc-scenarios-common.el
(erc-scenarios-common-with-cleanup):
* test/lisp/erc/resources/erc-tests-common.el
(erc-tests--common-display-message)
(erc-tests-common-create-subprocess):
* test/lisp/ibuffer-tests.el (ibuffer-test-Bug25058):
* test/lisp/international/mule-tests.el
(mule-cmds-tests--ucs-names-missing-names):
* test/lisp/progmodes/python-tests.el
(python-tests-get-shell-interpreter)
(python-tests--get-interpreter-info):
* test/lisp/progmodes/ruby-ts-mode-tests.el
(ruby-ts-resource-file):
* test/lisp/replace-tests.el (replace-tests-with-undo):
* test/src/emacs-tests.el (emacs-tests--seccomp-debug):
* test/src/process-tests.el (process-tests--emacs-command)
(process-tests--emacs-binary, process-tests--dump-file):
* test/src/treesit-tests.el (treesit--ert-test-defun-navigation):
Replace use of the now-obsolete if-let and when-let.
2024-10-24 16:50:07 +08:00
|
|
|
(when-let* ((defun-node (treesit-defun-at-point)))
|
2023-01-14 08:28:06 +02:00
|
|
|
(goto-char (treesit-node-start defun-node))
|
|
|
|
(if (go-ts-mode--comment-on-previous-line-p)
|
|
|
|
;; go to top comment line
|
|
|
|
(while (go-ts-mode--comment-on-previous-line-p)
|
|
|
|
(forward-line -1))
|
2023-02-08 17:16:02 +02:00
|
|
|
(insert "// " (go-ts-mode--defun-name defun-node t))
|
2023-01-14 08:28:06 +02:00
|
|
|
(newline)
|
|
|
|
(backward-char))))
|
|
|
|
|
|
|
|
(defun go-ts-mode--comment-on-previous-line-p ()
|
|
|
|
"Return t if the previous line is a comment."
|
Mark if-let and when-let obsolete
* lisp/subr.el (if-let*, when-let*, if-let, when-let): Mark
if-let and when-let obsolete (bug#73853 and elsewhere). Move
docstring text around so that if-let* and when-let* descriptions
no longer refer to if-let and when-let.
* etc/NEWS: Announce the change.
* admin/admin.el (reminder-for-release-blocking-bugs):
* doc/misc/erc.texi (display-buffer):
* lisp/ansi-color.el (ansi-color-apply)
(ansi-color--face-vec-face):
* lisp/ansi-osc.el (ansi-osc-apply-on-region)
(ansi-osc-hyperlink):
* lisp/arc-mode.el (archive-goto-file)
(archive-next-file-displayer):
* lisp/auth-source-pass.el (auth-source-pass-search)
(auth-source-pass--parse-data)
(auth-source-pass--find-match-many):
* lisp/autorevert.el (auto-revert-notify-rm-watch):
* lisp/buff-menu.el (Buffer-menu-unmark-all-buffers)
(Buffer-menu-group-by-root):
* lisp/calendar/parse-time.el (parse-iso8601-time-string):
* lisp/cedet/pulse.el (pulse-tick):
* lisp/comint.el (comint--fontify-input-ppss-flush-indirect)
(comint--intersect-regions):
* lisp/completion-preview.el (completion-preview--try-table)
(completion-preview--capf-wrapper, completion-preview--update):
* lisp/cus-edit.el (setopt--set)
(custom-dirlocals-maybe-update-cons, custom-dirlocals-validate):
* lisp/custom.el (load-theme):
* lisp/descr-text.el (describe-char):
* lisp/desktop.el (desktop--emacs-pid-running-p):
* lisp/dired-x.el (menu):
* lisp/dired.el (dired-font-lock-keywords)
(dired-insert-directory, dired--insert-disk-space, dired-mode):
* lisp/dnd.el (dnd-handle-multiple-urls):
* lisp/dom.el (dom-remove-attribute):
* lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker):
* lisp/emacs-lisp/bytecomp.el (bytecomp--custom-declare):
* lisp/emacs-lisp/comp-common.el (comp-function-type-spec):
* lisp/emacs-lisp/comp-cstr.el (comp--all-classes)
(comp-cstr-set-range-for-arithm, comp--cstr-union-1-no-mem)
(comp-cstr-intersection-no-mem, comp-cstr-fixnum-p)
(comp-cstr-type-p):
* lisp/emacs-lisp/comp-run.el (comp-subr-trampoline-install)
(native--compile-async):
* lisp/emacs-lisp/comp.el (comp--get-function-cstr)
(comp--function-pure-p, comp--intern-func-in-ctxt)
(comp--addr-to-bb-name, comp--emit-assume, comp--maybe-add-vmvar)
(comp--add-call-cstr, comp--compute-dominator-tree)
(comp--dom-tree-walker, comp--ssa-rename)
(comp--function-call-maybe-fold, comp--fwprop-call)
(comp--call-optim-func):
* lisp/emacs-lisp/edebug.el (edebug-global-prefix)
(edebug-remove-instrumentation):
* lisp/emacs-lisp/eieio.el (initialize-instance):
* lisp/emacs-lisp/ert-x.el (ert-resource-directory):
* lisp/emacs-lisp/ert.el (ert--expand-should-1)
(ert-test-location, ert-write-junit-test-report)
(ert-test--erts-test):
* lisp/emacs-lisp/icons.el (icon-complete-spec, icon-string)
(icons--create):
* lisp/emacs-lisp/lisp-mode.el (lisp--local-defform-body-p):
* lisp/emacs-lisp/loaddefs-gen.el
(loaddefs-generate--make-autoload)
(loaddefs-generate--parse-file):
* lisp/emacs-lisp/multisession.el
(multisession-edit-mode--revert, multisession-edit-value):
* lisp/emacs-lisp/package-vc.el (package-vc--read-archive-data)
(package-vc--version, package-vc--clone):
* lisp/emacs-lisp/package.el (package--reload-previously-loaded):
* lisp/emacs-lisp/pp.el (pp--insert-lisp):
* lisp/emacs-lisp/subr-x.el (add-display-text-property):
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-print):
* lisp/emacs-lisp/timer.el (run-at-time):
* lisp/emacs-lisp/vtable.el (vtable-goto-table)
(vtable-goto-column, vtable-update-object, vtable--insert-line)
(vtable--compute-widths, vtable--make-keymap):
* lisp/emacs-lisp/warnings.el (display-warning):
* lisp/epa-file.el (epa-file-insert-file-contents):
* lisp/epa.el (epa-show-key):
* lisp/erc/erc-backend.el (erc--split-line, erc--conceal-prompt)
(PRIVMSG, erc--get-isupport-entry):
* lisp/erc/erc-button.el (erc-button-add-nickname-buttons)
(erc--button-next):
* lisp/erc/erc-common.el (erc--find-group):
* lisp/erc/erc-fill.el (erc-fill, erc-fill-static)
(erc-fill--wrap-escape-hidden-speaker)
(erc-fill--wrap-unmerge-on-date-stamp)
(erc-fill--wrap-massage-initial-message-post-clear)
(erc-fill-wrap, erc-fill--wrap-rejigger-region):
* lisp/erc/erc-goodies.el (erc--scrolltobottom-all)
(erc--keep-place-indicator-on-window-buffer-change)
(keep-place-indicator, erc--keep-place-indicator-adjust-on-clear)
(erc-keep-place-move, erc--command-indicator-display):
* lisp/erc/erc-ibuffer.el (erc-members):
* lisp/erc/erc-join.el (erc-join--remove-requested-channel)
(erc-autojoin--join):
* lisp/erc/erc-networks.el
(erc-networks--id-qualifying-init-parts, erc-networks--id-reload)
(erc-networks--id-ensure-comparable)
(erc-networks--reclaim-orphaned-target-buffers)
(erc-networks--server-select):
* lisp/erc/erc-nicks.el (erc-nicks-invert)
(erc-nicks--redirect-face-widget-link, erc-nicks--highlight)
(erc-nicks--highlight-button)
(erc-nicks--list-faces-help-button-action, erc-nicks-list-faces)
(erc-nicks-refresh, erc-nicks--colors-from-faces)
(erc-nicks--track-prioritize)
(erc-nicks--remember-face-for-track):
* lisp/erc/erc-notify.el (querypoll, erc--querypoll-get-next)
(erc--querypoll-on-352, erc--querypoll-send):
* lisp/erc/erc-sasl.el (erc-sasl--read-password):
* lisp/erc/erc-services.el
(erc-services-issue-ghost-and-retry-nick):
* lisp/erc/erc-speedbar.el (erc-speedbar--ensure, nickbar)
(erc-speedbar-toggle-nicknames-window-lock)
(erc-speedbar--compose-nicks-face):
* lisp/erc/erc-stamp.el (erc-stamp--recover-on-reconnect)
(erc-stamp-prefix-log-filter, erc--conceal-prompt)
(erc--insert-timestamp-left, erc-insert-timestamp-right)
(erc-stamp--defer-date-insertion-on-post-modify)
(erc-insert-timestamp-left-and-right)
(erc-stamp--redo-right-stamp-post-clear)
(erc-stamp--reset-on-clear, erc-stamp--dedupe-date-stamps):
* lisp/erc/erc-status-sidebar.el (bufbar)
(erc-status-sidebar-prefer-target-as-name)
(erc-status-sidebar-default-allsort, erc-status-sidebar-click):
* lisp/erc/erc-track.el (erc-track--shortened-names-get)
(erc-track--setup, erc-track--select-mode-line-face)
(erc-track-modified-channels, erc-track--collect-faces-in)
(erc-track--switch-buffer, erc-track--replace-killed-buffer):
* lisp/erc/erc-truncate.el (erc-truncate--setup)
(erc-truncate-buffer):
* lisp/erc/erc.el (erc--ensure-query-member)
(erc--ensure-query-members, erc--remove-channel-users-but)
(erc--cusr-change-status, erc--find-mode, erc--update-modules)
(erc-log-irc-protocol, erc--refresh-prompt)
(erc--restore-important-text-props)
(erc--order-text-properties-from-hash, erc-send-input-line)
(erc-cmd-IGNORE, erc--unignore-user, erc-cmd-QUERY)
(erc-cmd-BANLIST, erc--speakerize-nick)
(erc--format-speaker-input-message, erc-channel-receive-names)
(erc-send-current-line, erc-format-target-and/or-network)
(erc-kill-buffer-function, erc-restore-text-properties)
(erc--get-eq-comparable-cmd):
* lisp/eshell/em-alias.el (eshell-maybe-replace-by-alias--which)
(eshell-maybe-replace-by-alias):
* lisp/eshell/em-glob.el (eshell-glob-convert):
* lisp/eshell/em-pred.el (eshell-pred-user-or-group)
(eshell-pred-file-time, eshell-pred-file-type)
(eshell-pred-file-mode, eshell-pred-file-links)
(eshell-pred-file-size):
* lisp/eshell/em-prompt.el (eshell-forward-paragraph)
(eshell-next-prompt):
* lisp/eshell/esh-arg.el (eshell-resolve-current-argument):
* lisp/eshell/esh-cmd.el (eshell-do-eval, eshell/which)
(eshell-plain-command--which, eshell-plain-command):
* lisp/eshell/esh-io.el (eshell-duplicate-handles)
(eshell-protect-handles, eshell-get-target, eshell-close-target):
* lisp/eshell/esh-proc.el (eshell-sentinel):
* lisp/eshell/esh-var.el (eshell-parse-variable-ref)
(eshell-get-variable, eshell-set-variable):
* lisp/faces.el (face-at-point):
* lisp/ffap.el (ffap-in-project):
* lisp/filenotify.el (file-notify--rm-descriptor):
* lisp/files-x.el (read-dir-locals-file)
(connection-local-update-profile-variables)
(connection-local-value):
* lisp/files.el (file-remote-p, abbreviate-file-name)
(set-auto-mode, hack-local-variables)
(revert-buffer-restore-read-only):
* lisp/find-dired.el (find-dired-sort-by-filename):
* lisp/font-lock.el (font-lock--filter-keywords):
* lisp/gnus/gnus-art.el (article-emojize-symbols):
* lisp/gnus/gnus-int.el (gnus-close-server):
* lisp/gnus/gnus-search.el (gnus-search-transform)
(gnus-search-indexed-parse-output, gnus-search-server-to-engine):
* lisp/gnus/gnus-sum.el (gnus-collect-urls, gnus-shorten-url):
* lisp/gnus/gnus.el (gnus-check-backend-function):
* lisp/gnus/message.el (message-send-mail):
* lisp/gnus/mml.el (mml-generate-mime, mml-insert-mime-headers):
* lisp/gnus/nnatom.el (nnatom--read-feed, nnatom--read-article)
(nnatom--read-article-or-group-authors, nnatom--read-publish)
(nnatom--read-update, nnatom--read-links):
* lisp/gnus/nnfeed.el (nnfeed--read-server, nnfeed--write-server)
(nnfeed--parse-feed, nnfeed--group-data, nnfeed-retrieve-article)
(nnfeed-retrieve-headers, nnfeed--print-part)
(nnfeed-request-article, nnfeed-request-group)
(nnfeed-request-list, nnfeed--group-description)
(nnfeed-request-group-description)
(nnfeed-request-list-newsgroups, nnfeed-request-rename-group):
* lisp/gnus/nnmh.el (nnmh-update-gnus-unreads):
* lisp/help-fns.el (help-find-source)
(help-fns--insert-menu-bindings, help-fns--mention-first-release)
(help-fns--mention-shortdoc-groups)
(help-fns--customize-variable-version)
(help-fns--face-custom-version-info, describe-mode):
* lisp/help-mode.el (help-make-xrefs):
* lisp/help.el (help-key-description, help--describe-command):
* lisp/hfy-cmap.el (htmlfontify-load-rgb-file):
* lisp/ibuf-ext.el (ibuffer-jump-to-filter-group)
(ibuffer-kill-filter-group, ibuffer-kill-line)
(ibuffer-save-filter-groups, ibuffer-save-filters, filename)
(basename, file-extension, ibuffer-diff-buffer-with-file-1)
(ibuffer-mark-by-file-name-regexp)
(ibuffer-mark-by-content-regexp):
* lisp/ibuf-macs.el (ibuffer-aif, ibuffer-awhen):
* lisp/ibuffer.el (ibuffer-mouse-toggle-mark)
(ibuffer-toggle-marks, ibuffer-mark-interactive)
(ibuffer-compile-format, process, ibuffer-map-lines):
* lisp/image.el (image--compute-map)
(image--compute-original-map):
* lisp/image/exif.el (exif-parse-buffer):
* lisp/image/image-converter.el (image-convert-p, image-convert)
(image-converter--find-converter):
* lisp/image/image-dired-util.el
(image-dired-file-name-at-point):
* lisp/image/image-dired.el (image-dired-track-original-file)
(image-dired--on-file-in-dired-buffer)
(image-dired--with-thumbnail-buffer)
(image-dired-jump-original-dired-buffer)
(image-dired--slideshow-step, image-dired-display-image):
* lisp/image/wallpaper.el (wallpaper--init-action-kill)
(wallpaper--find-setter, wallpaper--find-command)
(wallpaper--find-command-args, wallpaper--x-monitor-name):
* lisp/info-look.el (info-lookup-interactive-arguments)
(info-complete)::(:mode):
* lisp/info.el (info-pop-to-buffer, Info-read-node-name-1):
* lisp/international/emoji.el (emoji--adjust-displayable-1)
(emoji--add-recent):
* lisp/jsonrpc.el (jsonrpc--call-deferred)
(jsonrpc--process-sentinel, jsonrpc--remove):
* lisp/keymap.el (keymap-local-lookup):
* lisp/mail/emacsbug.el (report-emacs-bug-hook)
(submit-emacs-patch):
* lisp/mail/ietf-drums.el (ietf-drums-parse-addresses):
* lisp/mail/mailclient.el (mailclient-send-it):
* lisp/mail/rfc6068.el (rfc6068-parse-mailto-url):
* lisp/mail/undigest.el (rmail-digest-parse-mixed-mime):
* lisp/minibuffer.el (completion-metadata-get)
(completions--after-change)
(minibuffer-visible-completions--filter):
* lisp/net/browse-url.el (browse-url-url-at-point)
(browse-url-file-url, browse-url-emacs):
* lisp/net/dbus.el (dbus-byte-array-to-string)
(dbus-monitor-goto-serial):
* lisp/net/dictionary.el (dictionary-search):
* lisp/net/eww.el (eww--download-directory)
(eww-auto-rename-buffer, eww-open-in-new-buffer, eww-submit)
(eww-follow-link, eww-read-alternate-url)
(eww-copy-alternate-url):
* lisp/net/goto-addr.el (goto-address-at-point):
* lisp/net/mailcap.el (mailcap-mime-info):
* lisp/net/rcirc.el (rcirc, rcirc-connect, rcirc-send-string)
(rcirc-kill-buffer-hook, rcirc-print, rcirc-when)
(rcirc-color-attributes, rcirc-handler-NICK)
(rcirc-handler-TAGMSG, rcirc-handler-BATCH):
* lisp/net/shr.el (shr-descend, shr-adaptive-fill-function)
(shr-correct-dom-case, shr-tag-a):
* lisp/net/sieve.el (sieve-manage-quit):
* lisp/outline.el (outline-cycle-buffer):
* lisp/pcmpl-git.el (pcmpl-git--tracked-file-predicate):
* lisp/proced.el (proced-auto-update-timer):
* lisp/progmodes/bug-reference.el
(bug-reference-try-setup-from-vc):
* lisp/progmodes/c-ts-common.el (c-ts-common--fill-paragraph):
* lisp/progmodes/c-ts-mode.el (c-ts-mode--preproc-offset)
(c-ts-mode--anchor-prev-sibling, c-ts-mode-indent-defun):
* lisp/progmodes/compile.el (compilation-error-properties)
(compilation-find-file-1):
* lisp/progmodes/eglot.el (eglot--check-object)
(eglot--read-server, eglot-upgrade-eglot)
(eglot-handle-notification, eglot--CompletionParams)
(eglot-completion-at-point, eglot--sig-info)
(eglot-register-capability):
* lisp/progmodes/elisp-mode.el
(emacs-lisp-native-compile-and-load)
(elisp-eldoc-var-docstring-with-value):
* lisp/progmodes/erts-mode.el (erts-mode--goto-start-of-test):
* lisp/progmodes/flymake.el (flymake--update-eol-overlays)
(flymake-eldoc-function):
* lisp/progmodes/gdb-mi.el (gdb-breakpoints-list-handler-custom)
(gdb-frame-handler):
* lisp/progmodes/go-ts-mode.el (go-ts-mode-docstring)
(go-ts-mode--comment-on-previous-line-p)
(go-ts-mode--get-test-regexp-at-point)
(go-ts-mode-test-this-file):
* lisp/progmodes/grep.el (lgrep, rgrep-default-command)
(grep-file-at-point):
* lisp/progmodes/perl-mode.el (perl--end-of-format-p):
* lisp/progmodes/php-ts-mode.el
(php-ts-mode--anchor-prev-sibling, php-ts-mode--indent-defun):
* lisp/progmodes/project.el (project--other-place-command)
(project--find-default-from, project--transplant-file-name)
(project-prefixed-buffer-name, project--remove-from-project-list)
(project-prompt-project-name, project-remember-projects-under)
(project--switch-project-command)
(project-uniquify-dirname-transform, project-mode-line-format):
* lisp/progmodes/python.el
(python-font-lock-keywords-maximum-decoration)
(python--treesit-fontify-union-types)
(python-shell-get-process-name, python-shell-restart)
(python-shell-completion-at-point, python-ffap-module-path)
(python-util-comint-end-of-output-p, python--import-sources)
(python-add-import, python-remove-import, python-fix-imports):
* lisp/progmodes/xref.el (xref--add-log-current-defun):
* lisp/repeat.el (repeat-echo-message-string):
* lisp/saveplace.el (save-place-dired-hook):
* lisp/server.el (server-save-buffers-kill-terminal):
* lisp/shadowfile.el (shadow-make-fullname)
(shadow-contract-file-name, shadow-define-literal-group):
* lisp/shell.el (shell-highlight-undef-mode):
* lisp/simple.el (command-completion-using-modes-p)
(command-execute, file-user-uid, file-group-gid)
(first-completion, last-completion, switch-to-completions):
* lisp/startup.el (startup--load-user-init-file):
* lisp/tab-line.el (tab-line-tabs-buffer-group-by-project):
* lisp/tar-mode.el (tar-goto-file, tar-next-file-displayer):
* lisp/term/android-win.el (android-encode-select-string)
(gui-backend-set-selection):
* lisp/term/haiku-win.el (haiku-dnd-convert-string)
(haiku-select-encode-xstring, haiku-select-encode-utf-8-string):
* lisp/textmodes/emacs-news-mode.el (emacs-news--buttonize):
* lisp/textmodes/ispell.el (ispell-completion-at-point):
* lisp/textmodes/sgml-mode.el (sgml-validate)
(html-mode--complete-at-point):
* lisp/textmodes/tex-mode.el (tex-recenter-output-buffer)
(xref-backend-references):
* lisp/thingatpt.el (thing-at-point-file-at-point)
(thing-at-point-face-at-point):
* lisp/thread.el (thread-list--get-status):
* lisp/time.el (world-clock-copy-time-as-kill, world-clock):
* lisp/touch-screen.el (touch-screen-handle-touch):
* lisp/treesit.el (treesit-language-at, treesit-node-at)
(treesit-node-on, treesit-buffer-root-node)
(treesit-node-field-name, treesit-local-parsers-at)
(treesit-local-parsers-on, treesit--cleanup-local-range-overlays)
(treesit-font-lock-recompute-features)
(treesit-font-lock-fontify-region, treesit-transpose-sexps)
(treesit-add-log-current-defun, treesit-major-mode-setup)
(treesit--explorer-refresh, treesit-install-language-grammar):
* lisp/url/url.el (url-retrieve-synchronously):
* lisp/vc/smerge-mode.el (smerge-diff):
* lisp/vc/vc-dir.el (vc-dir):
* lisp/vc/vc-dispatcher.el (vc-do-async-command):
* lisp/vc/vc-git.el (vc-git-dir--branch-headers)
(vc-git-dir--stash-headers, vc-git--log-edit-summary-check)
(vc-git-stash-list):
* lisp/vc/vc.el (vc-responsible-backend, vc-buffer-sync-fileset)
(vc-clone):
* lisp/visual-wrap.el (visual-wrap--apply-to-line):
* lisp/wid-edit.el (widget-text)
(widget-editable-list-insert-before):
* lisp/window-tool-bar.el
(window-tool-bar--keymap-entry-to-string):
* lisp/window.el (display-buffer, display-buffer-full-frame)
(window-point-context-set, window-point-context-use)
(window-point-context-use-default-function):
* lisp/xdg.el (xdg-current-desktop):
* lisp/xwidget.el (xwidget-webkit-callback):
* lisp/yank-media.el (yank-media--get-selection)
(yank-media-types):
* test/lisp/comint-tests.el
(comint-tests/test-password-function):
* test/lisp/completion-preview-tests.el
(completion-preview-tests--capf):
* test/lisp/cus-edit-tests.el (with-cus-edit-test):
* test/lisp/erc/erc-scenarios-base-local-modules.el
(-phony-sblm-):
* test/lisp/erc/erc-scenarios-stamp.el
(erc-scenarios-stamp--on-post-modify):
* test/lisp/erc/erc-services-tests.el
(erc-services-tests--asp-parse-entry):
* test/lisp/erc/erc-tests.el (erc-modules--internal-property)
(erc--find-mode, erc-tests--update-modules):
* test/lisp/erc/resources/erc-d/erc-d-i.el
(erc-d-i--parse-message):
* test/lisp/erc/resources/erc-d/erc-d-t.el
(erc-d-t-kill-related-buffers, erc-d-t-with-cleanup):
* test/lisp/erc/resources/erc-d/erc-d-tests.el
(erc-d-i--parse-message--irc-parser-tests):
* test/lisp/erc/resources/erc-d/erc-d-u.el
(erc-d-u--read-exchange-slowly):
* test/lisp/erc/resources/erc-d/erc-d.el (erc-d--expire)
(erc-d--finalize-done, erc-d--command-handle-all):
* test/lisp/erc/resources/erc-scenarios-common.el
(erc-scenarios-common-with-cleanup):
* test/lisp/erc/resources/erc-tests-common.el
(erc-tests--common-display-message)
(erc-tests-common-create-subprocess):
* test/lisp/ibuffer-tests.el (ibuffer-test-Bug25058):
* test/lisp/international/mule-tests.el
(mule-cmds-tests--ucs-names-missing-names):
* test/lisp/progmodes/python-tests.el
(python-tests-get-shell-interpreter)
(python-tests--get-interpreter-info):
* test/lisp/progmodes/ruby-ts-mode-tests.el
(ruby-ts-resource-file):
* test/lisp/replace-tests.el (replace-tests-with-undo):
* test/src/emacs-tests.el (emacs-tests--seccomp-debug):
* test/src/process-tests.el (process-tests--emacs-command)
(process-tests--emacs-binary, process-tests--dump-file):
* test/src/treesit-tests.el (treesit--ert-test-defun-navigation):
Replace use of the now-obsolete if-let and when-let.
2024-10-24 16:50:07 +08:00
|
|
|
(when-let* ((point (- (pos-bol) 1))
|
|
|
|
((> point 0))
|
|
|
|
(node (treesit-node-at point)))
|
2023-01-14 08:28:06 +02:00
|
|
|
(and
|
|
|
|
;; check point is actually inside the found node
|
|
|
|
;; treesit-node-at can return nodes after point
|
|
|
|
(<= (treesit-node-start node) point (treesit-node-end node))
|
|
|
|
(string-equal "comment" (treesit-node-type node)))))
|
|
|
|
|
2024-05-14 00:14:03 +05:30
|
|
|
(defun go-ts-mode--get-build-tags-flag ()
|
|
|
|
"Return the compile flag for build tags.
|
|
|
|
This function respects the `go-ts-mode-build-tags' variable for
|
|
|
|
specifying build tags."
|
|
|
|
(if go-ts-mode-build-tags
|
|
|
|
(format "-tags %s" (string-join go-ts-mode-build-tags ","))
|
|
|
|
""))
|
|
|
|
|
2024-12-19 09:53:02 +00:00
|
|
|
(defun go-ts-mode--get-test-flags ()
|
|
|
|
"Return the flags for test invocation."
|
|
|
|
(if go-ts-mode-test-flags
|
|
|
|
(mapconcat #'shell-quote-argument go-ts-mode-test-flags " ")
|
|
|
|
""))
|
|
|
|
|
2024-05-14 00:14:03 +05:30
|
|
|
(defun go-ts-mode--compile-test (regexp)
|
|
|
|
"Compile the tests matching REGEXP.
|
|
|
|
This function respects the `go-ts-mode-build-tags' variable for
|
|
|
|
specifying build tags."
|
2024-12-19 09:53:02 +00:00
|
|
|
(compile (format "go test -v %s -run '%s' %s"
|
2024-05-14 00:14:03 +05:30
|
|
|
(go-ts-mode--get-build-tags-flag)
|
2024-12-19 09:53:02 +00:00
|
|
|
regexp
|
|
|
|
(go-ts-mode--get-test-flags))))
|
2024-05-14 00:14:03 +05:30
|
|
|
|
|
|
|
(defun go-ts-mode--find-defun-at (start)
|
|
|
|
"Return the first defun node from START."
|
|
|
|
(let ((thing (or treesit-defun-type-regexp 'defun)))
|
|
|
|
(or (treesit-thing-at start thing)
|
|
|
|
(treesit-thing-next start thing))))
|
|
|
|
|
|
|
|
(defun go-ts-mode--get-function-regexp (name)
|
|
|
|
(if name
|
|
|
|
(format "^%s$" name)
|
|
|
|
(error "No test function found")))
|
|
|
|
|
|
|
|
(defun go-ts-mode--get-functions-in-range (start end)
|
|
|
|
"Return a list with the names of all defuns in the range START to END."
|
|
|
|
(let* ((node (go-ts-mode--find-defun-at start))
|
|
|
|
(name (treesit-defun-name node))
|
|
|
|
(node-start (treesit-node-start node))
|
|
|
|
(node-end (treesit-node-end node)))
|
|
|
|
(cond ((or (not node)
|
|
|
|
(> start node-end)
|
|
|
|
(< end node-start))
|
|
|
|
nil)
|
|
|
|
((or (not (equal (treesit-node-type node) "function_declaration"))
|
|
|
|
(not (string-prefix-p "Test" name)))
|
|
|
|
(go-ts-mode--get-functions-in-range (treesit-node-end node) end))
|
|
|
|
(t
|
|
|
|
(cons (go-ts-mode--get-function-regexp name)
|
|
|
|
(go-ts-mode--get-functions-in-range (treesit-node-end node) end))))))
|
|
|
|
|
|
|
|
(defun go-ts-mode--get-test-regexp-at-point ()
|
|
|
|
"Return a regular expression for the tests at point.
|
|
|
|
If region is active, the regexp will include all the functions under the
|
|
|
|
region."
|
Mark if-let and when-let obsolete
* lisp/subr.el (if-let*, when-let*, if-let, when-let): Mark
if-let and when-let obsolete (bug#73853 and elsewhere). Move
docstring text around so that if-let* and when-let* descriptions
no longer refer to if-let and when-let.
* etc/NEWS: Announce the change.
* admin/admin.el (reminder-for-release-blocking-bugs):
* doc/misc/erc.texi (display-buffer):
* lisp/ansi-color.el (ansi-color-apply)
(ansi-color--face-vec-face):
* lisp/ansi-osc.el (ansi-osc-apply-on-region)
(ansi-osc-hyperlink):
* lisp/arc-mode.el (archive-goto-file)
(archive-next-file-displayer):
* lisp/auth-source-pass.el (auth-source-pass-search)
(auth-source-pass--parse-data)
(auth-source-pass--find-match-many):
* lisp/autorevert.el (auto-revert-notify-rm-watch):
* lisp/buff-menu.el (Buffer-menu-unmark-all-buffers)
(Buffer-menu-group-by-root):
* lisp/calendar/parse-time.el (parse-iso8601-time-string):
* lisp/cedet/pulse.el (pulse-tick):
* lisp/comint.el (comint--fontify-input-ppss-flush-indirect)
(comint--intersect-regions):
* lisp/completion-preview.el (completion-preview--try-table)
(completion-preview--capf-wrapper, completion-preview--update):
* lisp/cus-edit.el (setopt--set)
(custom-dirlocals-maybe-update-cons, custom-dirlocals-validate):
* lisp/custom.el (load-theme):
* lisp/descr-text.el (describe-char):
* lisp/desktop.el (desktop--emacs-pid-running-p):
* lisp/dired-x.el (menu):
* lisp/dired.el (dired-font-lock-keywords)
(dired-insert-directory, dired--insert-disk-space, dired-mode):
* lisp/dnd.el (dnd-handle-multiple-urls):
* lisp/dom.el (dom-remove-attribute):
* lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker):
* lisp/emacs-lisp/bytecomp.el (bytecomp--custom-declare):
* lisp/emacs-lisp/comp-common.el (comp-function-type-spec):
* lisp/emacs-lisp/comp-cstr.el (comp--all-classes)
(comp-cstr-set-range-for-arithm, comp--cstr-union-1-no-mem)
(comp-cstr-intersection-no-mem, comp-cstr-fixnum-p)
(comp-cstr-type-p):
* lisp/emacs-lisp/comp-run.el (comp-subr-trampoline-install)
(native--compile-async):
* lisp/emacs-lisp/comp.el (comp--get-function-cstr)
(comp--function-pure-p, comp--intern-func-in-ctxt)
(comp--addr-to-bb-name, comp--emit-assume, comp--maybe-add-vmvar)
(comp--add-call-cstr, comp--compute-dominator-tree)
(comp--dom-tree-walker, comp--ssa-rename)
(comp--function-call-maybe-fold, comp--fwprop-call)
(comp--call-optim-func):
* lisp/emacs-lisp/edebug.el (edebug-global-prefix)
(edebug-remove-instrumentation):
* lisp/emacs-lisp/eieio.el (initialize-instance):
* lisp/emacs-lisp/ert-x.el (ert-resource-directory):
* lisp/emacs-lisp/ert.el (ert--expand-should-1)
(ert-test-location, ert-write-junit-test-report)
(ert-test--erts-test):
* lisp/emacs-lisp/icons.el (icon-complete-spec, icon-string)
(icons--create):
* lisp/emacs-lisp/lisp-mode.el (lisp--local-defform-body-p):
* lisp/emacs-lisp/loaddefs-gen.el
(loaddefs-generate--make-autoload)
(loaddefs-generate--parse-file):
* lisp/emacs-lisp/multisession.el
(multisession-edit-mode--revert, multisession-edit-value):
* lisp/emacs-lisp/package-vc.el (package-vc--read-archive-data)
(package-vc--version, package-vc--clone):
* lisp/emacs-lisp/package.el (package--reload-previously-loaded):
* lisp/emacs-lisp/pp.el (pp--insert-lisp):
* lisp/emacs-lisp/subr-x.el (add-display-text-property):
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-print):
* lisp/emacs-lisp/timer.el (run-at-time):
* lisp/emacs-lisp/vtable.el (vtable-goto-table)
(vtable-goto-column, vtable-update-object, vtable--insert-line)
(vtable--compute-widths, vtable--make-keymap):
* lisp/emacs-lisp/warnings.el (display-warning):
* lisp/epa-file.el (epa-file-insert-file-contents):
* lisp/epa.el (epa-show-key):
* lisp/erc/erc-backend.el (erc--split-line, erc--conceal-prompt)
(PRIVMSG, erc--get-isupport-entry):
* lisp/erc/erc-button.el (erc-button-add-nickname-buttons)
(erc--button-next):
* lisp/erc/erc-common.el (erc--find-group):
* lisp/erc/erc-fill.el (erc-fill, erc-fill-static)
(erc-fill--wrap-escape-hidden-speaker)
(erc-fill--wrap-unmerge-on-date-stamp)
(erc-fill--wrap-massage-initial-message-post-clear)
(erc-fill-wrap, erc-fill--wrap-rejigger-region):
* lisp/erc/erc-goodies.el (erc--scrolltobottom-all)
(erc--keep-place-indicator-on-window-buffer-change)
(keep-place-indicator, erc--keep-place-indicator-adjust-on-clear)
(erc-keep-place-move, erc--command-indicator-display):
* lisp/erc/erc-ibuffer.el (erc-members):
* lisp/erc/erc-join.el (erc-join--remove-requested-channel)
(erc-autojoin--join):
* lisp/erc/erc-networks.el
(erc-networks--id-qualifying-init-parts, erc-networks--id-reload)
(erc-networks--id-ensure-comparable)
(erc-networks--reclaim-orphaned-target-buffers)
(erc-networks--server-select):
* lisp/erc/erc-nicks.el (erc-nicks-invert)
(erc-nicks--redirect-face-widget-link, erc-nicks--highlight)
(erc-nicks--highlight-button)
(erc-nicks--list-faces-help-button-action, erc-nicks-list-faces)
(erc-nicks-refresh, erc-nicks--colors-from-faces)
(erc-nicks--track-prioritize)
(erc-nicks--remember-face-for-track):
* lisp/erc/erc-notify.el (querypoll, erc--querypoll-get-next)
(erc--querypoll-on-352, erc--querypoll-send):
* lisp/erc/erc-sasl.el (erc-sasl--read-password):
* lisp/erc/erc-services.el
(erc-services-issue-ghost-and-retry-nick):
* lisp/erc/erc-speedbar.el (erc-speedbar--ensure, nickbar)
(erc-speedbar-toggle-nicknames-window-lock)
(erc-speedbar--compose-nicks-face):
* lisp/erc/erc-stamp.el (erc-stamp--recover-on-reconnect)
(erc-stamp-prefix-log-filter, erc--conceal-prompt)
(erc--insert-timestamp-left, erc-insert-timestamp-right)
(erc-stamp--defer-date-insertion-on-post-modify)
(erc-insert-timestamp-left-and-right)
(erc-stamp--redo-right-stamp-post-clear)
(erc-stamp--reset-on-clear, erc-stamp--dedupe-date-stamps):
* lisp/erc/erc-status-sidebar.el (bufbar)
(erc-status-sidebar-prefer-target-as-name)
(erc-status-sidebar-default-allsort, erc-status-sidebar-click):
* lisp/erc/erc-track.el (erc-track--shortened-names-get)
(erc-track--setup, erc-track--select-mode-line-face)
(erc-track-modified-channels, erc-track--collect-faces-in)
(erc-track--switch-buffer, erc-track--replace-killed-buffer):
* lisp/erc/erc-truncate.el (erc-truncate--setup)
(erc-truncate-buffer):
* lisp/erc/erc.el (erc--ensure-query-member)
(erc--ensure-query-members, erc--remove-channel-users-but)
(erc--cusr-change-status, erc--find-mode, erc--update-modules)
(erc-log-irc-protocol, erc--refresh-prompt)
(erc--restore-important-text-props)
(erc--order-text-properties-from-hash, erc-send-input-line)
(erc-cmd-IGNORE, erc--unignore-user, erc-cmd-QUERY)
(erc-cmd-BANLIST, erc--speakerize-nick)
(erc--format-speaker-input-message, erc-channel-receive-names)
(erc-send-current-line, erc-format-target-and/or-network)
(erc-kill-buffer-function, erc-restore-text-properties)
(erc--get-eq-comparable-cmd):
* lisp/eshell/em-alias.el (eshell-maybe-replace-by-alias--which)
(eshell-maybe-replace-by-alias):
* lisp/eshell/em-glob.el (eshell-glob-convert):
* lisp/eshell/em-pred.el (eshell-pred-user-or-group)
(eshell-pred-file-time, eshell-pred-file-type)
(eshell-pred-file-mode, eshell-pred-file-links)
(eshell-pred-file-size):
* lisp/eshell/em-prompt.el (eshell-forward-paragraph)
(eshell-next-prompt):
* lisp/eshell/esh-arg.el (eshell-resolve-current-argument):
* lisp/eshell/esh-cmd.el (eshell-do-eval, eshell/which)
(eshell-plain-command--which, eshell-plain-command):
* lisp/eshell/esh-io.el (eshell-duplicate-handles)
(eshell-protect-handles, eshell-get-target, eshell-close-target):
* lisp/eshell/esh-proc.el (eshell-sentinel):
* lisp/eshell/esh-var.el (eshell-parse-variable-ref)
(eshell-get-variable, eshell-set-variable):
* lisp/faces.el (face-at-point):
* lisp/ffap.el (ffap-in-project):
* lisp/filenotify.el (file-notify--rm-descriptor):
* lisp/files-x.el (read-dir-locals-file)
(connection-local-update-profile-variables)
(connection-local-value):
* lisp/files.el (file-remote-p, abbreviate-file-name)
(set-auto-mode, hack-local-variables)
(revert-buffer-restore-read-only):
* lisp/find-dired.el (find-dired-sort-by-filename):
* lisp/font-lock.el (font-lock--filter-keywords):
* lisp/gnus/gnus-art.el (article-emojize-symbols):
* lisp/gnus/gnus-int.el (gnus-close-server):
* lisp/gnus/gnus-search.el (gnus-search-transform)
(gnus-search-indexed-parse-output, gnus-search-server-to-engine):
* lisp/gnus/gnus-sum.el (gnus-collect-urls, gnus-shorten-url):
* lisp/gnus/gnus.el (gnus-check-backend-function):
* lisp/gnus/message.el (message-send-mail):
* lisp/gnus/mml.el (mml-generate-mime, mml-insert-mime-headers):
* lisp/gnus/nnatom.el (nnatom--read-feed, nnatom--read-article)
(nnatom--read-article-or-group-authors, nnatom--read-publish)
(nnatom--read-update, nnatom--read-links):
* lisp/gnus/nnfeed.el (nnfeed--read-server, nnfeed--write-server)
(nnfeed--parse-feed, nnfeed--group-data, nnfeed-retrieve-article)
(nnfeed-retrieve-headers, nnfeed--print-part)
(nnfeed-request-article, nnfeed-request-group)
(nnfeed-request-list, nnfeed--group-description)
(nnfeed-request-group-description)
(nnfeed-request-list-newsgroups, nnfeed-request-rename-group):
* lisp/gnus/nnmh.el (nnmh-update-gnus-unreads):
* lisp/help-fns.el (help-find-source)
(help-fns--insert-menu-bindings, help-fns--mention-first-release)
(help-fns--mention-shortdoc-groups)
(help-fns--customize-variable-version)
(help-fns--face-custom-version-info, describe-mode):
* lisp/help-mode.el (help-make-xrefs):
* lisp/help.el (help-key-description, help--describe-command):
* lisp/hfy-cmap.el (htmlfontify-load-rgb-file):
* lisp/ibuf-ext.el (ibuffer-jump-to-filter-group)
(ibuffer-kill-filter-group, ibuffer-kill-line)
(ibuffer-save-filter-groups, ibuffer-save-filters, filename)
(basename, file-extension, ibuffer-diff-buffer-with-file-1)
(ibuffer-mark-by-file-name-regexp)
(ibuffer-mark-by-content-regexp):
* lisp/ibuf-macs.el (ibuffer-aif, ibuffer-awhen):
* lisp/ibuffer.el (ibuffer-mouse-toggle-mark)
(ibuffer-toggle-marks, ibuffer-mark-interactive)
(ibuffer-compile-format, process, ibuffer-map-lines):
* lisp/image.el (image--compute-map)
(image--compute-original-map):
* lisp/image/exif.el (exif-parse-buffer):
* lisp/image/image-converter.el (image-convert-p, image-convert)
(image-converter--find-converter):
* lisp/image/image-dired-util.el
(image-dired-file-name-at-point):
* lisp/image/image-dired.el (image-dired-track-original-file)
(image-dired--on-file-in-dired-buffer)
(image-dired--with-thumbnail-buffer)
(image-dired-jump-original-dired-buffer)
(image-dired--slideshow-step, image-dired-display-image):
* lisp/image/wallpaper.el (wallpaper--init-action-kill)
(wallpaper--find-setter, wallpaper--find-command)
(wallpaper--find-command-args, wallpaper--x-monitor-name):
* lisp/info-look.el (info-lookup-interactive-arguments)
(info-complete)::(:mode):
* lisp/info.el (info-pop-to-buffer, Info-read-node-name-1):
* lisp/international/emoji.el (emoji--adjust-displayable-1)
(emoji--add-recent):
* lisp/jsonrpc.el (jsonrpc--call-deferred)
(jsonrpc--process-sentinel, jsonrpc--remove):
* lisp/keymap.el (keymap-local-lookup):
* lisp/mail/emacsbug.el (report-emacs-bug-hook)
(submit-emacs-patch):
* lisp/mail/ietf-drums.el (ietf-drums-parse-addresses):
* lisp/mail/mailclient.el (mailclient-send-it):
* lisp/mail/rfc6068.el (rfc6068-parse-mailto-url):
* lisp/mail/undigest.el (rmail-digest-parse-mixed-mime):
* lisp/minibuffer.el (completion-metadata-get)
(completions--after-change)
(minibuffer-visible-completions--filter):
* lisp/net/browse-url.el (browse-url-url-at-point)
(browse-url-file-url, browse-url-emacs):
* lisp/net/dbus.el (dbus-byte-array-to-string)
(dbus-monitor-goto-serial):
* lisp/net/dictionary.el (dictionary-search):
* lisp/net/eww.el (eww--download-directory)
(eww-auto-rename-buffer, eww-open-in-new-buffer, eww-submit)
(eww-follow-link, eww-read-alternate-url)
(eww-copy-alternate-url):
* lisp/net/goto-addr.el (goto-address-at-point):
* lisp/net/mailcap.el (mailcap-mime-info):
* lisp/net/rcirc.el (rcirc, rcirc-connect, rcirc-send-string)
(rcirc-kill-buffer-hook, rcirc-print, rcirc-when)
(rcirc-color-attributes, rcirc-handler-NICK)
(rcirc-handler-TAGMSG, rcirc-handler-BATCH):
* lisp/net/shr.el (shr-descend, shr-adaptive-fill-function)
(shr-correct-dom-case, shr-tag-a):
* lisp/net/sieve.el (sieve-manage-quit):
* lisp/outline.el (outline-cycle-buffer):
* lisp/pcmpl-git.el (pcmpl-git--tracked-file-predicate):
* lisp/proced.el (proced-auto-update-timer):
* lisp/progmodes/bug-reference.el
(bug-reference-try-setup-from-vc):
* lisp/progmodes/c-ts-common.el (c-ts-common--fill-paragraph):
* lisp/progmodes/c-ts-mode.el (c-ts-mode--preproc-offset)
(c-ts-mode--anchor-prev-sibling, c-ts-mode-indent-defun):
* lisp/progmodes/compile.el (compilation-error-properties)
(compilation-find-file-1):
* lisp/progmodes/eglot.el (eglot--check-object)
(eglot--read-server, eglot-upgrade-eglot)
(eglot-handle-notification, eglot--CompletionParams)
(eglot-completion-at-point, eglot--sig-info)
(eglot-register-capability):
* lisp/progmodes/elisp-mode.el
(emacs-lisp-native-compile-and-load)
(elisp-eldoc-var-docstring-with-value):
* lisp/progmodes/erts-mode.el (erts-mode--goto-start-of-test):
* lisp/progmodes/flymake.el (flymake--update-eol-overlays)
(flymake-eldoc-function):
* lisp/progmodes/gdb-mi.el (gdb-breakpoints-list-handler-custom)
(gdb-frame-handler):
* lisp/progmodes/go-ts-mode.el (go-ts-mode-docstring)
(go-ts-mode--comment-on-previous-line-p)
(go-ts-mode--get-test-regexp-at-point)
(go-ts-mode-test-this-file):
* lisp/progmodes/grep.el (lgrep, rgrep-default-command)
(grep-file-at-point):
* lisp/progmodes/perl-mode.el (perl--end-of-format-p):
* lisp/progmodes/php-ts-mode.el
(php-ts-mode--anchor-prev-sibling, php-ts-mode--indent-defun):
* lisp/progmodes/project.el (project--other-place-command)
(project--find-default-from, project--transplant-file-name)
(project-prefixed-buffer-name, project--remove-from-project-list)
(project-prompt-project-name, project-remember-projects-under)
(project--switch-project-command)
(project-uniquify-dirname-transform, project-mode-line-format):
* lisp/progmodes/python.el
(python-font-lock-keywords-maximum-decoration)
(python--treesit-fontify-union-types)
(python-shell-get-process-name, python-shell-restart)
(python-shell-completion-at-point, python-ffap-module-path)
(python-util-comint-end-of-output-p, python--import-sources)
(python-add-import, python-remove-import, python-fix-imports):
* lisp/progmodes/xref.el (xref--add-log-current-defun):
* lisp/repeat.el (repeat-echo-message-string):
* lisp/saveplace.el (save-place-dired-hook):
* lisp/server.el (server-save-buffers-kill-terminal):
* lisp/shadowfile.el (shadow-make-fullname)
(shadow-contract-file-name, shadow-define-literal-group):
* lisp/shell.el (shell-highlight-undef-mode):
* lisp/simple.el (command-completion-using-modes-p)
(command-execute, file-user-uid, file-group-gid)
(first-completion, last-completion, switch-to-completions):
* lisp/startup.el (startup--load-user-init-file):
* lisp/tab-line.el (tab-line-tabs-buffer-group-by-project):
* lisp/tar-mode.el (tar-goto-file, tar-next-file-displayer):
* lisp/term/android-win.el (android-encode-select-string)
(gui-backend-set-selection):
* lisp/term/haiku-win.el (haiku-dnd-convert-string)
(haiku-select-encode-xstring, haiku-select-encode-utf-8-string):
* lisp/textmodes/emacs-news-mode.el (emacs-news--buttonize):
* lisp/textmodes/ispell.el (ispell-completion-at-point):
* lisp/textmodes/sgml-mode.el (sgml-validate)
(html-mode--complete-at-point):
* lisp/textmodes/tex-mode.el (tex-recenter-output-buffer)
(xref-backend-references):
* lisp/thingatpt.el (thing-at-point-file-at-point)
(thing-at-point-face-at-point):
* lisp/thread.el (thread-list--get-status):
* lisp/time.el (world-clock-copy-time-as-kill, world-clock):
* lisp/touch-screen.el (touch-screen-handle-touch):
* lisp/treesit.el (treesit-language-at, treesit-node-at)
(treesit-node-on, treesit-buffer-root-node)
(treesit-node-field-name, treesit-local-parsers-at)
(treesit-local-parsers-on, treesit--cleanup-local-range-overlays)
(treesit-font-lock-recompute-features)
(treesit-font-lock-fontify-region, treesit-transpose-sexps)
(treesit-add-log-current-defun, treesit-major-mode-setup)
(treesit--explorer-refresh, treesit-install-language-grammar):
* lisp/url/url.el (url-retrieve-synchronously):
* lisp/vc/smerge-mode.el (smerge-diff):
* lisp/vc/vc-dir.el (vc-dir):
* lisp/vc/vc-dispatcher.el (vc-do-async-command):
* lisp/vc/vc-git.el (vc-git-dir--branch-headers)
(vc-git-dir--stash-headers, vc-git--log-edit-summary-check)
(vc-git-stash-list):
* lisp/vc/vc.el (vc-responsible-backend, vc-buffer-sync-fileset)
(vc-clone):
* lisp/visual-wrap.el (visual-wrap--apply-to-line):
* lisp/wid-edit.el (widget-text)
(widget-editable-list-insert-before):
* lisp/window-tool-bar.el
(window-tool-bar--keymap-entry-to-string):
* lisp/window.el (display-buffer, display-buffer-full-frame)
(window-point-context-set, window-point-context-use)
(window-point-context-use-default-function):
* lisp/xdg.el (xdg-current-desktop):
* lisp/xwidget.el (xwidget-webkit-callback):
* lisp/yank-media.el (yank-media--get-selection)
(yank-media-types):
* test/lisp/comint-tests.el
(comint-tests/test-password-function):
* test/lisp/completion-preview-tests.el
(completion-preview-tests--capf):
* test/lisp/cus-edit-tests.el (with-cus-edit-test):
* test/lisp/erc/erc-scenarios-base-local-modules.el
(-phony-sblm-):
* test/lisp/erc/erc-scenarios-stamp.el
(erc-scenarios-stamp--on-post-modify):
* test/lisp/erc/erc-services-tests.el
(erc-services-tests--asp-parse-entry):
* test/lisp/erc/erc-tests.el (erc-modules--internal-property)
(erc--find-mode, erc-tests--update-modules):
* test/lisp/erc/resources/erc-d/erc-d-i.el
(erc-d-i--parse-message):
* test/lisp/erc/resources/erc-d/erc-d-t.el
(erc-d-t-kill-related-buffers, erc-d-t-with-cleanup):
* test/lisp/erc/resources/erc-d/erc-d-tests.el
(erc-d-i--parse-message--irc-parser-tests):
* test/lisp/erc/resources/erc-d/erc-d-u.el
(erc-d-u--read-exchange-slowly):
* test/lisp/erc/resources/erc-d/erc-d.el (erc-d--expire)
(erc-d--finalize-done, erc-d--command-handle-all):
* test/lisp/erc/resources/erc-scenarios-common.el
(erc-scenarios-common-with-cleanup):
* test/lisp/erc/resources/erc-tests-common.el
(erc-tests--common-display-message)
(erc-tests-common-create-subprocess):
* test/lisp/ibuffer-tests.el (ibuffer-test-Bug25058):
* test/lisp/international/mule-tests.el
(mule-cmds-tests--ucs-names-missing-names):
* test/lisp/progmodes/python-tests.el
(python-tests-get-shell-interpreter)
(python-tests--get-interpreter-info):
* test/lisp/progmodes/ruby-ts-mode-tests.el
(ruby-ts-resource-file):
* test/lisp/replace-tests.el (replace-tests-with-undo):
* test/src/emacs-tests.el (emacs-tests--seccomp-debug):
* test/src/process-tests.el (process-tests--emacs-command)
(process-tests--emacs-binary, process-tests--dump-file):
* test/src/treesit-tests.el (treesit--ert-test-defun-navigation):
Replace use of the now-obsolete if-let and when-let.
2024-10-24 16:50:07 +08:00
|
|
|
(if-let* ((range (if (region-active-p)
|
|
|
|
(list (region-beginning) (region-end))
|
|
|
|
(list (point) (point))))
|
|
|
|
(funcs (apply #'go-ts-mode--get-functions-in-range range)))
|
2024-05-14 00:14:03 +05:30
|
|
|
(string-join funcs "|")
|
|
|
|
(error "No test function found")))
|
|
|
|
|
|
|
|
(defun go-ts-mode-test-function-at-point ()
|
|
|
|
"Run the unit test at point.
|
|
|
|
If the point is anywhere in the test function, that function will be
|
|
|
|
run. If the region is selected, all the functions under the region will
|
|
|
|
be run."
|
|
|
|
(interactive)
|
|
|
|
(go-ts-mode--compile-test (go-ts-mode--get-test-regexp-at-point)))
|
|
|
|
|
|
|
|
(defun go-ts-mode-test-this-file ()
|
|
|
|
"Run all the unit tests in the current file."
|
|
|
|
(interactive)
|
Mark if-let and when-let obsolete
* lisp/subr.el (if-let*, when-let*, if-let, when-let): Mark
if-let and when-let obsolete (bug#73853 and elsewhere). Move
docstring text around so that if-let* and when-let* descriptions
no longer refer to if-let and when-let.
* etc/NEWS: Announce the change.
* admin/admin.el (reminder-for-release-blocking-bugs):
* doc/misc/erc.texi (display-buffer):
* lisp/ansi-color.el (ansi-color-apply)
(ansi-color--face-vec-face):
* lisp/ansi-osc.el (ansi-osc-apply-on-region)
(ansi-osc-hyperlink):
* lisp/arc-mode.el (archive-goto-file)
(archive-next-file-displayer):
* lisp/auth-source-pass.el (auth-source-pass-search)
(auth-source-pass--parse-data)
(auth-source-pass--find-match-many):
* lisp/autorevert.el (auto-revert-notify-rm-watch):
* lisp/buff-menu.el (Buffer-menu-unmark-all-buffers)
(Buffer-menu-group-by-root):
* lisp/calendar/parse-time.el (parse-iso8601-time-string):
* lisp/cedet/pulse.el (pulse-tick):
* lisp/comint.el (comint--fontify-input-ppss-flush-indirect)
(comint--intersect-regions):
* lisp/completion-preview.el (completion-preview--try-table)
(completion-preview--capf-wrapper, completion-preview--update):
* lisp/cus-edit.el (setopt--set)
(custom-dirlocals-maybe-update-cons, custom-dirlocals-validate):
* lisp/custom.el (load-theme):
* lisp/descr-text.el (describe-char):
* lisp/desktop.el (desktop--emacs-pid-running-p):
* lisp/dired-x.el (menu):
* lisp/dired.el (dired-font-lock-keywords)
(dired-insert-directory, dired--insert-disk-space, dired-mode):
* lisp/dnd.el (dnd-handle-multiple-urls):
* lisp/dom.el (dom-remove-attribute):
* lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker):
* lisp/emacs-lisp/bytecomp.el (bytecomp--custom-declare):
* lisp/emacs-lisp/comp-common.el (comp-function-type-spec):
* lisp/emacs-lisp/comp-cstr.el (comp--all-classes)
(comp-cstr-set-range-for-arithm, comp--cstr-union-1-no-mem)
(comp-cstr-intersection-no-mem, comp-cstr-fixnum-p)
(comp-cstr-type-p):
* lisp/emacs-lisp/comp-run.el (comp-subr-trampoline-install)
(native--compile-async):
* lisp/emacs-lisp/comp.el (comp--get-function-cstr)
(comp--function-pure-p, comp--intern-func-in-ctxt)
(comp--addr-to-bb-name, comp--emit-assume, comp--maybe-add-vmvar)
(comp--add-call-cstr, comp--compute-dominator-tree)
(comp--dom-tree-walker, comp--ssa-rename)
(comp--function-call-maybe-fold, comp--fwprop-call)
(comp--call-optim-func):
* lisp/emacs-lisp/edebug.el (edebug-global-prefix)
(edebug-remove-instrumentation):
* lisp/emacs-lisp/eieio.el (initialize-instance):
* lisp/emacs-lisp/ert-x.el (ert-resource-directory):
* lisp/emacs-lisp/ert.el (ert--expand-should-1)
(ert-test-location, ert-write-junit-test-report)
(ert-test--erts-test):
* lisp/emacs-lisp/icons.el (icon-complete-spec, icon-string)
(icons--create):
* lisp/emacs-lisp/lisp-mode.el (lisp--local-defform-body-p):
* lisp/emacs-lisp/loaddefs-gen.el
(loaddefs-generate--make-autoload)
(loaddefs-generate--parse-file):
* lisp/emacs-lisp/multisession.el
(multisession-edit-mode--revert, multisession-edit-value):
* lisp/emacs-lisp/package-vc.el (package-vc--read-archive-data)
(package-vc--version, package-vc--clone):
* lisp/emacs-lisp/package.el (package--reload-previously-loaded):
* lisp/emacs-lisp/pp.el (pp--insert-lisp):
* lisp/emacs-lisp/subr-x.el (add-display-text-property):
* lisp/emacs-lisp/tabulated-list.el (tabulated-list-print):
* lisp/emacs-lisp/timer.el (run-at-time):
* lisp/emacs-lisp/vtable.el (vtable-goto-table)
(vtable-goto-column, vtable-update-object, vtable--insert-line)
(vtable--compute-widths, vtable--make-keymap):
* lisp/emacs-lisp/warnings.el (display-warning):
* lisp/epa-file.el (epa-file-insert-file-contents):
* lisp/epa.el (epa-show-key):
* lisp/erc/erc-backend.el (erc--split-line, erc--conceal-prompt)
(PRIVMSG, erc--get-isupport-entry):
* lisp/erc/erc-button.el (erc-button-add-nickname-buttons)
(erc--button-next):
* lisp/erc/erc-common.el (erc--find-group):
* lisp/erc/erc-fill.el (erc-fill, erc-fill-static)
(erc-fill--wrap-escape-hidden-speaker)
(erc-fill--wrap-unmerge-on-date-stamp)
(erc-fill--wrap-massage-initial-message-post-clear)
(erc-fill-wrap, erc-fill--wrap-rejigger-region):
* lisp/erc/erc-goodies.el (erc--scrolltobottom-all)
(erc--keep-place-indicator-on-window-buffer-change)
(keep-place-indicator, erc--keep-place-indicator-adjust-on-clear)
(erc-keep-place-move, erc--command-indicator-display):
* lisp/erc/erc-ibuffer.el (erc-members):
* lisp/erc/erc-join.el (erc-join--remove-requested-channel)
(erc-autojoin--join):
* lisp/erc/erc-networks.el
(erc-networks--id-qualifying-init-parts, erc-networks--id-reload)
(erc-networks--id-ensure-comparable)
(erc-networks--reclaim-orphaned-target-buffers)
(erc-networks--server-select):
* lisp/erc/erc-nicks.el (erc-nicks-invert)
(erc-nicks--redirect-face-widget-link, erc-nicks--highlight)
(erc-nicks--highlight-button)
(erc-nicks--list-faces-help-button-action, erc-nicks-list-faces)
(erc-nicks-refresh, erc-nicks--colors-from-faces)
(erc-nicks--track-prioritize)
(erc-nicks--remember-face-for-track):
* lisp/erc/erc-notify.el (querypoll, erc--querypoll-get-next)
(erc--querypoll-on-352, erc--querypoll-send):
* lisp/erc/erc-sasl.el (erc-sasl--read-password):
* lisp/erc/erc-services.el
(erc-services-issue-ghost-and-retry-nick):
* lisp/erc/erc-speedbar.el (erc-speedbar--ensure, nickbar)
(erc-speedbar-toggle-nicknames-window-lock)
(erc-speedbar--compose-nicks-face):
* lisp/erc/erc-stamp.el (erc-stamp--recover-on-reconnect)
(erc-stamp-prefix-log-filter, erc--conceal-prompt)
(erc--insert-timestamp-left, erc-insert-timestamp-right)
(erc-stamp--defer-date-insertion-on-post-modify)
(erc-insert-timestamp-left-and-right)
(erc-stamp--redo-right-stamp-post-clear)
(erc-stamp--reset-on-clear, erc-stamp--dedupe-date-stamps):
* lisp/erc/erc-status-sidebar.el (bufbar)
(erc-status-sidebar-prefer-target-as-name)
(erc-status-sidebar-default-allsort, erc-status-sidebar-click):
* lisp/erc/erc-track.el (erc-track--shortened-names-get)
(erc-track--setup, erc-track--select-mode-line-face)
(erc-track-modified-channels, erc-track--collect-faces-in)
(erc-track--switch-buffer, erc-track--replace-killed-buffer):
* lisp/erc/erc-truncate.el (erc-truncate--setup)
(erc-truncate-buffer):
* lisp/erc/erc.el (erc--ensure-query-member)
(erc--ensure-query-members, erc--remove-channel-users-but)
(erc--cusr-change-status, erc--find-mode, erc--update-modules)
(erc-log-irc-protocol, erc--refresh-prompt)
(erc--restore-important-text-props)
(erc--order-text-properties-from-hash, erc-send-input-line)
(erc-cmd-IGNORE, erc--unignore-user, erc-cmd-QUERY)
(erc-cmd-BANLIST, erc--speakerize-nick)
(erc--format-speaker-input-message, erc-channel-receive-names)
(erc-send-current-line, erc-format-target-and/or-network)
(erc-kill-buffer-function, erc-restore-text-properties)
(erc--get-eq-comparable-cmd):
* lisp/eshell/em-alias.el (eshell-maybe-replace-by-alias--which)
(eshell-maybe-replace-by-alias):
* lisp/eshell/em-glob.el (eshell-glob-convert):
* lisp/eshell/em-pred.el (eshell-pred-user-or-group)
(eshell-pred-file-time, eshell-pred-file-type)
(eshell-pred-file-mode, eshell-pred-file-links)
(eshell-pred-file-size):
* lisp/eshell/em-prompt.el (eshell-forward-paragraph)
(eshell-next-prompt):
* lisp/eshell/esh-arg.el (eshell-resolve-current-argument):
* lisp/eshell/esh-cmd.el (eshell-do-eval, eshell/which)
(eshell-plain-command--which, eshell-plain-command):
* lisp/eshell/esh-io.el (eshell-duplicate-handles)
(eshell-protect-handles, eshell-get-target, eshell-close-target):
* lisp/eshell/esh-proc.el (eshell-sentinel):
* lisp/eshell/esh-var.el (eshell-parse-variable-ref)
(eshell-get-variable, eshell-set-variable):
* lisp/faces.el (face-at-point):
* lisp/ffap.el (ffap-in-project):
* lisp/filenotify.el (file-notify--rm-descriptor):
* lisp/files-x.el (read-dir-locals-file)
(connection-local-update-profile-variables)
(connection-local-value):
* lisp/files.el (file-remote-p, abbreviate-file-name)
(set-auto-mode, hack-local-variables)
(revert-buffer-restore-read-only):
* lisp/find-dired.el (find-dired-sort-by-filename):
* lisp/font-lock.el (font-lock--filter-keywords):
* lisp/gnus/gnus-art.el (article-emojize-symbols):
* lisp/gnus/gnus-int.el (gnus-close-server):
* lisp/gnus/gnus-search.el (gnus-search-transform)
(gnus-search-indexed-parse-output, gnus-search-server-to-engine):
* lisp/gnus/gnus-sum.el (gnus-collect-urls, gnus-shorten-url):
* lisp/gnus/gnus.el (gnus-check-backend-function):
* lisp/gnus/message.el (message-send-mail):
* lisp/gnus/mml.el (mml-generate-mime, mml-insert-mime-headers):
* lisp/gnus/nnatom.el (nnatom--read-feed, nnatom--read-article)
(nnatom--read-article-or-group-authors, nnatom--read-publish)
(nnatom--read-update, nnatom--read-links):
* lisp/gnus/nnfeed.el (nnfeed--read-server, nnfeed--write-server)
(nnfeed--parse-feed, nnfeed--group-data, nnfeed-retrieve-article)
(nnfeed-retrieve-headers, nnfeed--print-part)
(nnfeed-request-article, nnfeed-request-group)
(nnfeed-request-list, nnfeed--group-description)
(nnfeed-request-group-description)
(nnfeed-request-list-newsgroups, nnfeed-request-rename-group):
* lisp/gnus/nnmh.el (nnmh-update-gnus-unreads):
* lisp/help-fns.el (help-find-source)
(help-fns--insert-menu-bindings, help-fns--mention-first-release)
(help-fns--mention-shortdoc-groups)
(help-fns--customize-variable-version)
(help-fns--face-custom-version-info, describe-mode):
* lisp/help-mode.el (help-make-xrefs):
* lisp/help.el (help-key-description, help--describe-command):
* lisp/hfy-cmap.el (htmlfontify-load-rgb-file):
* lisp/ibuf-ext.el (ibuffer-jump-to-filter-group)
(ibuffer-kill-filter-group, ibuffer-kill-line)
(ibuffer-save-filter-groups, ibuffer-save-filters, filename)
(basename, file-extension, ibuffer-diff-buffer-with-file-1)
(ibuffer-mark-by-file-name-regexp)
(ibuffer-mark-by-content-regexp):
* lisp/ibuf-macs.el (ibuffer-aif, ibuffer-awhen):
* lisp/ibuffer.el (ibuffer-mouse-toggle-mark)
(ibuffer-toggle-marks, ibuffer-mark-interactive)
(ibuffer-compile-format, process, ibuffer-map-lines):
* lisp/image.el (image--compute-map)
(image--compute-original-map):
* lisp/image/exif.el (exif-parse-buffer):
* lisp/image/image-converter.el (image-convert-p, image-convert)
(image-converter--find-converter):
* lisp/image/image-dired-util.el
(image-dired-file-name-at-point):
* lisp/image/image-dired.el (image-dired-track-original-file)
(image-dired--on-file-in-dired-buffer)
(image-dired--with-thumbnail-buffer)
(image-dired-jump-original-dired-buffer)
(image-dired--slideshow-step, image-dired-display-image):
* lisp/image/wallpaper.el (wallpaper--init-action-kill)
(wallpaper--find-setter, wallpaper--find-command)
(wallpaper--find-command-args, wallpaper--x-monitor-name):
* lisp/info-look.el (info-lookup-interactive-arguments)
(info-complete)::(:mode):
* lisp/info.el (info-pop-to-buffer, Info-read-node-name-1):
* lisp/international/emoji.el (emoji--adjust-displayable-1)
(emoji--add-recent):
* lisp/jsonrpc.el (jsonrpc--call-deferred)
(jsonrpc--process-sentinel, jsonrpc--remove):
* lisp/keymap.el (keymap-local-lookup):
* lisp/mail/emacsbug.el (report-emacs-bug-hook)
(submit-emacs-patch):
* lisp/mail/ietf-drums.el (ietf-drums-parse-addresses):
* lisp/mail/mailclient.el (mailclient-send-it):
* lisp/mail/rfc6068.el (rfc6068-parse-mailto-url):
* lisp/mail/undigest.el (rmail-digest-parse-mixed-mime):
* lisp/minibuffer.el (completion-metadata-get)
(completions--after-change)
(minibuffer-visible-completions--filter):
* lisp/net/browse-url.el (browse-url-url-at-point)
(browse-url-file-url, browse-url-emacs):
* lisp/net/dbus.el (dbus-byte-array-to-string)
(dbus-monitor-goto-serial):
* lisp/net/dictionary.el (dictionary-search):
* lisp/net/eww.el (eww--download-directory)
(eww-auto-rename-buffer, eww-open-in-new-buffer, eww-submit)
(eww-follow-link, eww-read-alternate-url)
(eww-copy-alternate-url):
* lisp/net/goto-addr.el (goto-address-at-point):
* lisp/net/mailcap.el (mailcap-mime-info):
* lisp/net/rcirc.el (rcirc, rcirc-connect, rcirc-send-string)
(rcirc-kill-buffer-hook, rcirc-print, rcirc-when)
(rcirc-color-attributes, rcirc-handler-NICK)
(rcirc-handler-TAGMSG, rcirc-handler-BATCH):
* lisp/net/shr.el (shr-descend, shr-adaptive-fill-function)
(shr-correct-dom-case, shr-tag-a):
* lisp/net/sieve.el (sieve-manage-quit):
* lisp/outline.el (outline-cycle-buffer):
* lisp/pcmpl-git.el (pcmpl-git--tracked-file-predicate):
* lisp/proced.el (proced-auto-update-timer):
* lisp/progmodes/bug-reference.el
(bug-reference-try-setup-from-vc):
* lisp/progmodes/c-ts-common.el (c-ts-common--fill-paragraph):
* lisp/progmodes/c-ts-mode.el (c-ts-mode--preproc-offset)
(c-ts-mode--anchor-prev-sibling, c-ts-mode-indent-defun):
* lisp/progmodes/compile.el (compilation-error-properties)
(compilation-find-file-1):
* lisp/progmodes/eglot.el (eglot--check-object)
(eglot--read-server, eglot-upgrade-eglot)
(eglot-handle-notification, eglot--CompletionParams)
(eglot-completion-at-point, eglot--sig-info)
(eglot-register-capability):
* lisp/progmodes/elisp-mode.el
(emacs-lisp-native-compile-and-load)
(elisp-eldoc-var-docstring-with-value):
* lisp/progmodes/erts-mode.el (erts-mode--goto-start-of-test):
* lisp/progmodes/flymake.el (flymake--update-eol-overlays)
(flymake-eldoc-function):
* lisp/progmodes/gdb-mi.el (gdb-breakpoints-list-handler-custom)
(gdb-frame-handler):
* lisp/progmodes/go-ts-mode.el (go-ts-mode-docstring)
(go-ts-mode--comment-on-previous-line-p)
(go-ts-mode--get-test-regexp-at-point)
(go-ts-mode-test-this-file):
* lisp/progmodes/grep.el (lgrep, rgrep-default-command)
(grep-file-at-point):
* lisp/progmodes/perl-mode.el (perl--end-of-format-p):
* lisp/progmodes/php-ts-mode.el
(php-ts-mode--anchor-prev-sibling, php-ts-mode--indent-defun):
* lisp/progmodes/project.el (project--other-place-command)
(project--find-default-from, project--transplant-file-name)
(project-prefixed-buffer-name, project--remove-from-project-list)
(project-prompt-project-name, project-remember-projects-under)
(project--switch-project-command)
(project-uniquify-dirname-transform, project-mode-line-format):
* lisp/progmodes/python.el
(python-font-lock-keywords-maximum-decoration)
(python--treesit-fontify-union-types)
(python-shell-get-process-name, python-shell-restart)
(python-shell-completion-at-point, python-ffap-module-path)
(python-util-comint-end-of-output-p, python--import-sources)
(python-add-import, python-remove-import, python-fix-imports):
* lisp/progmodes/xref.el (xref--add-log-current-defun):
* lisp/repeat.el (repeat-echo-message-string):
* lisp/saveplace.el (save-place-dired-hook):
* lisp/server.el (server-save-buffers-kill-terminal):
* lisp/shadowfile.el (shadow-make-fullname)
(shadow-contract-file-name, shadow-define-literal-group):
* lisp/shell.el (shell-highlight-undef-mode):
* lisp/simple.el (command-completion-using-modes-p)
(command-execute, file-user-uid, file-group-gid)
(first-completion, last-completion, switch-to-completions):
* lisp/startup.el (startup--load-user-init-file):
* lisp/tab-line.el (tab-line-tabs-buffer-group-by-project):
* lisp/tar-mode.el (tar-goto-file, tar-next-file-displayer):
* lisp/term/android-win.el (android-encode-select-string)
(gui-backend-set-selection):
* lisp/term/haiku-win.el (haiku-dnd-convert-string)
(haiku-select-encode-xstring, haiku-select-encode-utf-8-string):
* lisp/textmodes/emacs-news-mode.el (emacs-news--buttonize):
* lisp/textmodes/ispell.el (ispell-completion-at-point):
* lisp/textmodes/sgml-mode.el (sgml-validate)
(html-mode--complete-at-point):
* lisp/textmodes/tex-mode.el (tex-recenter-output-buffer)
(xref-backend-references):
* lisp/thingatpt.el (thing-at-point-file-at-point)
(thing-at-point-face-at-point):
* lisp/thread.el (thread-list--get-status):
* lisp/time.el (world-clock-copy-time-as-kill, world-clock):
* lisp/touch-screen.el (touch-screen-handle-touch):
* lisp/treesit.el (treesit-language-at, treesit-node-at)
(treesit-node-on, treesit-buffer-root-node)
(treesit-node-field-name, treesit-local-parsers-at)
(treesit-local-parsers-on, treesit--cleanup-local-range-overlays)
(treesit-font-lock-recompute-features)
(treesit-font-lock-fontify-region, treesit-transpose-sexps)
(treesit-add-log-current-defun, treesit-major-mode-setup)
(treesit--explorer-refresh, treesit-install-language-grammar):
* lisp/url/url.el (url-retrieve-synchronously):
* lisp/vc/smerge-mode.el (smerge-diff):
* lisp/vc/vc-dir.el (vc-dir):
* lisp/vc/vc-dispatcher.el (vc-do-async-command):
* lisp/vc/vc-git.el (vc-git-dir--branch-headers)
(vc-git-dir--stash-headers, vc-git--log-edit-summary-check)
(vc-git-stash-list):
* lisp/vc/vc.el (vc-responsible-backend, vc-buffer-sync-fileset)
(vc-clone):
* lisp/visual-wrap.el (visual-wrap--apply-to-line):
* lisp/wid-edit.el (widget-text)
(widget-editable-list-insert-before):
* lisp/window-tool-bar.el
(window-tool-bar--keymap-entry-to-string):
* lisp/window.el (display-buffer, display-buffer-full-frame)
(window-point-context-set, window-point-context-use)
(window-point-context-use-default-function):
* lisp/xdg.el (xdg-current-desktop):
* lisp/xwidget.el (xwidget-webkit-callback):
* lisp/yank-media.el (yank-media--get-selection)
(yank-media-types):
* test/lisp/comint-tests.el
(comint-tests/test-password-function):
* test/lisp/completion-preview-tests.el
(completion-preview-tests--capf):
* test/lisp/cus-edit-tests.el (with-cus-edit-test):
* test/lisp/erc/erc-scenarios-base-local-modules.el
(-phony-sblm-):
* test/lisp/erc/erc-scenarios-stamp.el
(erc-scenarios-stamp--on-post-modify):
* test/lisp/erc/erc-services-tests.el
(erc-services-tests--asp-parse-entry):
* test/lisp/erc/erc-tests.el (erc-modules--internal-property)
(erc--find-mode, erc-tests--update-modules):
* test/lisp/erc/resources/erc-d/erc-d-i.el
(erc-d-i--parse-message):
* test/lisp/erc/resources/erc-d/erc-d-t.el
(erc-d-t-kill-related-buffers, erc-d-t-with-cleanup):
* test/lisp/erc/resources/erc-d/erc-d-tests.el
(erc-d-i--parse-message--irc-parser-tests):
* test/lisp/erc/resources/erc-d/erc-d-u.el
(erc-d-u--read-exchange-slowly):
* test/lisp/erc/resources/erc-d/erc-d.el (erc-d--expire)
(erc-d--finalize-done, erc-d--command-handle-all):
* test/lisp/erc/resources/erc-scenarios-common.el
(erc-scenarios-common-with-cleanup):
* test/lisp/erc/resources/erc-tests-common.el
(erc-tests--common-display-message)
(erc-tests-common-create-subprocess):
* test/lisp/ibuffer-tests.el (ibuffer-test-Bug25058):
* test/lisp/international/mule-tests.el
(mule-cmds-tests--ucs-names-missing-names):
* test/lisp/progmodes/python-tests.el
(python-tests-get-shell-interpreter)
(python-tests--get-interpreter-info):
* test/lisp/progmodes/ruby-ts-mode-tests.el
(ruby-ts-resource-file):
* test/lisp/replace-tests.el (replace-tests-with-undo):
* test/src/emacs-tests.el (emacs-tests--seccomp-debug):
* test/src/process-tests.el (process-tests--emacs-command)
(process-tests--emacs-binary, process-tests--dump-file):
* test/src/treesit-tests.el (treesit--ert-test-defun-navigation):
Replace use of the now-obsolete if-let and when-let.
2024-10-24 16:50:07 +08:00
|
|
|
(if-let* ((defuns (go-ts-mode--get-functions-in-range (point-min) (point-max))))
|
2024-05-14 00:14:03 +05:30
|
|
|
(go-ts-mode--compile-test (string-join defuns "|"))
|
|
|
|
(error "No test functions found in the current file")))
|
|
|
|
|
|
|
|
(defun go-ts-mode-test-this-package ()
|
|
|
|
"Run all the unit tests under the current package."
|
|
|
|
(interactive)
|
2024-12-19 09:53:02 +00:00
|
|
|
(compile (format "go test -v %s %s %s"
|
2024-05-14 00:14:03 +05:30
|
|
|
(go-ts-mode--get-build-tags-flag)
|
2024-12-19 09:53:02 +00:00
|
|
|
default-directory
|
|
|
|
(go-ts-mode--get-test-flags))))
|
2024-05-14 00:14:03 +05:30
|
|
|
|
2024-11-20 23:07:28 -03:00
|
|
|
;;;; go.mod support.
|
2022-12-11 18:41:16 -05:00
|
|
|
|
|
|
|
(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)
|
2024-11-20 23:07:28 -03:00
|
|
|
((go-mod-ts-mode--directive-matcher) no-indent go-ts-mode-indent-offset)
|
2022-12-11 18:41:16 -05:00
|
|
|
(no-node no-indent 0)))
|
|
|
|
"Tree-sitter indent rules for `go-mod-ts-mode'.")
|
|
|
|
|
2024-11-20 23:07:28 -03:00
|
|
|
(defun go-mod-ts-mode--directive-matcher ()
|
|
|
|
"Return a function for determining if point is inside a Go module directive.
|
2022-12-11 18:41:16 -05:00
|
|
|
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)
|
2024-11-20 23:07:28 -03:00
|
|
|
(member (treesit-node-type (treesit-node-at (point)))
|
|
|
|
'("exclude"
|
|
|
|
"module"
|
|
|
|
"replace"
|
|
|
|
"require"
|
|
|
|
"retract"))))))
|
2022-12-11 18:41:16 -05:00
|
|
|
|
|
|
|
(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
|
|
|
|
(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
|
|
|
|
|
2025-04-18 19:22:50 +03:00
|
|
|
(when (treesit-ensure-installed 'gomod)
|
2024-10-07 17:24:32 -07:00
|
|
|
(setq treesit-primary-parser (treesit-parser-create 'gomod))
|
2022-12-11 18:41:16 -05:00
|
|
|
|
|
|
|
;; Comments.
|
2025-02-11 20:38:00 -08:00
|
|
|
(c-ts-common-comment-setup)
|
2022-12-11 18:41:16 -05:00
|
|
|
|
|
|
|
;; 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)))
|
|
|
|
|
2024-03-08 12:58:11 -05:00
|
|
|
(derived-mode-add-parents 'go-mod-ts-mode '(go-mod-mode))
|
|
|
|
|
2025-03-29 13:36:02 +03:00
|
|
|
(if (treesit-ready-p 'gomod t)
|
2023-01-20 10:28:26 +02:00
|
|
|
(add-to-list 'auto-mode-alist '("/go\\.mod\\'" . go-mod-ts-mode)))
|
|
|
|
|
2024-11-20 23:07:28 -03:00
|
|
|
;;;; go.work support.
|
|
|
|
|
|
|
|
(defvar go-work-ts-mode--indent-rules
|
|
|
|
`((gowork
|
|
|
|
((node-is ")") parent-bol 0)
|
|
|
|
((parent-is "replace_directive") parent-bol go-ts-mode-indent-offset)
|
|
|
|
((parent-is "use_directive") parent-bol go-ts-mode-indent-offset)
|
|
|
|
((go-work-ts-mode--directive-matcher) no-indent go-ts-mode-indent-offset)
|
|
|
|
(no-node no-indent 0)))
|
|
|
|
"Tree-sitter indent rules for `go-work-ts-mode'.")
|
|
|
|
|
|
|
|
(defun go-work-ts-mode--directive-matcher ()
|
|
|
|
"Return a function for determining if point is inside a Go workspace 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)
|
|
|
|
(member (treesit-node-type (treesit-node-at (point)))
|
|
|
|
'("replace"
|
|
|
|
"use"))))))
|
|
|
|
|
|
|
|
(defvar go-work-ts-mode--keywords
|
|
|
|
'("go" "replace" "use")
|
|
|
|
"go.work keywords for tree-sitter font-locking.")
|
|
|
|
|
|
|
|
(defvar go-work-ts-mode--font-lock-settings
|
|
|
|
(treesit-font-lock-rules
|
|
|
|
:language 'gowork
|
|
|
|
:feature 'bracket
|
|
|
|
'((["(" ")"]) @font-lock-bracket-face)
|
|
|
|
|
|
|
|
:language 'gowork
|
|
|
|
:feature 'comment
|
|
|
|
'((comment) @font-lock-comment-face)
|
|
|
|
|
|
|
|
:language 'gowork
|
|
|
|
:feature 'keyword
|
|
|
|
`([,@go-work-ts-mode--keywords] @font-lock-keyword-face)
|
|
|
|
|
|
|
|
:language 'gowork
|
|
|
|
:feature 'number
|
|
|
|
'([(go_version) (version)] @font-lock-number-face)
|
|
|
|
|
|
|
|
:language 'gowork
|
|
|
|
:feature 'operator
|
|
|
|
'((["=>"]) @font-lock-operator-face)
|
|
|
|
|
|
|
|
:language 'gowork
|
|
|
|
:feature 'error
|
|
|
|
:override t
|
|
|
|
'((ERROR) @font-lock-warning-face))
|
|
|
|
"Tree-sitter font-lock settings for `go-work-ts-mode'.")
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(define-derived-mode go-work-ts-mode prog-mode "Go Work"
|
|
|
|
"Major mode for editing go.work files, powered by tree-sitter."
|
|
|
|
:group 'go
|
|
|
|
|
2025-04-18 19:22:50 +03:00
|
|
|
(when (treesit-ensure-installed 'gowork)
|
2024-11-20 23:07:28 -03:00
|
|
|
(setq treesit-primary-parser (treesit-parser-create 'gowork))
|
|
|
|
|
|
|
|
;; 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-work-ts-mode--indent-rules)
|
|
|
|
|
|
|
|
;; Font-lock.
|
|
|
|
(setq-local treesit-font-lock-settings go-work-ts-mode--font-lock-settings)
|
|
|
|
(setq-local treesit-font-lock-feature-list
|
|
|
|
'((comment)
|
|
|
|
(keyword)
|
|
|
|
(number)
|
|
|
|
(bracket error operator)))
|
|
|
|
|
|
|
|
(treesit-major-mode-setup)))
|
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(add-to-list 'auto-mode-alist '("/go\\.work\\'" . go-work-ts-mode))
|
|
|
|
|
2022-12-11 18:41:16 -05:00
|
|
|
(provide 'go-ts-mode)
|
|
|
|
|
|
|
|
;;; go-ts-mode.el ends here
|