Closed ghost closed 2 years ago
How to avoid this warning? @dandavison
I was able to correct it with the following change.
(remove-hook 'helm-after-update-hook #'helm-projectile--move-to-real)
(remove-hook 'helm-cleanup-hook #'helm-projectile--remove-move-to-real))
+(defun helm-source-projectile-files-list-before-init-hook ()
+ (add-hook 'helm-after-update-hook #'helm-projectile--move-to-real)
+ (add-hook 'helm-cleanup-hook #'helm-projectile--remove-move-to-real))
+
(defvar helm-source-projectile-files-list
(helm-build-sync-source "Projectile files"
- :before-init-hook (lambda ()
- (add-hook 'helm-after-update-hook #'helm-projectile--move-to-real)
- (add-hook 'helm-cleanup-hook #'helm-projectile--remove-move-to-real))
+ :before-init-hook 'helm-source-projectile-files-list-before-init-hook
:candidates (lambda ()
(when (projectile-project-p)
(with-helm-current-buffer
@bbatsov is this workaround good enough? Or do you have something else in mind?
I don't follow the upstream changes in Helm, so it's hard to say what's the best approach here.
I was able to correct it with the following change.
(remove-hook 'helm-after-update-hook #'helm-projectile--move-to-real) (remove-hook 'helm-cleanup-hook #'helm-projectile--remove-move-to-real)) +(defun helm-source-projectile-files-list-before-init-hook () + (add-hook 'helm-after-update-hook #'helm-projectile--move-to-real) + (add-hook 'helm-cleanup-hook #'helm-projectile--remove-move-to-real)) + (defvar helm-source-projectile-files-list (helm-build-sync-source "Projectile files" - :before-init-hook (lambda () - (add-hook 'helm-after-update-hook #'helm-projectile--move-to-real) - (add-hook 'helm-cleanup-hook #'helm-projectile--remove-move-to-real)) + :before-init-hook 'helm-source-projectile-files-list-before-init-hook :candidates (lambda () (when (projectile-project-p) (with-helm-current-buffer
@bbatsov is this workaround good enough? Or do you have something else in mind?
if you patch it like this, helm projectile find file will not work ...
@yuchunzhou you are right, thanks for noticing that. Try this instead:
(remove-hook 'helm-after-update-hook #'helm-projectile--move-to-real)
(remove-hook 'helm-cleanup-hook #'helm-projectile--remove-move-to-real))
+(defvar helm-source-projectile-files-list-before-init-hook
+ (lambda ()
+ (add-hook 'helm-after-update-hook #'helm-projectile--move-to-real)
+ (add-hook 'helm-cleanup-hook #'helm-projectile--remove-move-to-real)))
+
(defvar helm-source-projectile-files-list
(helm-build-sync-source "Projectile files"
- :before-init-hook (lambda ()
- (add-hook 'helm-after-update-hook #'helm-projectile--move-to-real)
- (add-hook 'helm-cleanup-hook #'helm-projectile--remove-move-to-real))
+ :before-init-hook 'helm-source-projectile-files-list-before-init-hook
:candidates (lambda ()
(when (projectile-project-p)
(with-helm-current-buffer
Maybe to find the reason in upstream helm code base is the right direction, so i close this issue right now.