2

I'm trying to use use-package to load projectile. Projectile uses helm for completion, which I'm also loading with use-package. Since projectile and helm have :bind sections I believe they're both being lazy-loaded.

My problem is that when I try to open a project in projectile it gives me the error message 'No projects need to be removed' after I've pressed C-c p. If I C-g to get out of that, and then press C-c p p I get the error message Please install helm from https://github.com/emacs-helm/helm.

If I open up my config file and evaluate the use-package form for helm then the 'open project' feature works great in projectile (i.e., C-c p p puts me into helm to open a known project).

My gut feeling is that use-package is deferring the loading of both helm and projectile. Pressing the projectile key combo must load projectile but not helm (even though I've got an :after section in my projectile config saying to load after helm.

Indeed - I can force helm to load (by invoking helm-recentf), after which projectile's open project feature works great.

How do I force use-package to load both projectile AND helm, when a key combo for projectile is pressed?

Here's what I've got for helm & projectile in my config file:

(use-package helm
    :ensure t
    :bind (
        ("C-x b" . helm-buffers-list)
        ("C-S-y" . helm-show-kill-ring)
        ("C-x m" . helm-M-x)
        ("C-x C-f" . helm-find-files)
        ("C-r" . helm-recentf)
    )
    :config
        (helm-mode 1)
        (setq helm-ff-file-name-history-use-recentf t)
)

(use-package projectile
  :ensure t
  :pin melpa-stable
  :after helm
  :bind-keymap (
      ("C-c p" .  projectile-command-map)
  )
  :config
      ;; (define-key projectile-mode-map (kbd "s-p") 'projectile-command-map)
      ;; (define-key projectile-mode-map (kbd "C-c p") 'projectile-command-map)
      (projectile-mode +1)
      (setq-default
          projectile-completion-system 'helm
          projectile-switch-project-action #'projectile-find-file-dwim
          ;; Display project name, or else remove this section
          projectile-mode-line '(:eval (if (string= "-" (projectile-project-name) ) " " (format " [%s] " (projectile-project-name) ) ) )
      )
)

EDIT: If I add :demand t to the use-package for helm then projectile's open-project works great. So it looks like the problem is that use-package is loading projectile, but not it's dependencies.

EDIT 2: Is this a bug in use-package?

  • You can add (require 'helm) to the :config section of projectile. projectile needs helm but without loading helm, thus its users have to make sure helm is loaded by themselves if they want the helm support. – xuchunyang Sep 4 '18 at 10:30
  • I like how you think, but that doesn't work. I still get the error about 'No projects need to be removed' – MikeTheTall Sep 4 '18 at 16:56
  • I am not sure the meaning of the error, I don't use projectile myself, however according to the source code, it's just a message, not an error. BTW, you also need to remove :after helm, since it just makes all your projectile configuration unavailable until helm has been loaded. If you are not very familiar with use-package, simply use the plain with-eval-after-load etc, after everything is working "translate" it to the use-package form. BTW, use-package is a hard thing, I guess many users (me included) don't understand its implementation. – xuchunyang Sep 5 '18 at 3:30
1

I have the same issue using helm-20190606.606, after downgrade to helm-3.2 (stable version), problem resolved.

You can :pin melpa-stable when config helm like this: https://github.com/anler/.emacs.d/blob/a28e70cff90231dab62e84d520b40b6790ca7c23/init.el#L599

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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