Prevent ehsell-starship extensions from applying to hidden files

This commit is contained in:
2025-11-02 20:19:02 -08:00
parent 8191a92a8c
commit 00b905fad1

View File

@ -856,6 +856,12 @@ That is, if EXT is \"pkg.tar.gz\", this will return
(eshell-starship--permute-extension
(eshell-starship--file-name-extension file))))
(defun eshell-starship--hidden-file-p (name)
"Return non-nil if the file with NAME is hidden.
Name must be the name of a file, not a path. Thus, is cannot have any '/'
characters in it."
(and (cl-plusp (length name)) (= (aref name 0) ?.)))
(defun eshell-starship--modules-for-dir (dir)
"Return a list of modules that are applicable to DIR."
(let ((is-remote (eshell-starship--remote-for-modules-p dir)))
@ -872,7 +878,8 @@ That is, if EXT is \"pkg.tar.gz\", this will return
(copy-sequence (eshell-starship--module-by :dirs name))
(apply 'append
(eshell-starship--module-by :files name)
(eshell-starship--extension-modules-for-file name)))))
(unless (eshell-starship--hidden-file-p name)
(eshell-starship--extension-modules-for-file name))))))
(directory-files-and-attributes dir nil nil t)))
(let ((default-directory dir))
(cl-loop for (name is-dir module) in eshell-starship--extra-module-files