I asked something about the #emacs package #projectile a few weeks ago (here https://github.com/bbatsov/projectile/discussions/1920). As I wrote, I have a project B that depends on a project A. It's a C++ program with all base classes in project A and specialized ones in project A. I was not able to make use project-vc-external-roots-function. I ended up creating a new function almost identical to projectile-find-file-in-all-projects, namely projectile-linked-project-files with a .dir-locals.el variable projectile-linked-projects.
As no one seems to answer to me on Github, anyone knows if it could be a good idea to do a pull request?
=> More informations about this toot | More toots from alan@piaille.fr
The defvar
(defvar projectile-linked-projects nil "List of locations of linked projects. Should be set in a .dir-locals.el")
The list of files for current and linked projects
(defun projectile-linked-project-files () "Get a list of all files in current and linked projects." (cl-mapcan (lambda (project) (when (file-exists-p project) (mapcar (lambda (file) (expand-file-name file project)) (projectile-project-files project)))) (list (projectile-project-root) projectile-linked-projects)))
=> More informations about this toot | More toots from alan@piaille.fr
And the callable function
(defun projectile-find-file-in-linked-projects () "Jump to a file in the current or linked projects." (interactive) (find-file (projectile-completing-read "Find file in projects: " (projectile-linked-project-files))))
with
((nil . ((projectile-linked-projects . "/absolute/path/to/other/repo/"))))
in the .dir-locals.el
=> More informations about this toot | More toots from alan@piaille.fr
@alan What was the issue with project-vc-external-roots-function? If there is a bug, then it would be great if that could be fixed for everyone, and not just those who use third-party packages like these!
=> More informations about this toot | More toots from pkal@commenting.onthe.incoherenceofthe.net
@pkal if only I knew how to use it, I would be glad to tell. I was never able to use it. Do you know how to configure it?
=> More informations about this toot | More toots from alan@piaille.fr
@pkal I would love to contribute to project.el but as I said, I was not able to make it work for this feature.
=> More informations about this toot | More toots from alan@piaille.fr
@alan I'd assume, without having tested it that all you would need to do is something like
(lambda ()
(list "~/git/directory-a"
"~/git/directory-b"
"~/git/directory-c")))
=> More informations about this toot | More toots from pkal@commenting.onthe.incoherenceofthe.net
@pkal I tried something like that but I need to have it on a dir-locals.el and it did not seem to work
=> More informations about this toot | More toots from alan@piaille.fr
@pkal I may be wrong, but I think the issue is that @alan could not make use of project-vc-external-roots-function because projectile does not use it.
That said, what is the issue with projectile-find-file-in-known-projects or projectile-known-projects? Maybe project A was not known to projectile?
=> More informations about this toot | More toots from josemanuel@social.sdfeu.org
@josemanuel @pkal it searches in all of my projects. I have 4 copies of project A and B in my ~/GIT repository as I work on several branches at the same time. I want to narrow it down to only one of them.
=> More informations about this toot | More toots from alan@piaille.fr
@alan What's wrong with using git stash? Just curious, not judging.
=> More informations about this toot | More toots from josemanuel@social.sdfeu.org
@josemanuel it takes around an hour to compile the entire projects. I sometimes run some computations for several hours using one compiled version. I might not be a git power user, but I never found how to manage everything in a single repository. Several colleagues work that way too, and they are better than me with git.
=> More informations about this toot | More toots from alan@piaille.fr
@alan Thanks. Oh, by the way, there's also the function projectile-find-file-in-directory. Maybe that is what you wanted?
=> More informations about this toot | More toots from josemanuel@social.sdfeu.org
@josemanuel unfortunately, I have ~/GIT/ProjectA and ~/GIT/ProjectB so this function does not work for my case.
=> More informations about this toot | More toots from alan@piaille.fr This content has been proxied by September (3851b).Proxy Information
text/gemini