Function: treemacs--start-watching--inliner

treemacs--start-watching--inliner is a function defined in treemacs-filewatch-mode.el.

Signature

(treemacs--start-watching--inliner INLINE--FORM PATH &optional COLLAPSE)

Source Code

;; Defined in ~/.emacs.d/elpa/treemacs-20251226.1307/treemacs-filewatch-mode.el
;; Closure converted to defun by helpful.
(defun treemacs--start-watching--inliner
    (inline--form path &optional collapse)
  (ignore inline--form)
  (catch 'inline--just-use
    (let*
	((exp path)
	 (path
	  (if
	      (macroexp-copyable-p exp)
	      exp
	    (make-symbol "path")))
	 (body
	  (let*
	      ((exp collapse)
	       (collapse
		(if
		    (macroexp-copyable-p exp)
		    exp
		  (make-symbol "collapse")))
	       (body
		(list 'progn
		      (list 'when collapse
			    (list 'ht-set! 'treemacs--collapsed-filewatch-index path t))
		      (list '-if-let
			    (list 'watch-info
				  (list 'ht-get 'treemacs--filewatch-index path))
			    (list 'unless
				  (list 'memq
					(list 'current-buffer)
					(list 'car 'watch-info))
				  (list 'setcar 'watch-info
					(list 'cons
					      (list 'current-buffer)
					      (list 'car 'watch-info))))
			    (list 'treemacs-with-ignored-errors
				  (list
				   (list 'file-notify-error "No file notification program found"))
				  (list 'ht-set! 'treemacs--filewatch-index path
					(list 'cons
					      (list 'list
						    (list 'current-buffer))
					      (list 'file-notify-add-watch path
						    (list 'quote
							  (list 'change))
						    (list 'function 'treemacs--filewatch-callback)))))))))
	    (if
		(eq collapse exp)
		body
	      (macroexp-let*
	       (list
		(list collapse exp))
	       body)))))
      (if
	  (eq path exp)
	  body
	(macroexp-let*
	 (list
	  (list path exp))
	 body)))))