commit 62fa53441dbf6a32dcf6b89dfc55987fd10ed338
parent b81ce86c76f77889eebfe36d3c7b83eb86089f8b
Author: Vincent Demeester <vincent@sbr.pm>
Date: Tue, 4 Jan 2022 18:28:46 +0100
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>
Diffstat:
1 file changed, 7 insertions(+), 0 deletions(-)
diff --git a/tools/emacs/config/config-appearance.el b/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 ()