8

Since I updated the whole of my emacs third party packages projectile has started to see my home folder (which emacs opens in) as a projectile project.

Screenshot of helm-projectile showing the home folder as projectile project

There is no .projectile file in my home folder, neither is my home folder under version control.

marcus@mri-tp:~ >>> cat ~/.projectile
cat: /home/marcus/.projectile: No such file or directory

My home folder is also not in my projectile-bookmarks.eld:

("~/.emacs.d/" "~/projects/pwb-ss15/" "~/projects/fhw-symmrecog/" "~/fhw/ss15/dbassistenz/" "~/projects/dsa-compendium/" "~/.zprezto/" "~/projects/pwb-ws13/" "~/fhw/ss15/db/" "~/fhw/ss15/ps2_00/" "~/projects/jekyll-school/" "~/projects/webIsoRogue/" "~/projects/spacerace/" "~/projects/marcusriemer.de/")

I am however using projectile together with helm and ecb. To sync the ecb file tree I use the snippet from the emacs wiki: ecb + projectile:

(defvar default-ecb-source-path ())

(add-hook 'ecb-basic-buffer-sync-hook
                (lambda ()
                        (when (functionp 'projectile-get-project-directories)
                        (when (projectile-project-p)
                                (dolist (path-dir (projectile-get-project-directories))
                                (unless (member (list path-dir path-dir) default-ecb-source-path)
                                        (push (list path-dir path-dir) default-ecb-source-path)
                                        (customize-set-variable 'ecb-source-path default-ecb-source-path)
                                        ))))))

As far as I can tell I have not set projectile-require-project-root(nil):

marcus@mri-tp:~/.emacs.d >>> find . -iname "*.el" | xargs grep "projectile-require-project-root"
./elpa/helm-projectile-20150610.253/helm-projectile.el:  (let ((projectile-require-project-root nil))
./elpa/helm-projectile-20150610.253/helm-projectile.el:  (let* ((projectile-require-project-root nil)
./elpa/helm-projectile-20150610.253/helm-projectile.el:                (let ((projectile-require-project-root nil))
./elpa/projectile-20150610.2247/projectile.el:(defcustom projectile-require-project-root t
./elpa/projectile-20150610.2247/projectile.el:        (if projectile-require-project-root
./elpa/projectile-20150610.2247/projectile.el:        (projectile-require-project-root nil))
./elpa/projectile-20150610.2247/projectile.el:  (let ((projectile-require-project-root nil))

Does anyone have an idea why projectile started to index my home directory? And how can I tell it to ignore my home folder once and for all?

3
  • Do you have projectile-require-project-root set to nil?
    – Tu Do
    Commented Jun 12, 2015 at 11:07
  • If you want to delete it, you can press TAB to switch to action menu, then narrow to Delete project action.
    – Tu Do
    Commented Jun 12, 2015 at 11:17
  • I have updated the question, as far as I can tell I do net set projectile-require-project-root myself. Deleting the project didn't help. Commented Jun 12, 2015 at 13:18

2 Answers 2

10

Okay, this was dumb ... I had an empty Makefile sitting in my home directory. And because Projectile Project Root Files Top Down Recurring tells Projectile to recognize a Makefile as project root my home folder got picked up.

Just in case anybody has a similar problem in the future: If projectile picks up unwanted folders try to disable automatic project detection as a whole and see what happens. You can do that by using M-x customize RET projectile RET and setting Projectile Project Root Files Functions to an empty list. I figured out my problem after doing this and manually deleting the incorrect projectile bookmark.

1

I have my homedir in git (dotfiles only), and projectile picked it up. I'm using this to prevent my homedir from being picked up by projectile or project.el:

(defun my-projectile-ignore-homedir (dir)
  (if (and dir (equal dir (expand-file-name "~/")))
      nil
    dir))
(advice-add 'projectile-locate-dominating-file :filter-return #'my-projectile-ignore-homedir)

(defun my-project-ignore-homedir (project)
  (if (and project
           (equal (expand-file-name (nth 2 project)) (expand-file-name "~/")))
      nil
    project))
(advice-add 'project-try-vc :filter-return #'my-project-ignore-homedir)

That way projectile can still do its automatic thing without defaulting to my homedir.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.