Skip to content

projectile-mode-line-function doesn't play nicely with magit #1823

@mx

Description

@mx

I have a custom projectile-mode-line-function that puts PR[name] in the modeline when there's an active project, and nothing at all in the modeline when there isn't. Normally this works fine. However, when in the magit status buffer for the project, it leaves "Projectile" in the modeline. This is pretty interesting, because (projectile-project-name) still returns the correct name of the project (in my case, "surge").

Here is the function I'm using, and how it gets configured:

  (setq projectile-mode-line-function
	(lambda ()
	  (let ((name (projectile-project-name)))
	    (when (not (string= name "-"))
	      (format " PR[%s]" name)))))

Expected behavior

In the modeline in the magit status buffer for this project, you should see "PR[surge]"

Actual behavior

What you see in the modeline in the magit status buffer is "Projectile".

Steps to reproduce the problem

Set the above function to your projectile-mode-line-function. Don't have any other custom settings for projectile. Run magit status in an active/open project.

Environment & Version information

Projectile version information

Projectile version: 20230224.2116

Emacs version

28.2

Operating system

Arch Linux.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions