Closed obar closed 3 years ago
Actually, using cl-letf
can do the same job without noflet
and without depreciation messages:
(use-package helm-projectile
:chords ("hj" . helm-projectile)
:config
(setq helm-source-projectile-projects-actions
(helm-make-actions
"Switch to project" (lambda (project)
(let ((project-path (expand-file-name project)))
(cl-letf (((symbol-function 'projectile-project-root)
(lambda (&rest ARGS) project-path)))
(helm-projectile))))
"Open Dired in project's directory `C-d'" #'dired
"Open project root in vc-dir or magit `M-g'" #'helm-projectile-vc
"Switch to Eshell `M-e'" #'helm-projectile-switch-to-eshell
"Grep in projects `C-s'" #'helm-projectile-grep
"Compile project `M-c'. With C-u, new compile command" #'helm-projectile-compile-project
"Remove project(s) from project list `M-D'" #'helm-projectile-remove-known-project)))
PRs welcome! :-)
When switching projects in helm-projectile, the default action takes the user to a helm completion buffer with the only source being the projectile files. It's not the same as the normal helm-projectile interface, with recentf and existing project buffers as sources.
I'd rather it went to the helm-projectile interface; those additional sources are useful!
I have a hack of a solution to this, and it doesn't look like a much more elegant approach could be used without changing projectile itself. For example,
projectile-recentf-files
doesn't take arguments so it can't be told to look at a different project.At any rate, I thought I would share what I'm using in case others want to get the same results. Instead of
flet
one could usenoflet
, but perhaps that's still too much of a hack to put into the package :) Is it worth a pull request, perhaps behind a customization? Or is there another approach that I'm missing, without redefining functions to get this result?