Function: treemacs--flattened-dirs-process

treemacs--flattened-dirs-process is a byte-compiled function defined in treemacs-async.el.

Signature

(treemacs--flattened-dirs-process PATH PROJECT)

Documentation

Start a new process to determine directories to collapse under PATH.

Only starts the process if PROJECT is locally accessible (i.e. exists, and is not remote.) Output format is an elisp list of string lists that's read directly. Every string list consists of the following elements:
 1) the extra text that must be appended in the view
 2) The original full and non-collapsed path
 3) a series of intermediate steps which are the result of appending the
    collapsed path elements onto the original, ending in
 4) the full path to the
    directory that the collapsing leads to. For Example:
    ("/26.0/elpa"
     "/home/a/Documents/git/treemacs/.cask"
     "/home/a/Documents/git/treemacs/.cask/26.0"
     "/home/a/Documents/git/treemacs/.cask/26.0/elpa")

Source Code

;; Defined in ~/.emacs.d/elpa/treemacs-20251226.1307/treemacs-async.el
(defun treemacs--flattened-dirs-process (path project)
  "Start a new process to determine directories to collapse under PATH.
Only starts the process if PROJECT is locally accessible (i.e. exists, and
is not remote.)
Output format is an elisp list of string lists that's read directly.
Every string list consists of the following elements:
 1) the extra text that must be appended in the view
 2) The original full and non-collapsed path
 3) a series of intermediate steps which are the result of appending the
    collapsed path elements onto the original, ending in
 4) the full path to the
    directory that the collapsing leads to.  For Example:
    (\"/26.0/elpa\"
     \"/home/a/Documents/git/treemacs/.cask\"
     \"/home/a/Documents/git/treemacs/.cask/26.0\"
     \"/home/a/Documents/git/treemacs/.cask/26.0/elpa\")"
  (when (and (> treemacs-collapse-dirs 0)
             treemacs-python-executable
             (treemacs-project->is-local-and-readable? project))
    (let (;; needs to be set or we'll run into trouble when deleting
          ;; haven't taken the time to figure out why, so let's just leave it at that
          (default-directory path)
          (search-paths nil))
      (treemacs-walk-reentry-dom (treemacs-find-in-dom path)
        (lambda (node)
          (-let [key (treemacs-dom-node->key node)]
            (when (stringp key) (push key search-paths)))))
      (-let [command
             `(,treemacs-python-executable
               "-O"
               ,treemacs--dirs-to-collapse.py
               ,(number-to-string treemacs-collapse-dirs)
               ,(if treemacs-show-hidden-files "t" "x")
               ,@search-paths)]
        (apply #'pfuture-new command)))))