From 43538eb5825680e057d01f3baa0245114919e5cc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Del=20Pino?= <stephane.delpino44@gmail.com>
Date: Thu, 28 Mar 2024 11:04:59 +0100
Subject: [PATCH] Ajout etat git dans la modeline

---
 Configuration.org | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/Configuration.org b/Configuration.org
index 858b47f..f3f1d31 100644
--- a/Configuration.org
+++ b/Configuration.org
@@ -1018,6 +1018,24 @@ checkout -p~)
      :color blue))
 #+END_SRC
 
+Affiche les statistiques ~git~ dans la Modeline
+#+BEGIN_SRC emacs-lisp
+(defadvice vc-git-mode-line-string (after plus-minus (file) compile activate)
+  "Show the information of git diff on modeline."
+  (setq ad-return-value
+	(concat (propertize ad-return-value 'face '(:foreground "white" :weight bold))
+		" ["
+		(let ((plus-minus (vc-git--run-command-string
+				   file "diff" "--numstat" "--")))
+		  (if (and plus-minus
+		       (string-match "^\\([0-9]+\\)\t\\([0-9]+\\)\t" plus-minus))
+		       (concat
+			(propertize (format "+%s" (match-string 1 plus-minus)) 'face '(:foreground "green3"))
+			(propertize (format "-%s" (match-string 2 plus-minus)) 'face '(:inherit font-lock-warning-face)))
+		    (propertize "✔" 'face '(:foreground "green3" :weight bold))))
+		"]")))
+#+END_SRC
+
 ** FlySpell
 Correcteur orthographique à la volée.
 #+BEGIN_SRC emacs-lisp
-- 
GitLab