I'm using Projectile, and after seeing the really awesome .emacs file I decided to copy the lines that set the mode-line to display the project name, like so:
:config
(projectile-global-mode 1)
(setq-default ;; <snip>
projectile-mode-line '(:eval (projectile-project-name))))
I've got this included in my init.el and it almost works - the only problem is that the variable projectile-project-name
is nil
, so it doesn't actually show the name of the project (and this is even after I've done C-C p p
and chosen a project.
How is projectile-project-name
set and/or where is that information stored? (Maybe in the .projectile
file?)
projectile-project-name
function which does not purely depend on the variable of the same name (but does use that value by preference, when it's non-nil). – phils Aug 30 '18 at 7:18projectile-mode-line
to a value which includes the project name. Or at least the current version does. If you weren't already seeing that, your problem is probably that you have a custom mode line which isn't displayingprojectile-mode-line
at all. – phils Aug 30 '18 at 7:20(:eval (format " Projectile[%s]" (projectile-project-name)))
is the value I'm seeing forprojectile-mode-line
– phils Aug 30 '18 at 7:21smart-mode-line
, which seems to embed theprojectile-mode-line
into the mode line at the bottom of the screen. – MikeTheTall Aug 30 '18 at 15:57projectile-project-name
being a function - I hadn't caught that. When I call it interactively (usingM-:
) it returns'-'
..... because that particular file wasn't part of a project. It returns something reasonable when the file (buffer) that's open is part of the project – MikeTheTall Aug 30 '18 at 16:04