eshell-starship.el - Don't show Emacs for .dir-locals(2).el

This commit is contained in:
2025-09-27 00:54:19 -07:00
parent 450e951914
commit de7e77c1ea

View File

@ -153,6 +153,12 @@ LAST-TIMES is a list of the 10 last execution times for this module.")
:type list
:documentation
"A list of extensions that indicate that the module should be run.")
(extensions-excluded-files :initarg :extensions-excluded-files
:initform nil
:accessor eshell-starship-module-extensions-excluded-files
:type list
:documentation
"A list of files that are ignored when searching for extensions.")
(prefix :initarg :prefix
:initform ""
:accessor eshell-starship-module-prefix
@ -620,6 +626,7 @@ For example, a revert. If there is no current operation, return nil."
(eshell-starship-defmodule elisp
:extensions '("el" "elc" "eln")
:extensions-excluded-files '(".dir-locals.el" ".dir-locals2.el")
:prefix "via "
:icon ""
:color "dark orchid"
@ -837,6 +844,18 @@ That is, if EXT is \"pkg.tar.gz\", this will return
(and method
(not (member method eshell-starship-overridden-remote-methods)))))
(defun eshell-starship--extension-modules-for-file (file)
"Return a list of modules that should be run due the exteions of FILE."
(mapcar (lambda (ext)
(cl-delete-if
(lambda (mod)
(cl-find file (eshell-starship-module-extensions-excluded-files mod)
:test #'equal))
(copy-sequence (eshell-starship--module-by
:extensions ext))))
(eshell-starship--permute-extension
(eshell-starship--file-name-extension file))))
(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)))
@ -853,11 +872,7 @@ 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)
(mapcar (lambda (ext)
(copy-sequence (eshell-starship--module-by
:extensions ext)))
(eshell-starship--permute-extension
(eshell-starship--file-name-extension 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