Function: treemacs--follow-each-dir--inliner

treemacs--follow-each-dir--inliner is a function defined in treemacs-core-utils.el.

Signature

(treemacs--follow-each-dir--inliner INLINE--FORM BTN DIR-PARTS PROJECT)

Source Code

;; Defined in ~/.emacs.d/elpa/treemacs-20251226.1307/treemacs-core-utils.el
;; Closure converted to defun by helpful.
(defun treemacs--follow-each-dir--inliner
    (inline--form btn dir-parts project)
  (ignore inline--form)
  (catch 'inline--just-use
    (let*
	((exp btn)
	 (btn
	  (if
	      (macroexp-copyable-p exp)
	      exp
	    (make-symbol "btn")))
	 (body
	  (let*
	      ((exp dir-parts)
	       (dir-parts
		(if
		    (macroexp-copyable-p exp)
		    exp
		  (make-symbol "dir-parts")))
	       (body
		(let*
		    ((exp project)
		     (project
		      (if
			  (macroexp-copyable-p exp)
			  exp
			(make-symbol "project")))
		     (body
		      (list 'let*
			    (list
			     (list 'root
				   (list 'treemacs-button-get btn :path))
			     (list 'git-future
				   (list 'treemacs--git-status-process 'root project))
			     (list 'last-index
				   (list '-
					 (list 'length dir-parts)
					 1))
			     (list 'depth
				   (list 'treemacs-button-get btn :depth)))
			    (list 'goto-char btn)
			    (list 'pcase
				  (list 'treemacs-button-get btn :state)
				  (list
				   (list 'quote 'dir-node-closed)
				   (list 'treemacs--expand-dir-node btn :git-future 'git-future))
				  (list
				   (list 'quote 'root-node-closed)
				   (list 'treemacs--expand-root-node btn)))
			    (list 'catch
				  (list 'quote 'follow-failed)
				  (list 'let
					(list
					 (list 'index 0)
					 (list 'dir-part nil))
					(list 'while dir-parts
					      (list 'setq 'dir-part
						    (list 'pop dir-parts)
						    'root
						    (list 'treemacs-join-path 'root 'dir-part)
						    btn
						    (list 'let
							  (list 'current-btn)
							  (list 'cl-block 'search
								(list 'while
								      (list 'progn
									    (list 'goto-char
										  (list 'line-end-position))
									    (list 'search-forward 'dir-part nil :no-error))
								      (list 'setq 'current-btn
									    (list 'treemacs-current-button))
								      (list 'cond
									    (list
									     (list 'null 'current-btn)
									     (list 'cl-return-from 'search))
									    (list
									     (list 'treemacs-button-get 'current-btn :custom))
									    (list
									     (list 'treemacs-is-path 'root :same-as
										   (list 'treemacs-button-get 'current-btn :path))
									     (list 'cl-return-from 'search 'current-btn))
									    (list
									     (list 'and
										   (list 'treemacs-button-get 'current-btn :collapsed)
										   (list 'treemacs-is-path
											 (list 'treemacs-button-get 'current-btn :path)
											 :parent-of 'root))
									     (list 'dotimes
										   (list '_
											 (list 'car
											       (list 'treemacs-button-get 'current-btn :collapsed)))
										   (list 'setq 'root
											 (list 'concat 'root "/"
											       (list 'pop dir-parts)))
										   (list 'cl-incf 'index))
									     (list 'cl-return-from 'search 'current-btn))
									    (list
									     (list '>= 'depth
										   (list 'treemacs-button-get 'current-btn :depth))
									     (list 'cl-return-from 'search)))))))
					      (list 'unless btn
						    (list 'throw
							  (list 'quote 'follow-failed)
							  (list 'quote 'follow-failed)))
					      (list 'goto-char btn)
					      (list 'when
						    (list 'and
							  (list 'eq
								(list 'quote 'dir-node-closed)
								(list 'treemacs-button-get btn :state))
							  (list '< 'index 'last-index))
						    (list 'treemacs--expand-dir-node btn :git-future 'git-future))
					      (list 'setq 'index
						    (list '1+ 'index))))
				  btn))))
		  (if
		      (eq project exp)
		      body
		    (macroexp-let*
		     (list
		      (list project exp))
		     body)))))
	    (if
		(eq dir-parts exp)
		body
	      (macroexp-let*
	       (list
		(list dir-parts exp))
	       body)))))
      (if
	  (eq btn exp)
	  body
	(macroexp-let*
	 (list
	  (list btn exp))
	 body)))))