Commit 62fa53441dbf

Vincent Demeester <vincent@sbr.pm>
2022-01-04 18:28:46
tools/emacs: detect project name from project.el
We were doing this for projectile but not for project.el. As I am switching to this (and removing projectile), I needed the same kind of support. The only trick is that project.el "project name" is a path, and I didn't want to have it the complete path, so I am "skipping" some prefix and using relative path for the rest. Signed-off-by: Vincent Demeester <vincent@sbr.pm>
1 parent b81ce86
Changed files (1)
tools
tools/emacs/config/config-appearance.el
@@ -121,6 +121,13 @@ Ignores `ARGS'."
      ((boundp 'projectile-project-name) (if (string-equal (projectile-project-name) "-")
                                             (tab-bar-tab-name-current-with-count)
                                           (projectile-project-name)))
+     ((project-current) (let ((project-path (cdr (project-current))))
+                          (cond ((string-prefix-p "~/src" project-path)
+                                 (directory-file-name (file-relative-name project-path "~/src")))
+                                ((string-prefix-p "~/desktop" project-path)
+                                 (directory-file-name (file-relative-name project-path "~/desktop")))
+                                (t
+                                 (file-relative-name project-path)))))
      (t (tab-bar-tab-name-current-with-count))))
 
   (defun vde/complete-tab-bar-tab-dwim ()