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-namefunction which does not purely depend on the variable of the same name (but does use that value by preference, when it's non-nil).projectile-mode-lineto 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-lineat all.(:eval (format " Projectile[%s]" (projectile-project-name)))is the value I'm seeing forprojectile-mode-linesmart-mode-line, which seems to embed theprojectile-mode-lineinto the mode line at the bottom of the screen.projectile-project-namebeing 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