;ELC ;;; Compiled ;;; in Emacs version 28.0.50 ;;; with all optimizations. (byte-code "\300\301!\210\300\302!\210\300\303!\207" [require dash s pcase] 2) #@102 Import FILE's FUNCTIONS. Creates a list of `declare-function' statements. (fn FILE &rest FUNCTIONS) (defalias 'treemacs-import-functions-from '(macro . #[385 "\300\301\302\"\"\303B\207" [mapcar make-closure #[257 "\301\300E\207" [V0 declare-function] 4 "\n\n(fn IT)"] progn] 6 (#$ . 167)])) (byte-code "\300\301\302\303#\300\207" [function-put treemacs-import-functions-from lisp-indent-function 1] 4) #@284 Assert for macros that triggers at expansion time. Tests PREDICATE and, if it evaluates to nil, throws an error with ERROR-MSG and ERROR-ARGS. Basically the same thing as `cl-assert', but does not (seem to) interfere with auto-completion. (fn PREDICATE ERROR-MSG &rest ERROR-ARGS) (defalias 'treemacs-static-assert '(macro . #[642 "\300\301\302\303\304\305E\306BFDE\207" [unless error apply #'format concat "[Treemacs] " list] 11 (#$ . 581)])) (byte-code "\300\301\302\303#\300\207" [function-put treemacs-static-assert lisp-indent-function 1] 4) #@71 Temporarily turn off read-only mode to execute BODY. (fn &rest BODY) (defalias 'treemacs-with-writable-buffer '(macro . #[128 "\300\301BB\207" [let (buffer-read-only)] 4 (#$ . 1141)])) (put 'treemacs-with-writable-buffer 'edebug-form-spec t) #@244 Safely extract BUTTON's PROPERTIES. Using `button-get' on a button located in a buffer that is not the current buffer does not work, so this function will run the property extraction from inside BUTTON's buffer. (fn BUTTON &rest PROPERTIES) (defalias 'treemacs-safe-button-get '(macro . #[385 "\300\301DG\302U\203\303@E\202\304\303\305BBEE\207" [with-current-buffer marker-buffer 1 treemacs-button-get --map (it)] 8 (#$ . 1392)])) #@248 Use BTN's buffer to execute BODY. Required for button interactions (like `treemacs-button-get') that do not work when called from another buffer than the one the button resides in and `treemacs-safe-button-get' is not enough. (fn BTN &rest BODY) (defalias 'treemacs-with-button-buffer '(macro . #[385 "\300\301DBB\207" [with-current-buffer marker-buffer] 5 (#$ . 1842)])) (byte-code "\300\301\302\303#\304\301\305\306#\207" [function-put treemacs-with-button-buffer lisp-indent-function 1 put edebug-form-spec (form body)] 5) #@152 Same as `-if-let-', but the negative case is handled in the first form. Delegates VAR-VAL and the given FORMS to `-if-let-'. (fn VAR-VAL &rest FORMS) (defalias 'treemacs-unless-let '(macro . #[385 "\211A@\300\301BF\207" [-if-let progn] 8 (#$ . 2378)])) (byte-code "\300\301\302\303#\210\304\301\305\306#\300\207" [put treemacs-unless-let edebug-form-spec ((sexp form) body) function-put lisp-indent-function 2] 4) #@154 Execute an action with the current button bound to 'current-btn'. Log ERROR-MSG if no button is selected, otherwise run BODY. (fn ERROR-MSG &rest BODY) (defalias 'treemacs-with-current-button '(macro . #[385 "\300\301\302B\303DF\207" [-if-let (current-btn (treemacs-current-button)) progn treemacs-pulse-on-failure] 7 (#$ . 2804)])) (put 'treemacs-with-current-button 'edebug-form-spec '(form body)) #@76 Execute BODY with `treemacs--ready-to-follow' set to nil. (fn &rest BODY) (defalias 'treemacs-without-following '(macro . #[128 "\300\301\302BBB\207" [let ((treemacs--ready-to-follow nil)) (ignore treemacs--ready-to-follow)] 5 (#$ . 3213)])) (put 'treemacs-without-following 'edebug-form-spec t) #@661 Building block macro to execute a form based on the current node state. Will bind to current button to 'btn' for the execution of the action forms. When NO-ERROR is non-nil no error will be thrown if no match for the button state is achieved. Otherwise either one of ON-ROOT-NODE-OPEN, ON-ROOT-NODE-CLOSED, ON-FILE-NODE-OPEN, ON-FILE-NODE-CLOSED, ON-DIR-NODE-OPEN, ON-DIR-NODE-CLOSED, ON-TAG-NODE-OPEN, ON-TAG-NODE-CLOSED, ON-TAG-NODE-LEAF or ON-NIL will be executed. (fn &key NO-ERROR ON-ROOT-NODE-OPEN ON-ROOT-NODE-CLOSED ON-FILE-NODE-OPEN ON-FILE-NODE-CLOSED ON-DIR-NODE-OPEN ON-DIR-NODE-CLOSED ON-TAG-NODE-OPEN ON-TAG-NODE-CLOSED ON-TAG-NODE-LEAF ON-NIL) (defalias 'treemacs-do-for-button-state '(macro . #[128 "\300\301\"A@\300\302\"A@\300\303\"A@\300\304\"A@\300\305\"A@\300\306\"A@\300\307\"A@\300\310\"A@\300 \311\"A@\300\n\312\"A@\300 \313\"A@\314\315\316\317\320\205W\321DC\205a\322DC\205k\323DC\205u\324DC\205\325DC\205\211\326DC\205\223\327DC\205\235\330DC\205\247\331DC?\205\256\332&\nBBF\207" [plist-member :no-error :on-root-node-open :on-root-node-closed :on-file-node-open :on-file-node-closed :on-dir-node-open :on-dir-node-closed :on-tag-node-open :on-tag-node-closed :on-tag-node-leaf :on-nil -if-let (btn (treemacs-current-button)) pcase (treemacs-button-get btn :state) append `root-node-open `root-node-closed `file-node-open `file-node-closed `dir-node-open `dir-node-closed `tag-node-open `tag-node-closed `tag-node ((state (error "[Treemacs] Unexpected button state %s" state)))] 27 (#$ . 3518)])) (put 'treemacs-do-for-button-state 'edebug-form-spec '(&rest [sexp form])) #@950 Infrastructure macro for setting up actions on different button states. Fetches the currently selected button and verifies it's in the correct state based on the given state actions. If it isn't it will log NO-MATCH-EXPLANATION, if it is it selects WINDOW (or `next-window' if none is given) and splits it with SPLIT-FUNCTION if given. If SAVE-WINDOW is non-nil the selected window will remain selected after the actions have been executed. If ENSURE-WINDOW-SPLIT is non-nil treemacs will vertically split the window if treemacs is the only window to make sure a buffer is opened next to it, not under or below it. DIR-ACTION, FILE-ACTION, TAG-SECTION-ACTION and TAG-ACTION are inserted into a `pcase' statement matching the buttons state. Project root nodes are treated the same common directory nodes. (fn &key NO-MATCH-EXPLANATION WINDOW SPLIT-FUNCTION SAVE-WINDOW ENSURE-WINDOW-SPLIT DIR-ACTION FILE-ACTION TAG-SECTION-ACTION TAG-ACTION) (defalias 'treemacs--execute-button-action '(macro . #[128 "\300\301\"A@\300\302\"A@\300\303\"A@\300\304\"A@\300\305\"A@\300\306\"A@\300\307\"A@\300\310\"A@\300 \311\"A@\312\203S\313B\262\314B\262\315B\262\316B\262\203a\317B\262\320B\262\203o\321B\262\322B\262\203x\323B\262\324\325\326\327\330\331\332\333\334\335\336 DED\337BB\340\341E\342\343\205\230\344\345\346\347BBDC\205\254\350D\351B\352\353\335\343\205\272\354DC\205\304\355DC\205\316\356DC\205\330\357DC\360\361\362\363\364\365\335\336DFFDC%BB\366\367BBEC$BFEDE\207" [plist-member :no-match-explanation :window :split-function :save-window :ensure-window-split :dir-action :file-action :tag-section-action :tag-action nil root-node-open root-node-closed dir-node-open dir-node-closed file-node-open file-node-closed tag-node-open tag-node-closed tag-node -when-let (btn (treemacs-current-button)) treemacs-without-following let* ((state (treemacs-button-get btn :state)) (current-window (selected-window))) if and not memq state quote ((not (get state :treemacs-visit-action))) treemacs-pulse-on-failure "%s" progn append ((when (one-window-p) (save-selected-window (split-window nil nil (if (eq 'left treemacs-position) 'right 'left))))) select-window or ((next-window (selected-window) nil nil)) funcall ((other-window 1)) prog1 pcase (or `dir-node-open `dir-node-closed `root-node-open `root-node-closed) (or `file-node-open `file-node-closed) (or `tag-node-open `tag-node-closed) `tag-node _ -if-let (visit-action (get state :treemacs-visit-action)) (funcall visit-action btn) error "No match achieved even though button's state %s was part of the set of valid states %s" when ((select-window current-window))] 41 (#$ . 5189)])) (put 'treemacs--execute-button-action 'edebug-form-spec '(&rest [sexp form])) #@186 Run BODY without triggering the filewatch callback. Required for manual interactions with the file system (like deletion), otherwise the on-delete code will run twice. (fn &rest BODY) (defalias 'treemacs--without-filewatch '(macro . #[128 "\300\301BB\207" [cl-flet (((symbol-function 'treemacs--filewatch-callback) (symbol-function 'ignore)))] 4 (#$ . 7991)])) (put 'treemacs--without-filewatch 'edebug-form-spec t) #@428 Execute MAIN-FORM without switching position. Finally execute FINAL-FORM after the code to restore the position has run. This macro is meant for cases where a simple `save-excursion' will not do, like a refresh, which can potentially change the entire buffer layout. In practice this means attempt first to keep point on the same file/tag, and if that does not work keep it on the same line. (fn MAIN-FORM &rest FINAL-FORM) (defalias 'treemacs-save-position '(macro . #[385 "\300\301\302\303\304\305\306\307 BBBBBBBE\207" [treemacs-without-following (declare-function treemacs--current-screen-line "treemacs-rendering") let* ((curr-btn (treemacs-current-button)) (curr-point (point-marker)) (next-path (-some-> curr-btn (treemacs--next-non-child-button) (button-get :path))) (prev-path (-some-> curr-btn (treemacs--prev-non-child-button) (button-get :path))) (curr-node-path (-some-> curr-btn (treemacs-button-get :path))) (curr-state (-some-> curr-btn (treemacs-button-get :state))) (collapse (-some-> curr-btn (treemacs-button-get :collapsed))) (curr-file (if collapse (treemacs-button-get curr-btn :key) (-some-> curr-btn (treemacs--nearest-path)))) (curr-window (treemacs-get-local-window)) (curr-win-line (when curr-window (with-selected-window curr-window (treemacs--current-screen-line))))) (pcase curr-state ((or 'root-node-open 'root-node-closed) (treemacs-goto-file-node curr-file)) ((or 'dir-node-open 'dir-node-closed 'file-node-open 'file-node-closed) (if (and (treemacs-is-path-visible\? curr-file) (or treemacs-show-hidden-files (not (s-matches\? treemacs-dotfiles-regex (treemacs--filename curr-file))))) (treemacs-goto-file-node curr-file) (cl-labels ((can-move-to (it) (and (treemacs-is-path-visible\? it) (or treemacs-show-hidden-files (not (s-matches\? treemacs-dotfiles-regex (treemacs--filename it))))))) (cond ((and next-path (can-move-to next-path)) (treemacs-goto-file-node next-path)) ((and prev-path (can-move-to prev-path)) (treemacs-goto-file-node prev-path)) (t (-let [detour (treemacs--parent curr-file)] (while (not (can-move-to detour)) (setf detour (treemacs--parent detour))) (treemacs-goto-file-node detour))))))) ((or 'tag-node-open 'tag-node-closed 'tag-node) (treemacs-goto-node curr-node-path)) ((pred null) (goto-char curr-point)) (_ (condition-case _ (treemacs-goto-node curr-node-path) (error (ignore))))) (treemacs--evade-image) (when (get-text-property (point) 'invisible) (goto-char (next-single-property-change (point) 'invisible))) (when curr-win-line (-let [buffer-point (point)] (with-selected-window curr-window (-let [scroll-margin 0] (recenter (1- curr-win-line))) (set-window-point (selected-window) buffer-point))))] 12 (#$ . 8416)])) (put 'treemacs-save-position 'edebug-form-spec '(form body)) #@261 Use WORKSPACE as the current workspace when running BODY. Specifically this means that calls to `treemacs-current-workspace' will return WORKSPACE and if no workspace has been set for the current scope yet it will not be set either. (fn WORKSPACE &rest BODY) (defalias 'treemacs-with-workspace '(macro . #[385 "\300\301DC\302BBB\207" [let treemacs-override-workspace (ignore treemacs-override-workspace)] 6 (#$ . 11179)])) (byte-code "\300\301\302\303#\304\301\305\306#\207" [function-put treemacs-with-workspace lisp-indent-function 1 put edebug-form-spec (form body)] 5) #@252 Run BODY once locally in every treemacs buffer. Only includes treemacs file tree buffers, not extensions. Sets `treemacs-override-workspace' so calls to `treemacs-current-workspace' return the workspace of the active treemacs buffer. (fn &rest BODY) (defalias 'treemacs-run-in-every-buffer '(macro . #[128 "\300\301\302\303\304\305\306\307\310\311\nBBEEEE\207" [pcase-dolist (`(,_ \, shelf) (treemacs--scope-store)) let ((buffer (treemacs-scope-shelf->buffer shelf)) (workspace (treemacs-scope-shelf->workspace shelf))) when (buffer-live-p buffer) treemacs-with-workspace workspace with-current-buffer buffer] 12 (#$ . 11762)])) (put 'treemacs-run-in-every-buffer 'edebug-form-spec t) #@134 Run BODY once locally in every treemacs buffer. Includes *all* treemacs-mode-derived buffers, including extensions. (fn &rest BODY) (defalias 'treemacs-run-in-all-derived-buffers '(macro . #[128 "\300\301\302\303\304\305BBEE\207" [dolist (buffer (buffer-list)) when (buffer-local-value 'treemacs--in-this-buffer buffer) with-current-buffer buffer] 8 (#$ . 12456)])) (put 'treemacs-run-in-all-derived-buffers 'edebug-form-spec t) #@135 Run BODY only when treemacs has not yet been loaded. Specifically only run it when (featurep 'treemacs) returns nil. (fn &rest BODY) (defalias 'treemacs-only-during-init '(macro . #[128 "\300\301BB\207" [unless (featurep 'treemacs)] 4 (#$ . 12895)])) (put 'treemacs-only-during-init 'edebug-form-spec t) #@155 Iterate over entries of TABLE with NAMES in BODY. Entry variables will bound based on NAMES which is a list of two elements. (fn TABLE NAMES &rest BODY) (defalias 'treemacs--maphash '(macro . #[642 "@A@\300\301DBBE\207" [maphash lambda] 9 (#$ . 13208)])) (byte-code "\300\301\302\303#\210\304\301\305\306#\300\207" [put treemacs--maphash edebug-form-spec (sexp sexp body) function-put lisp-indent-function 2] 4) #@141 Early return failure from `treemacs-block'. Will pass ERROR-MSG and MSG-ARGS to `treemacs-pulse-on-failure'. (fn ERROR-MSG &rest MSG-ARGS) (defalias 'treemacs-error-return '(macro . #[385 "\300\301\302BBE\207" [cl-return-from __body__ treemacs-pulse-on-failure] 7 (#$ . 13635)])) (byte-code "\300\301\302\303#\304\301\305\306#\207" [function-put treemacs-error-return lisp-indent-function 1 put edebug-form-spec (form body)] 5) #@180 Early return from `treemacs-block'. When PREDICATE returns non-nil value will pass ERROR-MSG and MSG-ARGS to `treemacs-pulse-on-failure'. (fn PREDICATE ERROR-MSG &rest MSG-ARGS) (defalias 'treemacs-error-return-if '(macro . #[642 "\300\301\302\303BBEE\207" [when cl-return-from __body__ treemacs-pulse-on-failure] 10 (#$ . 14073)])) (byte-code "\300\301\302\303#\304\301\305\306#\207" [function-put treemacs-error-return-if lisp-indent-function 1 put edebug-form-spec (form sexp body)] 5) #@62 Early return from `treemacs-block', returning RET. (fn RET) (defalias 'treemacs-return '(macro . #[257 "\300\301E\207" [cl-return-from __body__] 4 (#$ . 14574)])) (put 'treemacs-return 'edebug-form-spec t) #@110 Early return from `treemacs-block'. When PREDICATE returns non-nil RET will be returned. (fn PREDICATE RET) (defalias 'treemacs-return-if '(macro . #[514 "\300\301\302EE\207" [when cl-return-from __body__] 7 (#$ . 14789)])) (byte-code "\300\301\302\303#\304\301\305\306#\207" [function-put treemacs-return-if lisp-indent-function 1 put edebug-form-spec (form sexp)] 5) #@176 Among the *direct* children of BTN find the first child matching PREDICATE. For the PREDICATE call the button being checked is bound as 'child-btn'. (fn BTN &rest PREDICATE) (defalias 'treemacs-first-child-node-where '(macro . #[385 "\300\301\302\303\304\305D\306BBD\307B\310\311\303\312\313\nEE\314\315B\316\317\303\320\310\303\321\322\323\324\310\315B\325BBD\326BBEEFFEEE\207" [cl-block __search__ let* child-btn next-button treemacs-button-end (t) ((depth (when child-btn (treemacs-button-get child-btn :depth)))) when and equal (treemacs-button-get child-btn :parent) if progn (cl-return-from __search__ child-btn) while (setq child-btn (next-button (treemacs-button-end child-btn))) -let [child-depth (treemacs-button-get child-btn :depth)] cond (= depth child-depth) ((cl-return-from __search__ child-btn)) (((> depth child-depth) (cl-return-from __search__ nil)))] 23 (#$ . 15168)])) (byte-code "\300\301\302\303#\304\301\305\306#\207" [function-put treemacs-first-child-node-where lisp-indent-function 1 put edebug-form-spec (sexp body)] 5) #@213 Put FORMS in a `cl-block' named '__body__'. This pattern is oftentimes used in treemacs, see also `treemacs-return-if', `treemacs-return', `treemacs-error-return' and `treemacs-error-return-if' (fn &rest FORMS) (defalias 'treemacs-block '(macro . #[128 "\300\301BB\207" [cl-block __body__] 4 (#$ . 16232)])) (put 'treemacs-block 'edebug-form-spec t) #@914 Readable utility macro for various path predicates. LEFT is a file path, OP is the operator and RIGHT is either a path, project, or workspace. OP can be one of the following: * `:same-as' will check for string equality * `:in' will check will check whether LEFT is a child or the same as RIGHT. * `:parent-of' will check whether LEFT is a parent of, and not equal to, RIGHT * `:in-project' will check whether LEFT is part of the project RIGHT * `:in-workspace' will check whether LEFT is part of the workspace RIGHT and return the appropriate project when it is. If RIGHT is not given it will default to calling `treemacs-current-workspace'. LEFT and RIGHT are expected to be in treemacs canonical file path format (see also `treemacs-canonical-path'). Even if LEFT or RIGHT should be a form and not a variable it is guaranteed that they will be evaluated only once. (fn LEFT OP &optional RIGHT) (defalias 'treemacs-is-path '(macro . #[770 "\300>\204\301\302\303\304C#!\210\305=\204!\211\204!\301\302\303\306\307#!\210\310!\203,\211\202/\311\312!\310!\203:\211\202=\311\313!\314\267\202\212\315E\202\213\316\315E\317\320DEE\202\213\321\317\320DE\322\315EDE\202\213\323\324\325DF\202\213\211\206{\326\327\323\330BB\331DE\262\202\213\307=\203\227\211\266\203\202\240\332DC\"\266\203=\203\247\207\332DC\"\207" [(:same-as :in :parent-of :in-project :in-workspace) error apply format "[Treemacs] Invalid treemacs-is-path operator: `%s'" :in-workspace "[Treemacs] :in-workspace operator requires right-side argument." nil macroexp-const-p make-symbol "left" "right" #s(hash-table size 5 test eq rehash-size 1.5 rehash-threshold 0.8125 purecopy t data (:same-as 67 :in 74 :parent-of 90 :in-project 108 :in-workspace 118)) string= or s-starts-with\? treemacs--add-trailing-slash and not treemacs-is-path :in treemacs-project->path (treemacs-current-workspace) --first (:in-project it) treemacs-workspace->projects macroexp-let*] 13 (#$ . 16591)])) (put 'treemacs-is-path 'edebug-form-spec '(&rest form)) #@447 Execute an action depending on the type of PATH. FILE-ACTION is the action to perform when PATH is a regular file node. TOP-LEVEL-EXTENSION-ACTION, DIRECTORY-EXTENSION-ACTION, and PROJECT-EXTENSION-ACTION operate on paths for the different extension types. If none of the path types matches, NO-MATCH-ACTION is executed. (fn PATH &key FILE-ACTION TOP-LEVEL-EXTENSION-ACTION DIRECTORY-EXTENSION-ACTION PROJECT-EXTENSION-ACTION NO-MATCH-ACTION) (defalias 'treemacs-with-path '(macro . #[385 "\300\301\"A@\300\302\"A@\300\303\"A@\300\304\"A@\300\305\"A@\306\307!\310 DC\311\312 \2055\313D\nDC \205E\314\315\316DE\nDC \205T\313\316DD\nDC \205c\317\316 DD\nDC\320\n\203n\n\202s\321\322 EDC%BE\207" [plist-member :file-action :top-level-extension-action :directory-extension-action :project-extension-action :no-match-action make-symbol "path" let cond append stringp eq :custom car treemacs-project-p t error "Path type did not match: %S"] 20 (#$ . 18664)])) (byte-code "\300\301\302\303#\300\207" [function-put treemacs-with-path lisp-indent-function 1] 4) #@181 Building block helper macro. If treemacs is currently visible it will be hidden, if it is not visible, or no treemacs buffer exists at all, BODY will be executed. (fn &rest BODY) (defalias 'treemacs-with-toggle '(macro . #[128 "\300\301\302BBB\207" [--if-let (treemacs-get-local-window) (delete-window it)] 5 (#$ . 19757)])) #@332 Given list of specifically IGNORED-ERRORS evaluate BODY. IGNORED-ERRORS is a list of errors to ignore. Each element is a list whose car is the error's type, and second item is a regex to match against error messages. If any of the IGNORED-ERRORS matches, the error is suppressed and nil returned. (fn IGNORED-ERRORS &rest BODY) (defalias 'treemacs-with-ignored-errors '(macro . #[385 "\300\301!\302\303!\304\305\306\"\"BBB\207" [make-symbol "err" condition-case-unless-debug macroexp-progn mapcar make-closure #[257 "\211@\301\302A@\303\300DE\304\305\300D\306\300DEED\207" [V0 unless string-match-p error-message-string signal car cdr] 8 "\n\n(fn IGNORE-SPEC)"]] 10 (#$ . 20091)])) #@132 Debounce a function call. Based on a timer GUARD variable run function with the given DELAY and BODY. (fn GUARD DELAY &rest BODY) (defalias 'treemacs-debounce '(macro . #[642 "\300\301\302\303\304\303\305\n\301\306BBC\"BBFEE\207" [unless setf run-with-idle-timer nil lambda append (nil)] 17 (#$ . 20790)])) (byte-code "\300\301\302\303#\300\207" [function-put treemacs-debounce lisp-indent-function 2] 4) #@253 Run BODY without the usual recentering for expanded nodes. Specifically `treemacs--no-recenter' will be set to 't' so that `treemacs--maybe-recenter' will have no effect during non-interactive updates triggered by e.g. filewatch-mode. (fn &rest BODY) (defalias 'treemacs-without-recenter '(macro . #[128 "\300\301BB\207" [let ((treemacs--no-recenter t))] 4 (#$ . 21210)])) (byte-code "\300\301\302\303#\210\304\305!\207" [put treemacs-without-recenter edebug-form-spec t provide treemacs-macros] 4)