From 833a6e1d757c579a92079bd76914d25aae32b937 Mon Sep 17 00:00:00 2001 From: Lucien Cartier-Tilet Date: Thu, 22 Oct 2020 00:52:01 +0200 Subject: [PATCH] [Emacs] Eshell prompt no longer relies on Magit --- org/config/emacs.org | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/org/config/emacs.org b/org/config/emacs.org index a6251c8..824d633 100644 --- a/org/config/emacs.org +++ b/org/config/emacs.org @@ -1521,6 +1521,22 @@ :buffer "*org files*"))) #+END_SRC +*** ~phundrak/is-dir-a-git-repo~ + :PROPERTIES: + :CUSTOM_ID: User_Configuration-Custom_functions,_macros,_and_variables-phundrakis-dir-a-git-repo-4dc207d7 + :END: + This function detects if the path passed as an argument points to a git + directory or to one of its subdirectories. + #+BEGIN_SRC emacs-lisp + (defun phundrak/is-dir-a-git-repo ($path) + "Return `t' if `$path' points to a git repository or one of its + subdirectories" + (cond + ((null $path) nil) + ((f-dir? (concat $path "/.git")) t) + (t (phundrak/is-dir-a-git-repo (f-parent $path))))) + #+END_SRC + *** ~phundrak/yas-rust-new-assignments~ :PROPERTIES: :CUSTOM_ID: User_Configuration-Custom_functions-phundrakyas-rust-new-assignments-10f73456 @@ -1904,7 +1920,7 @@ :background $background) ;; add git status if it exists (with-face " " :background $background) - (if (magit-toplevel $path) + (if (phundrak/is-dir-a-git-repo $path) (phundrak/eshell-git-status $path $background)) (with-face " " :background $background) (with-face "λ"