diff options
| author | Po Lu | 2024-03-23 18:15:28 +0800 |
|---|---|---|
| committer | Po Lu | 2024-03-23 18:15:28 +0800 |
| commit | d7a6a6941bc8c0553b4dc5864ffdbfd677af90af (patch) | |
| tree | d10d2050f63d37f1b5eb88b90540bfcc51c9f620 | |
| parent | 0e83cbd90ecdf793b2422d9219886d91ea4c385a (diff) | |
| parent | 5769a1053087a278d48836e1f366e0bd87c95809 (diff) | |
| download | emacs-d7a6a6941bc8c0553b4dc5864ffdbfd677af90af.tar.gz emacs-d7a6a6941bc8c0553b4dc5864ffdbfd677af90af.zip | |
Merge remote-tracking branch 'savannah/master' into master-android-1
| -rw-r--r-- | lisp/image-mode.el | 5 | ||||
| -rw-r--r-- | lisp/progmodes/c-ts-common.el | 2 | ||||
| -rw-r--r-- | lisp/progmodes/c-ts-mode.el | 71 | ||||
| -rw-r--r-- | lisp/progmodes/eglot.el | 3 | ||||
| -rw-r--r-- | lisp/progmodes/lua-ts-mode.el | 13 | ||||
| -rw-r--r-- | lisp/treesit.el | 21 |
6 files changed, 55 insertions, 60 deletions
diff --git a/lisp/image-mode.el b/lisp/image-mode.el index 355685e70fd..fa64f1ac03e 100644 --- a/lisp/image-mode.el +++ b/lisp/image-mode.el | |||
| @@ -654,8 +654,9 @@ Key bindings: | |||
| 654 | (unless (display-images-p) | 654 | (unless (display-images-p) |
| 655 | (error "Display does not support images")) | 655 | (error "Display does not support images")) |
| 656 | 656 | ||
| 657 | (major-mode-suspend) | 657 | (unless (eq major-mode 'image-mode) |
| 658 | (setq major-mode 'image-mode) | 658 | (major-mode-suspend) |
| 659 | (setq major-mode 'image-mode)) | ||
| 659 | (setq image-transform-resize image-auto-resize) | 660 | (setq image-transform-resize image-auto-resize) |
| 660 | 661 | ||
| 661 | ;; Bail out early if we have no image data. | 662 | ;; Bail out early if we have no image data. |
diff --git a/lisp/progmodes/c-ts-common.el b/lisp/progmodes/c-ts-common.el index 0095d83e302..e48bcc64f14 100644 --- a/lisp/progmodes/c-ts-common.el +++ b/lisp/progmodes/c-ts-common.el | |||
| @@ -332,7 +332,7 @@ Assumes the anchor is (point-min), i.e., the 0th column. | |||
| 332 | This function basically counts the number of block nodes (i.e., | 332 | This function basically counts the number of block nodes (i.e., |
| 333 | brackets) (see `c-ts-common-indent-type-regexp-alist') | 333 | brackets) (see `c-ts-common-indent-type-regexp-alist') |
| 334 | between NODE and the root node (not counting NODE itself), and | 334 | between NODE and the root node (not counting NODE itself), and |
| 335 | multiply that by `c-ts-common-indent-offset'. | 335 | multiplies that by `c-ts-common-indent-offset'. |
| 336 | 336 | ||
| 337 | To support GNU style, on each block level, this function also | 337 | To support GNU style, on each block level, this function also |
| 338 | checks whether the opening bracket { is on its own line, if so, | 338 | checks whether the opening bracket { is on its own line, if so, |
diff --git a/lisp/progmodes/c-ts-mode.el b/lisp/progmodes/c-ts-mode.el index a2e7f6fba2e..3a89f0f494b 100644 --- a/lisp/progmodes/c-ts-mode.el +++ b/lisp/progmodes/c-ts-mode.el | |||
| @@ -97,7 +97,7 @@ | |||
| 97 | "Toggle the comment style between block and line comments. | 97 | "Toggle the comment style between block and line comments. |
| 98 | Optional numeric ARG, if supplied, switches to block comment | 98 | Optional numeric ARG, if supplied, switches to block comment |
| 99 | style when positive, to line comment style when negative, and | 99 | style when positive, to line comment style when negative, and |
| 100 | just toggles it when zero or left out." | 100 | just toggles it when zero or omitted." |
| 101 | (interactive "P") | 101 | (interactive "P") |
| 102 | (let ((prevstate-line (string= comment-start "// "))) | 102 | (let ((prevstate-line (string= comment-start "// "))) |
| 103 | (when (or (not arg) | 103 | (when (or (not arg) |
| @@ -147,9 +147,9 @@ symbol." | |||
| 147 | "Style used for indentation. | 147 | "Style used for indentation. |
| 148 | 148 | ||
| 149 | The selected style could be one of GNU, K&R, LINUX or BSD. If | 149 | The selected style could be one of GNU, K&R, LINUX or BSD. If |
| 150 | one of the supplied styles doesn't suffice, a function could be | 150 | one of the supplied styles doesn't suffice, the value could be |
| 151 | set instead. This function is expected to return a list that | 151 | a function instead. This function is expected to return a list |
| 152 | follows the form of `treesit-simple-indent-rules'." | 152 | that follows the form of `treesit-simple-indent-rules'." |
| 153 | :version "29.1" | 153 | :version "29.1" |
| 154 | :type '(choice (symbol :tag "Gnu" gnu) | 154 | :type '(choice (symbol :tag "Gnu" gnu) |
| 155 | (symbol :tag "K&R" k&r) | 155 | (symbol :tag "K&R" k&r) |
| @@ -202,8 +202,8 @@ To set the default indent style globally, use | |||
| 202 | (if (derived-mode-p 'c-ts-mode) 'c 'cpp)))))) | 202 | (if (derived-mode-p 'c-ts-mode) 'c 'cpp)))))) |
| 203 | 203 | ||
| 204 | (defcustom c-ts-mode-emacs-sources-support t | 204 | (defcustom c-ts-mode-emacs-sources-support t |
| 205 | "Whether to enable Emacs source-specific features. | 205 | "Whether to enable Emacs source-specific C features. |
| 206 | This enables detection of definitions of Lisp function using | 206 | This enables detection of definitions of Lisp functions via |
| 207 | the DEFUN macro. | 207 | the DEFUN macro. |
| 208 | This needs to be set before enabling `c-ts-mode'; if you change | 208 | This needs to be set before enabling `c-ts-mode'; if you change |
| 209 | the value after enabling `c-ts-mode', toggle the mode off and on | 209 | the value after enabling `c-ts-mode', toggle the mode off and on |
| @@ -243,7 +243,7 @@ again." | |||
| 243 | < and > are usually punctuation, e.g., in ->. But when used for | 243 | < and > are usually punctuation, e.g., in ->. But when used for |
| 244 | templates, they should be considered pairs. | 244 | templates, they should be considered pairs. |
| 245 | 245 | ||
| 246 | This function checks for < and > in the changed RANGES and apply | 246 | This function checks for < and > in the changed RANGES and applies |
| 247 | appropriate text property to alter the syntax of template | 247 | appropriate text property to alter the syntax of template |
| 248 | delimiters < and >'s." | 248 | delimiters < and >'s." |
| 249 | (goto-char beg) | 249 | (goto-char beg) |
| @@ -284,9 +284,9 @@ is actually the parent of point at the moment of indentation." | |||
| 284 | "Return the start of the previous named sibling of NODE. | 284 | "Return the start of the previous named sibling of NODE. |
| 285 | 285 | ||
| 286 | This anchor handles the special case where the previous sibling | 286 | This anchor handles the special case where the previous sibling |
| 287 | is a labeled_statement, in that case, return the child of the | 287 | is a labeled_statement; in that case, return the child of the |
| 288 | labeled statement instead. (Actually, recursively go down until | 288 | labeled statement instead. (Actually, recursively go down until |
| 289 | the node isn't a labeled_statement.) Eg, | 289 | the node isn't a labeled_statement.) E.g., |
| 290 | 290 | ||
| 291 | label: | 291 | label: |
| 292 | int x = 1; | 292 | int x = 1; |
| @@ -295,10 +295,11 @@ label: | |||
| 295 | The anchor of \"int y = 2;\" should be \"int x = 1;\" rather than | 295 | The anchor of \"int y = 2;\" should be \"int x = 1;\" rather than |
| 296 | the labeled_statement. | 296 | the labeled_statement. |
| 297 | 297 | ||
| 298 | Return nil if a) there is no prev-sibling, or 2) prev-sibling | 298 | Return nil if a) there is no prev-sibling, or b) prev-sibling |
| 299 | doesn't have a child. | 299 | doesn't have a child. |
| 300 | 300 | ||
| 301 | PARENT and BOL are like other anchor functions." | 301 | PARENT is NODE's parent, BOL is the beginning of non-whitespace |
| 302 | characters of the current line." | ||
| 302 | (when-let ((prev-sibling | 303 | (when-let ((prev-sibling |
| 303 | (or (treesit-node-prev-sibling node t) | 304 | (or (treesit-node-prev-sibling node t) |
| 304 | (treesit-node-prev-sibling | 305 | (treesit-node-prev-sibling |
| @@ -336,7 +337,7 @@ PARENT and BOL are like other anchor functions." | |||
| 336 | 337 | ||
| 337 | (defun c-ts-mode--standalone-parent-skip-preproc (_n parent &rest _) | 338 | (defun c-ts-mode--standalone-parent-skip-preproc (_n parent &rest _) |
| 338 | "Like the standalone-parent anchor but skips preproc nodes. | 339 | "Like the standalone-parent anchor but skips preproc nodes. |
| 339 | PARENT is the same as other anchor functions." | 340 | PARENT is the parent of the current node." |
| 340 | (save-excursion | 341 | (save-excursion |
| 341 | (treesit-node-start | 342 | (treesit-node-start |
| 342 | (treesit-parent-until | 343 | (treesit-parent-until |
| @@ -353,13 +354,15 @@ PARENT is the same as other anchor functions." | |||
| 353 | 354 | ||
| 354 | (defun c-ts-mode--standalone-grandparent (_node parent bol &rest args) | 355 | (defun c-ts-mode--standalone-grandparent (_node parent bol &rest args) |
| 355 | "Like the standalone-parent anchor but pass it the grandparent. | 356 | "Like the standalone-parent anchor but pass it the grandparent. |
| 356 | PARENT, BOL, ARGS are the same as other anchor functions." | 357 | PARENT is NODE's parent, BOL is the beginning of non-whitespace |
| 358 | characters of the current line." | ||
| 357 | (apply (alist-get 'standalone-parent treesit-simple-indent-presets) | 359 | (apply (alist-get 'standalone-parent treesit-simple-indent-presets) |
| 358 | parent (treesit-node-parent parent) bol args)) | 360 | parent (treesit-node-parent parent) bol args)) |
| 359 | 361 | ||
| 360 | (defun c-ts-mode--else-heuristic (node parent bol &rest _) | 362 | (defun c-ts-mode--else-heuristic (node parent bol &rest _) |
| 361 | "Heuristic matcher for when \"else\" is followed by a closing bracket. | 363 | "Heuristic matcher for when \"else\" is followed by a closing bracket. |
| 362 | NODE, PARENT, and BOL are the same as in other matchers." | 364 | PARENT is NODE's parent, BOL is the beginning of non-whitespace |
| 365 | characters of the current line." | ||
| 363 | (and (null node) | 366 | (and (null node) |
| 364 | (save-excursion | 367 | (save-excursion |
| 365 | (forward-line -1) | 368 | (forward-line -1) |
| @@ -757,7 +760,7 @@ MODE is either `c' or `cpp'." | |||
| 757 | (defun c-ts-mode--declarator-identifier (node &optional qualified) | 760 | (defun c-ts-mode--declarator-identifier (node &optional qualified) |
| 758 | "Return the identifier of the declarator node NODE. | 761 | "Return the identifier of the declarator node NODE. |
| 759 | 762 | ||
| 760 | If QUALIFIED is non-nil, include the names space part of the | 763 | If QUALIFIED is non-nil, include the namespace part of the |
| 761 | identifier and return a qualified_identifier." | 764 | identifier and return a qualified_identifier." |
| 762 | (pcase (treesit-node-type node) | 765 | (pcase (treesit-node-type node) |
| 763 | ;; Recurse. | 766 | ;; Recurse. |
| @@ -782,7 +785,7 @@ identifier and return a qualified_identifier." | |||
| 782 | node))) | 785 | node))) |
| 783 | 786 | ||
| 784 | (defun c-ts-mode--fontify-declarator (node override start end &rest _args) | 787 | (defun c-ts-mode--fontify-declarator (node override start end &rest _args) |
| 785 | "Fontify a declarator (whatever under the \"declarator\" field). | 788 | "Fontify a declarator (whatever is under the \"declarator\" field). |
| 786 | For NODE, OVERRIDE, START, END, and ARGS, see | 789 | For NODE, OVERRIDE, START, END, and ARGS, see |
| 787 | `treesit-font-lock-rules'." | 790 | `treesit-font-lock-rules'." |
| 788 | (let* ((identifier (c-ts-mode--declarator-identifier node)) | 791 | (let* ((identifier (c-ts-mode--declarator-identifier node)) |
| @@ -817,7 +820,7 @@ For NODE, OVERRIDE, START, END, and ARGS, see | |||
| 817 | 820 | ||
| 818 | (defun c-ts-mode--fontify-variable (node override start end &rest _) | 821 | (defun c-ts-mode--fontify-variable (node override start end &rest _) |
| 819 | "Fontify an identifier node if it is a variable. | 822 | "Fontify an identifier node if it is a variable. |
| 820 | Don't fontify if it is a function identifier. For NODE, | 823 | Don't fontify it if it is a function identifier. For NODE, |
| 821 | OVERRIDE, START, END, and ARGS, see `treesit-font-lock-rules'." | 824 | OVERRIDE, START, END, and ARGS, see `treesit-font-lock-rules'." |
| 822 | (when (not (equal (treesit-node-type | 825 | (when (not (equal (treesit-node-type |
| 823 | (treesit-node-parent node)) | 826 | (treesit-node-parent node)) |
| @@ -911,7 +914,8 @@ Return nil if NODE is not a defun node or doesn't have a name." | |||
| 911 | t)) | 914 | t)) |
| 912 | ((or "struct_specifier" "enum_specifier" | 915 | ((or "struct_specifier" "enum_specifier" |
| 913 | "union_specifier" "class_specifier" | 916 | "union_specifier" "class_specifier" |
| 914 | "namespace_definition") | 917 | "namespace_definition" |
| 918 | "preproc_def" "preproc_function_def") | ||
| 915 | (treesit-node-child-by-field-name node "name")) | 919 | (treesit-node-child-by-field-name node "name")) |
| 916 | ;; DEFUNs in Emacs sources. | 920 | ;; DEFUNs in Emacs sources. |
| 917 | ("expression_statement" | 921 | ("expression_statement" |
| @@ -937,7 +941,7 @@ Return nil if NODE is not a defun node or doesn't have a name." | |||
| 937 | 941 | ||
| 938 | (defun c-ts-mode--defun-valid-p (node) | 942 | (defun c-ts-mode--defun-valid-p (node) |
| 939 | "Return non-nil if NODE is a valid defun node. | 943 | "Return non-nil if NODE is a valid defun node. |
| 940 | Ie, NODE is not nested." | 944 | That is, NODE is not nested." |
| 941 | (let ((top-level-p (lambda (node) | 945 | (let ((top-level-p (lambda (node) |
| 942 | (not (treesit-node-top-level | 946 | (not (treesit-node-top-level |
| 943 | node (rx (or "function_definition" | 947 | node (rx (or "function_definition" |
| @@ -976,8 +980,7 @@ Basically, if NODE is a class, return non-nil; if NODE is a | |||
| 976 | function but is under a class, return non-nil; if NODE is a | 980 | function but is under a class, return non-nil; if NODE is a |
| 977 | top-level function, return nil. | 981 | top-level function, return nil. |
| 978 | 982 | ||
| 979 | This is for the Class subindex in | 983 | This is for the Class subindex in `treesit-simple-imenu-settings'." |
| 980 | `treesit-simple-imenu-settings'." | ||
| 981 | (pcase (treesit-node-type node) | 984 | (pcase (treesit-node-type node) |
| 982 | ;; The Class subindex only has class_specifier and | 985 | ;; The Class subindex only has class_specifier and |
| 983 | ;; function_definition. | 986 | ;; function_definition. |
| @@ -988,7 +991,7 @@ This is for the Class subindex in | |||
| 988 | 991 | ||
| 989 | (defun c-ts-mode--defun-skipper () | 992 | (defun c-ts-mode--defun-skipper () |
| 990 | "Custom defun skipper for `c-ts-mode' and friends. | 993 | "Custom defun skipper for `c-ts-mode' and friends. |
| 991 | Structs in C ends with a semicolon, but the semicolon is not | 994 | Structs in C end with a semicolon, but the semicolon is not |
| 992 | considered part of the struct node, so point would stop before | 995 | considered part of the struct node, so point would stop before |
| 993 | the semicolon. This function skips the semicolon." | 996 | the semicolon. This function skips the semicolon." |
| 994 | (when (looking-at (rx (* (or " " "\t")) ";")) | 997 | (when (looking-at (rx (* (or " " "\t")) ";")) |
| @@ -1008,7 +1011,7 @@ the semicolon. This function skips the semicolon." | |||
| 1008 | (list node parent bol))) | 1011 | (list node parent bol))) |
| 1009 | 1012 | ||
| 1010 | (defun c-ts-mode--emacs-defun-p (node) | 1013 | (defun c-ts-mode--emacs-defun-p (node) |
| 1011 | "Return non-nil if NODE is a Lisp function defined using DEFUN. | 1014 | "Return non-nil if NODE is a Lisp function defined via DEFUN. |
| 1012 | This function detects Lisp primitives defined in Emacs source | 1015 | This function detects Lisp primitives defined in Emacs source |
| 1013 | files using the DEFUN macro." | 1016 | files using the DEFUN macro." |
| 1014 | (and (equal (treesit-node-type node) "expression_statement") | 1017 | (and (equal (treesit-node-type node) "expression_statement") |
| @@ -1029,15 +1032,15 @@ files using the DEFUN macro." | |||
| 1029 | "Return the defun node at point. | 1032 | "Return the defun node at point. |
| 1030 | 1033 | ||
| 1031 | In addition to regular C functions, this function recognizes | 1034 | In addition to regular C functions, this function recognizes |
| 1032 | definitions of Lisp primitrives in Emacs source files using DEFUN, | 1035 | definitions of Lisp primitrives in Emacs source files defined |
| 1033 | if `c-ts-mode-emacs-sources-support' is non-nil. | 1036 | via DEFUN, if `c-ts-mode-emacs-sources-support' is non-nil. |
| 1034 | 1037 | ||
| 1035 | Note that DEFUN is parsed by tree-sitter as two separate | 1038 | Note that DEFUN is parsed by tree-sitter as two separate |
| 1036 | nodes, one for the declaration and one for the body; this | 1039 | nodes, one for the declaration and one for the body; this |
| 1037 | function returns the declaration node. | 1040 | function returns the declaration node. |
| 1038 | 1041 | ||
| 1039 | If RANGE is non-nil, return (BEG . END) where BEG end END | 1042 | If RANGE is non-nil, return (BEG . END) where BEG end END |
| 1040 | encloses the whole defun. This is for when the entire defun | 1043 | enclose the whole defun. This is for when the entire defun |
| 1041 | is required, not just the declaration part for DEFUN." | 1044 | is required, not just the declaration part for DEFUN." |
| 1042 | (when-let* ((node (treesit-defun-at-point)) | 1045 | (when-let* ((node (treesit-defun-at-point)) |
| 1043 | (defun-range (cons (treesit-node-start node) | 1046 | (defun-range (cons (treesit-node-start node) |
| @@ -1066,7 +1069,7 @@ is required, not just the declaration part for DEFUN." | |||
| 1066 | "Return the name of the current defun. | 1069 | "Return the name of the current defun. |
| 1067 | This is used for `add-log-current-defun-function'. | 1070 | This is used for `add-log-current-defun-function'. |
| 1068 | In addition to regular C functions, this function also recognizes | 1071 | In addition to regular C functions, this function also recognizes |
| 1069 | Emacs primitives defined using DEFUN in Emacs sources, | 1072 | Emacs primitives defined via DEFUN in Emacs sources, |
| 1070 | if `c-ts-mode-emacs-sources-support' is non-nil." | 1073 | if `c-ts-mode-emacs-sources-support' is non-nil." |
| 1071 | (or (treesit-add-log-current-defun) | 1074 | (or (treesit-add-log-current-defun) |
| 1072 | (c-ts-mode--defun-name (c-ts-mode--emacs-defun-at-point)))) | 1075 | (c-ts-mode--defun-name (c-ts-mode--emacs-defun-at-point)))) |
| @@ -1144,7 +1147,7 @@ For BOL see `treesit-simple-indent-rules'." | |||
| 1144 | 1147 | ||
| 1145 | (defun c-ts-mode--reverse-ranges (ranges beg end) | 1148 | (defun c-ts-mode--reverse-ranges (ranges beg end) |
| 1146 | "Reverse RANGES and return the new ranges between BEG and END. | 1149 | "Reverse RANGES and return the new ranges between BEG and END. |
| 1147 | Positions that were included RANGES are not in the returned | 1150 | Positions that were included in RANGES are not in the returned |
| 1148 | ranges, and vice versa. | 1151 | ranges, and vice versa. |
| 1149 | 1152 | ||
| 1150 | Return nil if RANGES is nil. This way, passing the returned | 1153 | Return nil if RANGES is nil. This way, passing the returned |
| @@ -1205,7 +1208,9 @@ BEG and END are described in `treesit-range-rules'." | |||
| 1205 | "enum_specifier" | 1208 | "enum_specifier" |
| 1206 | "union_specifier" | 1209 | "union_specifier" |
| 1207 | "class_specifier" | 1210 | "class_specifier" |
| 1208 | "namespace_definition") | 1211 | "namespace_definition" |
| 1212 | "preproc_def" | ||
| 1213 | "preproc_function_def") | ||
| 1209 | (and c-ts-mode-emacs-sources-support | 1214 | (and c-ts-mode-emacs-sources-support |
| 1210 | '(;; DEFUN. | 1215 | '(;; DEFUN. |
| 1211 | "expression_statement" | 1216 | "expression_statement" |
| @@ -1284,7 +1289,7 @@ BEG and END are described in `treesit-range-rules'." | |||
| 1284 | 1289 | ||
| 1285 | This mode is independent from the classic cc-mode.el based | 1290 | This mode is independent from the classic cc-mode.el based |
| 1286 | `c-mode', so configuration variables of that mode, like | 1291 | `c-mode', so configuration variables of that mode, like |
| 1287 | `c-basic-offset', doesn't affect this mode. | 1292 | `c-basic-offset', don't affect this mode. |
| 1288 | 1293 | ||
| 1289 | To use tree-sitter C/C++ modes by default, evaluate | 1294 | To use tree-sitter C/C++ modes by default, evaluate |
| 1290 | 1295 | ||
| @@ -1293,7 +1298,7 @@ To use tree-sitter C/C++ modes by default, evaluate | |||
| 1293 | (add-to-list \\='major-mode-remap-alist | 1298 | (add-to-list \\='major-mode-remap-alist |
| 1294 | \\='(c-or-c++-mode . c-or-c++-ts-mode)) | 1299 | \\='(c-or-c++-mode . c-or-c++-ts-mode)) |
| 1295 | 1300 | ||
| 1296 | in your configuration." | 1301 | in your init files." |
| 1297 | :group 'c | 1302 | :group 'c |
| 1298 | :after-hook (c-ts-mode-set-modeline) | 1303 | :after-hook (c-ts-mode-set-modeline) |
| 1299 | 1304 | ||
| @@ -1345,7 +1350,7 @@ To use tree-sitter C/C++ modes by default, evaluate | |||
| 1345 | (add-to-list \\='major-mode-remap-alist | 1350 | (add-to-list \\='major-mode-remap-alist |
| 1346 | \\='(c-or-c++-mode . c-or-c++-ts-mode)) | 1351 | \\='(c-or-c++-mode . c-or-c++-ts-mode)) |
| 1347 | 1352 | ||
| 1348 | in your configuration. | 1353 | in your init files. |
| 1349 | 1354 | ||
| 1350 | Since this mode uses a parser, unbalanced brackets might cause | 1355 | Since this mode uses a parser, unbalanced brackets might cause |
| 1351 | some breakage in indentation/fontification. Therefore, it's | 1356 | some breakage in indentation/fontification. Therefore, it's |
| @@ -1440,7 +1445,7 @@ matching on file name insufficient for detecting major mode that | |||
| 1440 | should be used. | 1445 | should be used. |
| 1441 | 1446 | ||
| 1442 | This function attempts to use file contents to determine whether | 1447 | This function attempts to use file contents to determine whether |
| 1443 | the code is C or C++ and based on that chooses whether to enable | 1448 | the code is C or C++, and based on that chooses whether to enable |
| 1444 | `c-ts-mode' or `c++-ts-mode'." | 1449 | `c-ts-mode' or `c++-ts-mode'." |
| 1445 | (declare (obsolete c-or-c++-mode "30.1")) | 1450 | (declare (obsolete c-or-c++-mode "30.1")) |
| 1446 | (interactive) | 1451 | (interactive) |
diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index b3fd104a227..7d2f1a55165 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el | |||
| @@ -238,7 +238,8 @@ automatically)." | |||
| 238 | (vimrc-mode . ("vim-language-server" "--stdio")) | 238 | (vimrc-mode . ("vim-language-server" "--stdio")) |
| 239 | ((python-mode python-ts-mode) | 239 | ((python-mode python-ts-mode) |
| 240 | . ,(eglot-alternatives | 240 | . ,(eglot-alternatives |
| 241 | '("pylsp" "pyls" ("pyright-langserver" "--stdio") | 241 | '("pylsp" "pyls" ("basedpyright-langserver" "--stdio") |
| 242 | ("pyright-langserver" "--stdio") | ||
| 242 | "jedi-language-server" "ruff-lsp"))) | 243 | "jedi-language-server" "ruff-lsp"))) |
| 243 | ((js-json-mode json-mode json-ts-mode) | 244 | ((js-json-mode json-mode json-ts-mode) |
| 244 | . ,(eglot-alternatives '(("vscode-json-language-server" "--stdio") | 245 | . ,(eglot-alternatives '(("vscode-json-language-server" "--stdio") |
diff --git a/lisp/progmodes/lua-ts-mode.el b/lisp/progmodes/lua-ts-mode.el index 25fd7792f42..407ef230c32 100644 --- a/lisp/progmodes/lua-ts-mode.el +++ b/lisp/progmodes/lua-ts-mode.el | |||
| @@ -60,66 +60,56 @@ | |||
| 60 | :options '(flymake-mode | 60 | :options '(flymake-mode |
| 61 | hs-minor-mode | 61 | hs-minor-mode |
| 62 | outline-minor-mode) | 62 | outline-minor-mode) |
| 63 | :group 'lua-ts | ||
| 64 | :version "30.1") | 63 | :version "30.1") |
| 65 | 64 | ||
| 66 | (defcustom lua-ts-indent-offset 4 | 65 | (defcustom lua-ts-indent-offset 4 |
| 67 | "Number of spaces for each indentation step in `lua-ts-mode'." | 66 | "Number of spaces for each indentation step in `lua-ts-mode'." |
| 68 | :type 'natnum | 67 | :type 'natnum |
| 69 | :safe 'natnump | 68 | :safe 'natnump |
| 70 | :group 'lua-ts | ||
| 71 | :version "30.1") | 69 | :version "30.1") |
| 72 | 70 | ||
| 73 | (defcustom lua-ts-luacheck-program "luacheck" | 71 | (defcustom lua-ts-luacheck-program "luacheck" |
| 74 | "Location of the Luacheck program." | 72 | "Location of the Luacheck program." |
| 75 | :type '(choice (const :tag "None" nil) string) | 73 | :type '(choice (const :tag "None" nil) string) |
| 76 | :group 'lua-ts | ||
| 77 | :version "30.1") | 74 | :version "30.1") |
| 78 | 75 | ||
| 79 | (defcustom lua-ts-inferior-buffer "*Lua*" | 76 | (defcustom lua-ts-inferior-buffer "*Lua*" |
| 80 | "Name of the inferior Lua buffer." | 77 | "Name of the inferior Lua buffer." |
| 81 | :type 'string | 78 | :type 'string |
| 82 | :safe 'stringp | 79 | :safe 'stringp |
| 83 | :group 'lua-ts | ||
| 84 | :version "30.1") | 80 | :version "30.1") |
| 85 | 81 | ||
| 86 | (defcustom lua-ts-inferior-program "lua" | 82 | (defcustom lua-ts-inferior-program "lua" |
| 87 | "Program to run in the inferior Lua process." | 83 | "Program to run in the inferior Lua process." |
| 88 | :type '(choice (const :tag "None" nil) string) | 84 | :type '(choice (const :tag "None" nil) string) |
| 89 | :group 'lua-ts | ||
| 90 | :version "30.1") | 85 | :version "30.1") |
| 91 | 86 | ||
| 92 | (defcustom lua-ts-inferior-options '("-i") | 87 | (defcustom lua-ts-inferior-options '("-i") |
| 93 | "Command line options for the inferior Lua process." | 88 | "Command line options for the inferior Lua process." |
| 94 | :type '(repeat string) | 89 | :type '(repeat string) |
| 95 | :group 'lua-ts | ||
| 96 | :version "30.1") | 90 | :version "30.1") |
| 97 | 91 | ||
| 98 | (defcustom lua-ts-inferior-startfile nil | 92 | (defcustom lua-ts-inferior-startfile nil |
| 99 | "File to load into the inferior Lua process at startup." | 93 | "File to load into the inferior Lua process at startup." |
| 100 | :type '(choice (const :tag "None" nil) (file :must-match t)) | 94 | :type '(choice (const :tag "None" nil) (file :must-match t)) |
| 101 | :group 'lua-ts | ||
| 102 | :version "30.1") | 95 | :version "30.1") |
| 103 | 96 | ||
| 104 | (defcustom lua-ts-inferior-prompt ">" | 97 | (defcustom lua-ts-inferior-prompt ">" |
| 105 | "Prompt used by the inferior Lua process." | 98 | "Prompt used by the inferior Lua process." |
| 106 | :type 'string | 99 | :type 'string |
| 107 | :safe 'stringp | 100 | :safe 'stringp |
| 108 | :group 'lua-ts | ||
| 109 | :version "30.1") | 101 | :version "30.1") |
| 110 | 102 | ||
| 111 | (defcustom lua-ts-inferior-prompt-continue ">>" | 103 | (defcustom lua-ts-inferior-prompt-continue ">>" |
| 112 | "Continuation prompt used by the inferior Lua process." | 104 | "Continuation prompt used by the inferior Lua process." |
| 113 | :type 'string | 105 | :type 'string |
| 114 | :safe 'stringp | 106 | :safe 'stringp |
| 115 | :group 'lua-ts | ||
| 116 | :version "30.1") | 107 | :version "30.1") |
| 117 | 108 | ||
| 118 | (defcustom lua-ts-inferior-history nil | 109 | (defcustom lua-ts-inferior-history nil |
| 119 | "File used to save command history of the inferior Lua process." | 110 | "File used to save command history of the inferior Lua process." |
| 120 | :type '(choice (const :tag "None" nil) file) | 111 | :type '(choice (const :tag "None" nil) file) |
| 121 | :safe 'string-or-null-p | 112 | :safe 'string-or-null-p |
| 122 | :group 'lua-ts | ||
| 123 | :version "30.1") | 113 | :version "30.1") |
| 124 | 114 | ||
| 125 | (defcustom lua-ts-indent-continuation-lines t | 115 | (defcustom lua-ts-indent-continuation-lines t |
| @@ -141,7 +131,6 @@ the statement: | |||
| 141 | end" | 131 | end" |
| 142 | :type 'boolean | 132 | :type 'boolean |
| 143 | :safe 'booleanp | 133 | :safe 'booleanp |
| 144 | :group 'lua-ts | ||
| 145 | :version "30.1") | 134 | :version "30.1") |
| 146 | 135 | ||
| 147 | (defvar lua-ts--builtins | 136 | (defvar lua-ts--builtins |
| @@ -628,7 +617,7 @@ Calls REPORT-FN directly." | |||
| 628 | nil t))) | 617 | nil t))) |
| 629 | (select-window (display-buffer lua-ts-inferior-buffer | 618 | (select-window (display-buffer lua-ts-inferior-buffer |
| 630 | '((display-buffer-reuse-window | 619 | '((display-buffer-reuse-window |
| 631 | display-buffer-pop-up-frame) | 620 | display-buffer-pop-up-window) |
| 632 | (reusable-frames . t)))) | 621 | (reusable-frames . t)))) |
| 633 | (get-buffer-process (current-buffer))) | 622 | (get-buffer-process (current-buffer))) |
| 634 | 623 | ||
diff --git a/lisp/treesit.el b/lisp/treesit.el index fa82ad898a9..2b4893e6129 100644 --- a/lisp/treesit.el +++ b/lisp/treesit.el | |||
| @@ -2237,7 +2237,7 @@ for invalid node. | |||
| 2237 | This is used by `treesit-beginning-of-defun' and friends.") | 2237 | This is used by `treesit-beginning-of-defun' and friends.") |
| 2238 | 2238 | ||
| 2239 | (defvar-local treesit-defun-tactic 'nested | 2239 | (defvar-local treesit-defun-tactic 'nested |
| 2240 | "Determines how does Emacs treat nested defuns. | 2240 | "Determines how Emacs treats nested defuns. |
| 2241 | If the value is `top-level', Emacs only moves across top-level | 2241 | If the value is `top-level', Emacs only moves across top-level |
| 2242 | defuns, if the value is `nested', Emacs recognizes nested defuns.") | 2242 | defuns, if the value is `nested', Emacs recognizes nested defuns.") |
| 2243 | 2243 | ||
| @@ -2253,9 +2253,8 @@ If the value is nil, no skipping is performed.") | |||
| 2253 | (defvar-local treesit-defun-name-function nil | 2253 | (defvar-local treesit-defun-name-function nil |
| 2254 | "A function that is called with a node and returns its defun name or nil. | 2254 | "A function that is called with a node and returns its defun name or nil. |
| 2255 | If the node is a defun node, return the defun name, e.g., the | 2255 | If the node is a defun node, return the defun name, e.g., the |
| 2256 | function name of a function. If the node is not a defun node, or | 2256 | name of a function. If the node is not a defun node, or the |
| 2257 | the defun node doesn't have a name, or the node is nil, return | 2257 | defun node doesn't have a name, or the node is nil, return nil.") |
| 2258 | nil.") | ||
| 2259 | 2258 | ||
| 2260 | (defvar-local treesit-add-log-defun-delimiter "." | 2259 | (defvar-local treesit-add-log-defun-delimiter "." |
| 2261 | "The delimiter used to connect several defun names. | 2260 | "The delimiter used to connect several defun names. |
| @@ -2728,12 +2727,12 @@ function is called recursively." | |||
| 2728 | 2727 | ||
| 2729 | ;; TODO: In corporate into thing-at-point. | 2728 | ;; TODO: In corporate into thing-at-point. |
| 2730 | (defun treesit-thing-at-point (thing tactic) | 2729 | (defun treesit-thing-at-point (thing tactic) |
| 2731 | "Return the THING at point or nil if none is found. | 2730 | "Return the THING at point, or nil if none is found. |
| 2732 | 2731 | ||
| 2733 | THING can be a symbol, regexp, a predicate function, and more, | 2732 | THING can be a symbol, a regexp, a predicate function, and more; |
| 2734 | see `treesit-thing-settings' for details. | 2733 | see `treesit-thing-settings' for details. |
| 2735 | 2734 | ||
| 2736 | Return the top-level THING if TACTIC is `top-level', return the | 2735 | Return the top-level THING if TACTIC is `top-level'; return the |
| 2737 | smallest enclosing THING as POS if TACTIC is `nested'." | 2736 | smallest enclosing THING as POS if TACTIC is `nested'." |
| 2738 | 2737 | ||
| 2739 | (let ((node (treesit--thing-at (point) thing))) | 2738 | (let ((node (treesit--thing-at (point) thing))) |
| @@ -2742,11 +2741,11 @@ smallest enclosing THING as POS if TACTIC is `nested'." | |||
| 2742 | node))) | 2741 | node))) |
| 2743 | 2742 | ||
| 2744 | (defun treesit-defun-at-point () | 2743 | (defun treesit-defun-at-point () |
| 2745 | "Return the defun node at point or nil if none is found. | 2744 | "Return the defun node at point, or nil if none is found. |
| 2746 | 2745 | ||
| 2747 | Respects `treesit-defun-tactic': return the top-level defun if it | 2746 | Respects `treesit-defun-tactic': returns the top-level defun if it |
| 2748 | is `top-level', return the immediate parent defun if it is | 2747 | is `top-level', otherwise return the immediate parent defun if it |
| 2749 | `nested'. | 2748 | is `nested'. |
| 2750 | 2749 | ||
| 2751 | Return nil if `treesit-defun-type-regexp' isn't set and `defun' | 2750 | Return nil if `treesit-defun-type-regexp' isn't set and `defun' |
| 2752 | isn't defined in `treesit-thing-settings'." | 2751 | isn't defined in `treesit-thing-settings'." |