Skip to content

Wrong project root detection #224

@jumper047

Description

@jumper047

Describe
When i open file in subfolder within the project, doom-modeline considering this subfolder as project root, instead of actual root.

Steps and Expected
Project with subdirectory with some source files inside this subdir.
Project's root contains .projectile file. Also this project is svn repository.
Doom modeline path truncation set to truncate-with-project
Open file "project/subfolder/some_file.py"
Expected in modeline: "project/s/some_file.py"
Actually: "subfolder/some_file.py"
Environment:

  • OS: Windows
  • Version 7
  • Package version 20190918.1510

Additional context:
I temporarily fix it on my install by changing order of root detection functions:

      (defun doom-modeline-project-root ()
	"Get the path to the root of your project.
    Return `default-directory' if no project was found."
	(or doom-modeline-project-root
	    (setq doom-modeline-project-root
		  (or 		    (and (bound-and-true-p projectile-mode)
			   (ignore-errors (projectile-project-root)))

				      (and (fboundp 'project-current)
			   (ignore-errors
			     (when-let ((project (project-current)))
			       (expand-file-name (car (project-roots project))))))
		      (and (fboundp 'ffip-get-project-root-directory)
			   (let ((inhibit-message t))
			     (ignore-errors (ffip-get-project-root-directory))))
		      default-directory))))    

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions