;ELC ;;; Compiled ;;; in Emacs version 28.0.50 ;;; with all optimizations. (byte-code "\300\301!\210\300\302!\210\300\303!\210\300\304!\210\305\306\307\310\311\304%\207" [require cl-lib seq subr-x tree-sitter custom-declare-group tree-sitter-indent nil "Indent lines using Tree-sitter as backend" :group] 6) #@41 Indent offset to be used by major modes (defvar tree-sitter-indent-offset 4 (#$ . 320)) (byte-code "\300\301!\210\302\303\304\305\306DD\307\310\311%\210\302\312\304\305\313DD\307\310\311%\207" [make-variable-buffer-local tree-sitter-indent-offset custom-declare-variable tree-sitter-indent-julia-scopes funcall function #[0 "\300\207" [((indent-all class_body binary_expression) (indent-rest assignment_expression export_statement import_statement) (indent-body compound_expression do_clause for_statement function_definition if_statement while_statement) (paren-indent argument_list) (multi-line-text triple_string) (outdent else_clause))] 1] "Scopes for indenting in Julia." :type sexp tree-sitter-indent-rust-scopes #[0 "\300\207" [((indent-all where_clause) (indent-rest function_item for_expression) (indent-body let_declaration) (paren-indent parameters) (align-char-to (46 call_expression field_expression)) (aligned-siblings where_predicate) (multi-line-text) (outdent "}"))] 1]] 6) #@47 Current scopes in use for tree-sitter-indent. (defvar tree-sitter-indent-current-scopes nil (#$ . 1317)) (make-variable-buffer-local 'tree-sitter-indent-current-scopes) #@107 Non-nil if NODE type is in indent-all group. Nodes in this group will be always +1 indentend. (fn NODE) (defalias 'tree-sitter-indent--node-is-indent-all #[257 "\301\236A\302!\235\207" [tree-sitter-indent-current-scopes indent-all tsc-node-type] 5 (#$ . 1493)]) #@143 Non-nil if NODE type is in indent-rest group. Nodes in this group will +1 indentend if they are a non-first child of parent node. (fn NODE) (defalias 'tree-sitter-indent--node-is-indent-rest #[257 "\301\236A\302!\235\207" [tree-sitter-indent-current-scopes indent-rest tsc-node-type] 5 (#$ . 1768)]) #@170 Non-nil if NODE type is in indent-body group. Nodes in this group will +1 indentend if they are both a non-first child of and non-last child of parent node. (fn NODE) (defalias 'tree-sitter-indent--node-is-indent-body #[257 "\301\236A\302!\235\207" [tree-sitter-indent-current-scopes indent-body tsc-node-type] 5 (#$ . 2081)]) #@115 Non-nil if NODE type is in indent-rest group. Nodes in this group will keep their current indentation (fn NODE) (defalias 'tree-sitter-indent--node-is-multi-line-text #[257 "\301\236A\302!\235\207" [tree-sitter-indent-current-scopes multi-line-text tsc-node-type] 5 (#$ . 2421)]) #@136 Non-nil if NODE type is in aligned-siblings group. Nodes in this group will be aligned to the column of the first sibling. (fn NODE) (defalias 'tree-sitter-indent--node-is-aligned-sibling #[257 "\301\236A\302!\235\207" [tree-sitter-indent-current-scopes aligned-siblings tsc-node-type] 5 (#$ . 2714)]) #@136 Get the node at buffer POSITION that's at the highest level. POSITION is a byte position in buffer like \(point-min\). (fn POSITION) (defalias 'tree-sitter-indent--highest-node-at-position #[257 "\212\211b\210\300 \211\203$\301!\211\205\302!\302!=\205\211\211\262\262\204\211\262)\207" [tree-sitter-node-at-point tsc-get-parent tsc-node-start-byte] 6 (#$ . 3029)]) #@114 Get list of nodes by moving parent-wise starting at NODE. The last element in returned path is NODE. (fn NODE) (defalias 'tree-sitter-indent--parentwise-path #[257 "\300!C\203B\262\300!\262\202\207" [tsc-get-parent] 5 (#$ . 3416)]) #@132 Non-nil if NODE type is in paren-indent group. Child nodes in this group will be indentend to the paren opener column. (fn NODE) (defalias 'tree-sitter-indent--node-is-paren-indent #[257 "\301\236A\302!\235\207" [tree-sitter-indent-current-scopes paren-indent tsc-node-type] 5 (#$ . 3669)]) #@522 When node is in a chain call, return column to align each call. CURRENT-NODE current node being indented ALIGN-CHAR-TO-ALIST char → group of node types we can move within when searching for the first chain char. This group is supposed to contain all node types conformed by a chain. PARENTWISE-PATH nodes from CURRENT-NODE to tree root ("document") Returns a column to indent to or nil if no such column can / should be applied. Reads text from current buffer. (fn CURRENT-NODE ALIGN-CHAR-TO-ALIST PARENTWISE-PATH) (defalias 'tree-sitter-indent--chain-column #[771 "\300\301!!\302\"\211\205\303\304\305\306\"\307!A\"!\211\2054\212\310!b\210\311\312\313!!\314!\315#\210`S)\211\205A\212\310!b\210\316 )\211\205g\247\205gW\204^\212b\210\317 \210`)=\205g\212b\210\320 Z)\207" [string-to-char tsc-node-text alist-get seq-first seq-take-while make-closure #[257 "\301!\300\235\207" [V0 tsc-node-type] 3 "\n\n(fn NODE)"] reverse tsc-node-start-byte search-forward-regexp regexp-quote char-to-string tsc-node-end-byte t line-end-position back-to-indentation line-beginning-position] 10 (#$ . 3973)]) #@359 Column position for CURRENT-NODE's first sibling. If CURRENT-NODE belongs to the aligned-siblings group, will look up the first sibling in same group \(running through PARENT-NODE's children) and return its column. TREE-SITTER-INDENT-CURRENT-SCOPES is used to test whether CURRENT-NODE belongs to the aligned-siblings group. (fn CURRENT-NODE PARENT-NODE) (defalias 'tree-sitter-indent--first-sibling-column #[514 "\211\205f\300!\205f\301!\211\205H\302\211\303\302\203!\304\305\"\202$\306!\262\203F\301!\232\203<\262\302\211\262\202=\303\203F\302\262\202\266\203\211\205O\307!\211\205d\310\"?\205d\212\211b\210\211\311 Z)\266\203\207" [tree-sitter-indent--node-is-aligned-sibling tsc-node-type nil t tsc-get-nth-child 0 tsc-get-next-sibling tsc-node-start-byte tsc-node-eq line-beginning-position] 10 (#$ . 5105)]) #@837 Map PARENTWISE-PATH into indent instructions. Each element of the returned list is one of the following no-indent nothing to add to current column indent add one indent to current column outdent subtract one indent to current column (column-indent . COLUMN) match parent's parent opener column (preserve . ORIGINAL-COLUMN) preserve the column that was before What is checked to add an indent: - A node bolongs into the "indent" group in TREE-SITTER-INDENT-SCOPES - Deterimen what group the node's parent belongs to, and whether the node is in a middle position. - A node belongs to the "outdent" group in TREE-SITTER-INDENT-SCOPES - A node belongs to the "column-indent" group in TREE-SITTER-INDENT-SCOPES (fn PARENTWISE-PATH ORIGINAL-COLUMN) (defalias 'tree-sitter-indent--indents-in-path #[514 "\300\211GS\"\301\302\303$\"\207" [seq-elt seq-map make-closure #[257 "\304!\305!\306!\211\205\307!\302=\205\310!\311 \312\236A\211\262\262\300#\313 \"\247\203<\314D\207\211\247\203E\314D\207\315\n!\203P\316\301B\207\203x\317!\203x\320!\212\211b\210`)\212b\210\321\322!\210`)ZT\314D\207\204\234\203\214\203\214\323!\204\234\203\244\203\244\324!\203\244\203\242\325\207\326\207\203\252\327\207\325\207" [V0 V1 V2 tree-sitter-indent-current-scopes tsc-get-prev-sibling tsc-get-next-sibling tsc-get-parent tree-sitter-indent--node-is-indent-all tree-sitter-indent--node-is-outdent tree-sitter-indent--chain-column align-char-to tree-sitter-indent--first-sibling-column column-indent tree-sitter-indent--node-is-multi-line-text preserve tree-sitter-indent--node-is-paren-indent tsc-node-start-byte beginning-of-line 1 tree-sitter-indent--node-is-indent-rest tree-sitter-indent--node-is-indent-body no-indent indent outdent] 16 "\n\n(fn CURRENT-NODE)"]] 9 (#$ . 5960)]) #@122 Return non-nil if NODE outdents per SCOPES. NODE is tested if it belongs into the "outdent" group in SCOPES. (fn NODE) (defalias 'tree-sitter-indent--node-is-outdent #[257 "\301\236A\302!\235\207" [tree-sitter-indent-current-scopes outdent tsc-node-type] 5 (#$ . 7890)]) #@228 Return COLUMN after added indent instructions per INDENT. INDENT is one of `tree-sitter-indent--indents-in-path'. If "1 indent" is to be applied, then returned value is TREE-SITTER-INDENT-OFFSET + INDENT. (fn COLUMN INDENT) (defalias 'tree-sitter-indent--updated-column #[514 "\211\301\267\202\207\\\207Z\207\211:\203A\211\242\211\302\267\202<\243\211:\2034\211\242\243\211\204.\207\303\304\"\207\303\304\"\207\243\207\303\304\"\207\303\304\"\207" [tree-sitter-indent-offset #s(hash-table size 3 test eq rehash-size 1.5 rehash-threshold 0.8125 purecopy t data (no-indent 6 indent 8 outdent 12)) #s(hash-table size 2 test eq rehash-size 1.5 rehash-threshold 0.8125 purecopy t data (column-indent 29 preserve 57)) error "Unexpected indent instruction: %s"] 9 (#$ . 8174)]) #@391 Return the column the first non-whitespace char at POSITION should indent to. Collect indent instruction per AST with `tree-sitter-indent--indents-in-path', then apply instructions with `tree-sitter-indent--updated-column' using TREE-SITTER-INDENT-OFFSET as step. See `tree-sitter-indent-line'. ORIGINAL-COLUMN is forwarded to `tree-sitter-indent--indents-in-path' (fn ORIGINAL-COLUMN) (defalias 'tree-sitter-indent--indent-column #[257 "\300\212\301 \210`)!\302!\303\"\304\305\306#\207" [tree-sitter-indent--highest-node-at-position back-to-indentation tree-sitter-indent--parentwise-path tree-sitter-indent--indents-in-path seq-reduce tree-sitter-indent--updated-column 0] 8 (#$ . 8975)]) #@52 Use Tree-sitter as backend to indent current line. (defalias 'tree-sitter-indent-line #[0 "\204\301\300!\210`\212\302y\210\303\304w\210`)\211W\305\306 Z!\307!\211\247\2051\203.\212\310!)\207\310!\207" [tree-sitter-indent-current-scopes cl--assertion-failed 0 " " nil abs line-beginning-position tree-sitter-indent--indent-column indent-line-to] 7 (#$ . 9680)]) #@60 Call `tree-sitter-indent-line' while printing useful info. (defalias 'tree-sitter-indent-line-and-debug #[0 "\301\302!`\303!\304!\305\306\"\307!\310 \311\312\301\302!\306 !&\207" [tree-sitter-tree thing-at-point line tree-sitter-indent--highest-node-at-position tree-sitter-indent--parentwise-path seq-map tsc-node-type tsc-tree-to-sexp tree-sitter-indent-line message "tree-sitter-indent: Indented ⎡%s⎦ to ⎡%s⎦ (col %s) because of parentwise path of ⎡%s⎦ (while looking at ⎡%s⎦ & when tree is ⎡%s⎦)"] 15 (#$ . 10059)]) #@115 Non-nil if Tree-Sitter-Indent mode is enabled. Use the command `tree-sitter-indent-mode' to change this variable. (defvar tree-sitter-indent-mode nil (#$ . 10619)) (make-variable-buffer-local 'tree-sitter-indent-mode) #@620 Use Tree-sitter as backend for indenting buffer. This is a minor mode. If called interactively, toggle the `Tree-Sitter-Indent mode' mode. If the prefix argument is positive, enable the mode, and if it is zero or negative, disable the mode. If called from Lisp, toggle the mode if ARG is `toggle'. Enable the mode if ARG is nil, omitted, or is a positive number. Disable the mode if ARG is a negative number. To check whether the minor mode is enabled in the current buffer, evaluate `tree-sitter-indent-mode'. The mode's hook is called both when the mode is enabled and when it is disabled. (fn &optional ARG) (defalias 'tree-sitter-indent-mode #[256 "\306 \307=\203 ?\202\247\203\310W\203\311\202\312\313\301!\2031\314\300 \"\2031\300 B\203j\n\204<\302 \210\315\303!\210\316\315\305!\210\317\320\321\322\323\324\325\f!#\"!J\315\326!\210\317\320\327\322\323\324\325\f!#\"!J\202r\315\303!\210\330\303!\331\332\203|\333\202}\334\"\210\335\336!\203\237\306 \203\221\211\306 \232\203\237\337\340\203\233\341\202\234\342\343#\210\210\344 \210\207" [tree-sitter-indent-mode local-minor-modes tree-sitter-mode indent-line-function major-mode tree-sitter-indent-offset current-message toggle 1 nil t boundp delq make-local-variable tree-sitter-indent-line intern format "%s-indent-offset" replace-regexp-in-string "-mode" "" symbol-name tree-sitter-indent-current-scopes "tree-sitter-indent-%s-scopes" default-value run-hooks tree-sitter-indent-mode-hook tree-sitter-indent-mode-on-hook tree-sitter-indent-mode-off-hook called-interactively-p any message "Tree-Sitter-Indent mode %sabled%s" "en" "dis" " in current buffer" force-mode-line-update] 10 (#$ . 10844) (byte-code "\203\n\301!\202 \302C\207" [current-prefix-arg prefix-numeric-value toggle] 2)]) (defvar tree-sitter-indent-mode-hook nil) (byte-code "\301\302N\204\f\303\301\302\304#\210\303\301\305\306#\210\303\301\307\310C#\210\311\312\310\313\300!\205#\310\211%\210\314\315!\207" [tree-sitter-indent-mode-map tree-sitter-indent-mode-hook variable-documentation put "Hook run after entering or leaving `tree-sitter-indent-mode'.\nNo problems result if this variable is not bound.\n`add-hook' automatically binds it. (This is true for all hook variables.)" custom-type hook standard-value nil add-minor-mode tree-sitter-indent-mode boundp provide tree-sitter-indent] 6)