;ELC ;;; Compiled ;;; in Emacs version 28.0.50 ;;; with all optimizations. (require 'tree-widget) (defvar tree-mode-version "1.0") (defvar tree-mode-list nil) (defvar tree-mode-map (byte-code "\304 \305 \"\210\306\307\310#\210\306\311\312#\210\306\313\314#\210\306\315\316#\210\306\317\320#\210\306\321\322#\210\306\323\324#\210\306\325\326#\210\306\327\330#\210\306\331\332#\210\306\333\334#\210\306\335\336#\210\306\337\340#\210\306\341\342#\210\306\343\344#\210\345\346\n W\203}\306\347\350\n\\!\351#\210\nT\211\202g*)\207" [map widget-keymap i --dotimes-limit-- make-sparse-keymap set-keymap-parent define-key " " scroll-up "" scroll-down "D" tree-mode-delete-tree "p" tree-mode-previous-node "n" tree-mode-next-node "j" tree-mode-next-sib "k" tree-mode-previous-sib "u" tree-mode-goto-parent "r" tree-mode-goto-root "g" tree-mode-reflesh "E" tree-mode-expand-level "e" tree-mode-toggle-expand "s" tree-mode-sort-by-tag "/" tree-mode-keep-match "!" tree-mode-collapse-other-except 10 0 vector 48 digit-argument] 6)) (defvar tree-mode-menu nil) (byte-code "\204\302\303!\210\304\300 \305\306$\210\303\207" [tree-mode-menu tree-mode-map (lambda (def-tmp-var) (defvar tree-mode-menu def-tmp-var #1="Tree menu")) nil easy-menu-do-define #1# ("Tree" ["Next tree node" tree-mode-next-node t] ["Previous tree node" tree-mode-previous-node t] ["Next sibling node" tree-mode-next-sib t] ["Previous sibling node" tree-mode-previous-sib t] ["Goto parent node" tree-mode-goto-parent t] ["Goto root node" tree-mode-goto-root t] "--" ["Toggle Expand" tree-mode-toggle-expand t] ["Expand to level 1" (lambda nil (interactive) (tree-mode-expand-level 1)) t] ["Expand to level 2" (lambda nil (interactive) (tree-mode-expand-level 2)) t] "--" ["Collapse other tree" tree-mode-collapse-other-except t] ["Sort by tag" tree-mode-sort-by-tag t] ["Keep match" tree-mode-keep-match t])] 5) #@89 Hooks run after insert a tree into buffer. Each function is passed the new tree created (defvar tree-mode-insert-tree-hook nil (#$ . 1910)) #@91 Hooks run after delete a tree in the buffer. Each function is passed the new tree created (defvar tree-mode-delete-tree-hook nil (#$ . 2056)) #@48 Return widget at point or next nearest widget. (defalias 'tree-mode-nearest-widget #[nil "\301 \206\3021`\303\304!\210`W\205\301 )0\207\210\305\207" [pos widget-at (error) widget-forward 1 nil] 2 (#$ . 2204)]) #@41 Find all tree widget in current buffer. (defalias 'tree-mode-scan-tree #[nil "\212eb\210\303\304 \303\211\203/\305\306\n\307\"\211!\203 B\306 \206$\n\310\"b\210\304 \211\204\237\211+\207" [tree-mode-list parent widget nil tree-mode-nearest-widget tree-widget-p widget-get :parent :to] 5 (#$ . 2428)]) #@99 Non-nil if Tree minor mode is enabled. Use the command `tree-minor-mode' to change this variable. (defvar tree-minor-mode nil (#$ . 2750)) (make-variable-buffer-local 'tree-minor-mode) #@587 More keybindings for tree-widget. This is a minor mode. If called interactively, toggle the `Tree minor 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-minor-mode'. The mode's hook is called both when the mode is enabled and when it is disabled. \{tree-mode-map} (defalias 'tree-minor-mode #[(&optional arg) "\305  \306=\203\n?\202 \247\203 \307W\203\310\202\311\312\303!\2032\313\302 \"\n\2032\302 B\n\203=\314\315!\210\316 \210\317\320\n\203G\321\202H\322\"\210\323\324!\203m\305 \203\\\305 \232\203m\325\326\327\n\203h\330\202i\331\f#\210))\332 \210\n\207" [#1=#:last-message arg tree-minor-mode local-minor-modes local current-message toggle 1 nil t boundp delq make-local-variable tree-mode-list tree-mode-scan-tree run-hooks tree-minor-mode-hook tree-minor-mode-on-hook tree-minor-mode-off-hook called-interactively-p any " in current buffer" message "Tree minor mode %sabled%s" "en" "dis" force-mode-line-update] 4 (#$ . 2942) (list (if current-prefix-arg (prefix-numeric-value current-prefix-arg) 'toggle))]) (defvar tree-minor-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\313\310\211%\207" [tree-mode-map tree-minor-mode-hook variable-documentation put "Hook run after entering or leaving `tree-minor-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-minor-mode " Tree"] 6) (defvar tree-mode-hook nil) (byte-code "\300\301N\204\f\302\300\301\303#\210\304\305!\204\302\305\306\307#\210\300\207" [tree-mode-hook variable-documentation put "Hook run after entering Tree mode.\nNo problems result if this variable is not bound.\n`add-hook' automatically binds it. (This is true for all hook variables.)" boundp tree-mode-map definition-name tree-mode] 4) (defvar tree-mode-map (make-sparse-keymap)) (byte-code "\301\302N\204\303\301\302\304\305!#\210\306\307!\204\303\307\310\311#\210\312\313 !\210\307\302N\204-\303\307\302\304\314!#\210\306\300!\204B\303\300\310\311#\210\315\316\300\317\"\210!\210\300\302N\204P\303\300\302\304\320!#\210\303\311\321\317#\207" [tree-mode-abbrev-table tree-mode-map variable-documentation put purecopy "Keymap for `tree-mode'." boundp tree-mode-syntax-table definition-name tree-mode (lambda (def-tmp-var) (defvar tree-mode-syntax-table def-tmp-var)) make-syntax-table "Syntax table for `tree-mode'." (lambda (def-tmp-var) (defvar tree-mode-abbrev-table def-tmp-var)) define-abbrev-table nil "Abbrev table for `tree-mode'." derived-mode-parent] 5) #@153 A mode to manage many tree widgets This mode runs the hook `tree-mode-hook', as the final or penultimate step during initialization. \{tree-mode-map} (defalias 'tree-mode #[nil "\306\300!\210\307\310 \210\311\312\313 !\210\314\f!\210 \306\315!\210\306\316!\210\306\317!\210\320 \210)\321\322!\207" [delay-mode-hooks major-mode mode-name tree-mode-map tree-mode-syntax-table tree-mode-abbrev-table make-local-variable t kill-all-local-variables tree-mode "Tree" use-local-map set-syntax-table tree-mode-list tree-mode-insert-tree-hook tree-mode-delete-tree-hook widget-setup run-mode-hooks tree-mode-hook local-abbrev-table] 2 (#$ . 5911) nil]) (add-hook 'tree-widget-before-create-icon-functions 'tree-mode-icon-create) (defalias 'tree-mode-icon-create #[(icon) "\302\211\303\"\304\"\211\205\305\306 #)\207" [icon img widget-get :node :button-icon widget-put :glyph-name] 5]) #@126 Insert tree to buffer. If BEFORE is non-nil and is a tree in current buffer, the new TREE will insert at position of BEFORE. (defalias 'tree-mode-insert #[(tree &optional before) "\203 >\203\303\304\"b\210\202db\210\305\n!\306 \nC\"\307\310\n\"\210\n\207" [before tree-mode-list tree widget-get :from widget-create append run-hook-with-args tree-mode-insert-tree-hook] 3 (#$ . 6806)]) #@28 Delete tree in the buffer. (defalias 'tree-mode-delete #[(tree) "\302 \"\303!\210\304\305\"\207" [tree tree-mode-list delq widget-delete run-hook-with-args tree-mode-delete-tree-hook] 3 (#$ . 7208)]) #@46 Return the buffer where the TREE is inserted (defalias 'tree-mode-tree-buffer #[(tree) "\301\302\303\"!\207" [tree marker-buffer widget-get :from] 4 (#$ . 7418)]) #@49 If no tree in current buffer, kill this buffer. (defalias 'tree-mode-kill-buffer #[(&rest ignore) "G\301U\205\n\302p!\207" [tree-mode-list 0 kill-buffer] 2 (#$ . 7588)]) #@26 Test if the TREE is root (defalias 'tree-mode-root-treep #[(tree) "\301!\205 \302\303\"?\207" [tree tree-widget-p widget-get :parent] 3 (#$ . 7766)]) #@52 If there is tree-widget in current line, return t. (defalias 'tree-mode-tree-linep #[nil "\301 \211\205\302\303\"\262?)\207" [wid tree-mode-icon-current-line widget-get :tree-widget--leaf-flag] 5 (#$ . 7925)]) #@49 If the root tree node in current line, return t (defalias 'tree-mode-root-linep #[nil "\301 \211\205\302\303\"\262?\205\302\211\304\"\304\"?)\207" [wid tree-mode-icon-current-line widget-get :tree-widget--leaf-flag :parent] 5 (#$ . 8147)]) #@40 Return the icon widget in current line (defalias 'tree-mode-icon-current-line #[nil "\212\300y\210\301 )\207" [0 tree-mode-nearest-widget] 1 (#$ . 8402)]) #@41 Return the push button in current line. (defalias 'tree-mode-button-current-line #[nil "\212\302 \303\304 b\210\204` V\203\305`\306\"\307u\210\202\n+\207" [but pos line-beginning-position nil line-end-position get-char-property button -1] 3 (#$ . 8563)]) #@86 If current line is root line, return the root tree, otherwise return the parent tree (defalias 'tree-mode-parent-current-line #[nil "\302 \303\211\205* \304\305\"\262\203\304 \306\"\202*\304\211 \306\"\306\"\211\206*\304 \306\"*\207" [parent wid tree-mode-icon-current-line nil widget-get :tree-widget--leaf-flag :parent] 5 (#$ . 8834)]) #@37 Return tree root of the widget WID. (defalias 'tree-mode-widget-root #[(wid) "\302\303 \304\"\211\203\202 )\207" [parent wid nil widget-get :parent] 3 (#$ . 9188)]) #@31 Return the root tree at point (defalias 'tree-mode-tree-ap #[(&optional pos) "\212\203b\210\3011\302\303 !0\202\210\304)\207" [pos (error) tree-mode-widget-root tree-mode-icon-current-line nil] 2 (#$ . 9367)]) #@64 Find all opened tree. Return the tag list with the same depth. (defalias 'tree-mode-opened-tree #[(tree) "\301\302\"\205\301\303!\304\"\305\306\307\310\301\311\"\"\"B\207" [tree widget-get :open tree-widget-node :tag delq nil mapcar #[(child) "\301!\205 \302!\207" [child tree-widget-p tree-mode-opened-tree] 2] :children] 8 (#$ . 9591)]) #@60 Open tree using tag list given by `tree-mode-opened-tree'. (defalias 'tree-mode-open-tree #[(tree path) "\205\302 \303\"\204\304 !\210A\211\205\305\306\302 \307\"\"\207" [path tree widget-get :open widget-apply-action mapc #[(child) "\304!\205\305\306!\307\"\310 \n\"\211\205\311 \"*\207" [child tag path subpath tree-widget-p widget-get tree-widget-node :tag assoc tree-mode-open-tree] 4] :children] 6 (#$ . 9944)]) #@149 Redraw TREE. If tree has attribute :dynargs, generate new :args from that function. Otherwise use :old-args which saved by `tree-mode-backup-args'. (defalias 'tree-mode-reflesh-tree #[(tree) "\302!\303\304\"\203\305\306\307#\210\202$\303\310\"\203$\305\306\303\310\"#\210\311\312!\"\210\313 \")\207" [tree path tree-mode-opened-tree widget-get :dynargs widget-put :args nil :old-args widget-value-set widget-value tree-mode-open-tree] 6 (#$ . 10386)]) #@60 Put this function to :notify property of tree-widget node. (defalias 'tree-mode-reflesh-parent #[(widget &rest ignore) "\301\302\303\"!\207" [widget tree-mode-reflesh-tree widget-get :parent] 4 (#$ . 10858)]) #@20 Move to next node. (defalias 'tree-mode-next-node #[(arg) "\301\302_!\207" [arg widget-forward 2] 3 (#$ . 11074) "p"]) (defalias 'tree-mode-previous-node #[(arg) "\301[!\207" [arg tree-mode-next-node] 2 nil "p"]) #@28 Move to next sibling node. (defalias 'tree-mode-next-sib #[(arg) "\306\211\211\211\211\307 \203\310  \202/\311 \312 \313 \203(\314\f\315\"\314\316\")\f \235\317V\203S GY\203K\320\321 !@\202O 8\202g G GZ[Z\211\317W\317\n] 8\314\n\322\"b\210\205\200\323\324\317W\203~\325\202\326\"-\207" [out-range others sib siblings me tree-mode-list nil tree-mode-root-linep tree-mode-tree-ap tree-mode-parent-current-line tree-mode-button-current-line tree-mode-tree-linep widget-get :parent :children 0 t last :from message "No %s sibling more!" "previous" "next" parent arg] 6 (#$ . 11295) "p"]) #@32 Move to previous sibling node. (defalias 'tree-mode-previous-sib #[(arg) "\301[!\207" [arg tree-mode-next-sib] 2 (#$ . 11928) "p"]) #@19 Move to root node (defalias 'tree-mode-goto-root #[nil "\301 \211\203\302\303\"b\202\304\305!)\207" [root tree-mode-tree-ap widget-get :from message "No Root!"] 4 (#$ . 12067) nil]) #@22 Move to parent node. (defalias 'tree-mode-goto-parent #[(arg) "\302  S\2031\303\304\"b\210 \305V\2054\303\306\"\211\2054\303\304\"b\2054 S\211\2054\202\307\310!)\207" [parent arg tree-mode-parent-current-line widget-get :from 0 :parent message "No parent!"] 3 (#$ . 12261) "p"]) #@285 Find node by path. Return a cons cell (NODE . REST). Check the rest to find if the node is node of the full path. PATH is a list of node tag to search from root. Note if the tree is not opened, It will open some node when need. `set-buffer' to tree buffer before call this function. (defalias 'tree-mode-find-node #[(tree path) "\306!\205n \205n\307\310\"A G\311U\203\312\202\306\313\211\n\204l \203l @\f !\203f\314 ! @\230\203f A\203X\306 !\203Q\307 \315\"\204Q\316 !\210\317 @ A\"\n\204! @ AB\211\202\" A\202!\n,\207" [tree path found node predicate children tree-widget-p widget-get :children 1 widget-type nil tree-mode-node-tag :open widget-apply-action tree-mode-find-node] 5 (#$ . 12562)]) #@68 Collapse other trees. If the tree at point is contract, expand it. (defalias 'tree-mode-collapse-other-except #[nil "\302 \211\303\304\"\262\203\305\306!\202:\303\307\"\303\310\"\204#\311!\210\312\313\314\315!\2031 \2028\303\211\307\"\316\"\"\")\207" [me tree-mode-list tree-mode-icon-current-line widget-get :tree-widget--leaf-flag message "Not a tree under point!" :parent :open widget-apply-action mapc #[(tree) "\301\302\"\205\n\303!\207" [tree widget-get :open widget-apply-action] 3] remq tree-mode-root-treep :children] 9 (#$ . 13292) nil]) #@21 Collapse child node (defalias 'tree-mode-collapse-children #[(tree) "\301\302\303\304\"\"\207" [tree mapc #[(child) "\301\302\"\205\n\303!\207" [child widget-get :open widget-apply-action] 3] widget-get :children] 5 (#$ . 13865)]) #@19 Expand child node (defalias 'tree-mode-expand-children #[(tree) "\301\302\303\304\"\"\207" [tree mapc #[(child) "\301!\205\302\303\"?\205\304!\207" [child tree-widget-p widget-get :open widget-apply-action] 3] widget-get :children] 5 (#$ . 14106)]) #@40 Put it to :notify of tree widget node. (defalias 'tree-mode-toggle-expand-node #[(&rest ignore) "\300 \207" [tree-mode-toggle-expand] 1 (#$ . 14369)]) (defalias 'tree-mode-toggle-expand #[(&optional arg) "\304 \305\211\211\306\307\"\262\203\310\311!\202:\306\n\312\"\306\n\313\" \204* ?\202/\314 !\315V\211 =?\205:\316\n!+\207" [open expandp me arg tree-mode-icon-current-line nil widget-get :tree-widget--leaf-flag message "Not a tree under point!" :parent :open prefix-numeric-value 0 widget-apply-action] 5 nil "P"]) #@95 Expand tree to LEVEL. With prefix argument 0 or negative, will expand all leaves of the tree. (defalias 'tree-mode-expand-level #[(level) "\302 \211\303\304\"\262\203\305\306!\202\303\307\"\310 S\")\207" [me level tree-mode-icon-current-line widget-get :tree-widget--leaf-flag message "Not a tree under point!" :parent tree-mode-expand-level-1] 5 (#$ . 14909) "p"]) (defalias 'tree-mode-expand-level-1 #[(tree level) "\302!\205\"\303\304\"\204\305!\210 \306U\203\307!\207\310\311\303\312\"\"\207" [tree level tree-widget-p widget-get :open widget-apply-action 0 tree-mode-collapse-children mapc #[(child) "\302 S\"\207" [child level tree-mode-expand-level-1] 3] :children] 5]) #@42 Return tag of push-button or tree-widget (defalias 'tree-mode-node-tag #[(node) "\301\302\"\206\301\211\303\"\302\"\207" [node widget-get :tag :node] 4 (#$ . 15613)]) #@36 Save :args of tree-widget if need. (defalias 'tree-mode-backup-args #[(widget) "\301\302\"\205\f\301\303\"??\205\304\303\305\301\306\"!#\207" [widget widget-get :dynargs :old-args widget-put copy-sequence :args] 7 (#$ . 15790)]) #@67 Remove children nodes when call FILTER with the node return true. (defalias 'tree-mode-filter-children #[(widget filter) "\301!\210\302\303\304\305\306\307\310\303\"\"\"#\210\311\312!\"\207" [widget tree-mode-backup-args widget-put :args delq nil mapcar #[(child) " !\205 \207" [filter child] 2] widget-get widget-value-set widget-value] 10 (#$ . 16032)]) #@38 Sort node by which node has children (defalias 'tree-mode-sort-by-nchild #[(wid1 wid2) "\301\302\"\207" [wid1 widget-get :children] 3 (#$ . 16402)]) #@32 Sort children nodes by SORTER. (defalias 'tree-mode-sort-children #[(widget sorter) "\302!\210\303\304\305\306\307\304\"! \"#\210\310\311!\"\207" [widget sorter tree-mode-backup-args widget-put :args sort copy-sequence widget-get widget-value-set widget-value] 8 (#$ . 16558)]) #@28 Sort children node by tag. (defalias 'tree-mode-sort-by-tag #[(arg) "\301 \211\203\302\303\"\202\304\305!)\207" [tree tree-mode-parent-current-line tree-mode-sort-children #[(w1 w2) "\302 \"\206\303!\303 !\231\207" [w1 w2 tree-mode-sort-by-nchild tree-mode-node-tag] 3] message "No tree at point!"] 4 (#$ . 16847) "P"]) #@37 Remove node which tag match REGEXP. (defalias 'tree-mode-delete-match #[(regexp) "\301 \211\203\302\303\"\202\304\305!)\207" [tree tree-mode-parent-current-line tree-mode-filter-children #[(child) "\302\303 !\"?\207" [regexp child string-match tree-mode-node-tag] 4] message "No tree at point!"] 4 (#$ . 17183) "sDelete node match: "]) #@34 Keep node which tag match REGEXP (defalias 'tree-mode-keep-match #[(regexp) "\301 \211\203\302\303\"\202\304\305!)\207" [tree tree-mode-parent-current-line tree-mode-filter-children #[(child) "\302\303 !\"\207" [regexp child string-match tree-mode-node-tag] 4] message "No tree at point!"] 4 (#$ . 17532) "sKeep node match: "]) #@22 Reflesh parent tree. (defalias 'tree-mode-reflesh #[nil "\301 \211\203 \302!\202\303\304!)\207" [tree tree-mode-parent-current-line tree-mode-reflesh-tree message "No tree at point!"] 3 (#$ . 17873) nil]) #@28 Delete a tree from buffer. (defalias 'tree-mode-delete-tree #[nil "\300 \203\301\302!\205\303\304 !\207\305\306!\207" [tree-mode-root-linep yes-or-no-p "Delete current tree? " tree-mode-delete tree-mode-tree-ap message "No tree at point!"] 2 (#$ . 18089) nil]) (provide 'tree-mode)