Subject: Project mode-line

From: Juri Linkov <[email-masked]>
Date: Tue, 03 Oct 2023 09:29:23 +0300

Here is the implementation of the mode-line project indicator prepended
before the vc indicator with the project menu discussed in bug#63469:

diff --git a/lisp/progmodes/project.el b/lisp/progmodes/project.el
index 2e6ae89a443..8798feb2c56 100644
--- a/lisp/progmodes/project.el
+++ b/lisp/progmodes/project.el
@@ -2010,5 +2102,20 @@ project-uniquify-dirname-transform
           (file-relative-name dirname root))))
     dirname))
 
+;;; Project mode-line
+
+(let ((form '(:eval (when-let (project (project-current))
+                      (concat " "
+                              (propertize
+                               (project-name project)
+                               'mouse-face 'mode-line-highlight
+                               'local-map
+                               (make-mode-line-mouse-map
+                                'down-mouse-1
+			        `(menu-item "Project"
+                                            ,menu-bar-project-menu))))))))
+  (when-let (pos (seq-position mode-line-format '(vc-mode vc-mode)))
+    (cl-pushnew form (nthcdr pos mode-line-format))))
+
 (provide 'project)
 ;;; project.el ends here