From de7e77c1ea00f35ea8c85d718b82582fa14647a5 Mon Sep 17 00:00:00 2001 From: Alexander Rosenberg Date: Sat, 27 Sep 2025 00:54:19 -0700 Subject: [PATCH] eshell-starship.el - Don't show Emacs for .dir-locals(2).el --- elisp/eshell-starship.el | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/elisp/eshell-starship.el b/elisp/eshell-starship.el index 729e6c3..34fd11d 100644 --- a/elisp/eshell-starship.el +++ b/elisp/eshell-starship.el @@ -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