reddit / emacs

Consult-project - consult extension for project.el

Qkesslerr · 2022-02-15 10:27
[Consult-project](https://github.com/Qkessler/consult-project) defines an endpoint for accessing different sources related to the common project workflow. Using [Consult](https://github.com/minad/consult)'s narrowing system, the user is able to access the current project's buffers, project files and all the known projects, in case they want to change projects quickly. Consult-project provides an extension to the default Consult functionality, using the built-in package `project.el`, defining the functions `consult-project` and `consult-project-other-window`. Furthermore, Consult-project only depends on consult, resulting in a lean and simple to maintain functionality. ⚠️ **NOTE**: This package has come to life adapting the great package [consult-projectile by OlMon](https://gitlab.com/OlMon/consult-projectile). Most if not all credit should go to him, I have been using his package for months now. What inspired me to create this package is my recent effort to avoid most third party packages, specially if they prefer a newly defined interface over the built-in Emacs interface. Also special shutout to Daniel Mendler for making such a great package! I would appreciate any feedback, I'll try to submit the package to MELPA next. https://reddit.com/link/sszyq3/video/dl9szj9m4zh81/player
[deleted] · 2022-02-15 12:20
This is brilliant! Thank you for sharing. Do you have any plans to integrate with some sort of workspace management tools like perspective.el ?
Qkesslerr · 2022-02-15 13:10
Hi there! Thanks! The buffer source that we use is built with the default consult query for buffers, to which we pass ‘project to reduce the candidate list to the buffers of the current project. You may note that consult-project doesn’t work either with perspective.el, which I also use. Maybe open up a issue at the consult repo? Considering only the buffers in the current workspace may be interesting. Maybe with built-in tab-bar-group workspaces?
Klinkenstecker · 2022-02-15 14:04
Just tested it a little and it works perfect so far. Thanks a lot for this.
Qkesslerr · 2022-02-15 14:18
Great to hear! I appreciate the kind words!
[deleted] · 2022-02-15 14:45
Aye. I often have two interdependent projects I work on simultaneously, and I use a lot of persp-projectile ([https://github.com/bbatsov/persp-projectile](https://github.com/bbatsov/persp-projectile)). I would love to try project.el but sadly it seems like it doesn't integrate with perspective.el yet. In any case, your package is fantastic!! If you have any tips for how to move to projects.el while maintaining the use of perspective.el do let me know! Or maybe I need to start exploring the tab-bar group. I just don't like having a tab-bar :D
[deleted] · 2022-02-15 15:00
A combination of these two will probably be super interesting: 1. [project-tab-groups](https://github.com/fritzgrabo/project-tab-groups) 2. [tab-bar-echo-area](https://github.com/fritzgrabo/tab-bar-echo-area). Now if only I could magically find some time to experiment :D
mclearc · 2022-02-15 15:16
I have a package on Github that creates workspaces with just project.el and tab-bar.el. It's got some basic consult integration but should also work with consult-project with minimal tweaking. Happy to hear of any feedback. https://github.com/mclear-tools/emacs-workspaces
[deleted] · 2022-02-15 15:28
That looks fantastic, thanks for sharing!
Qkesslerr · 2022-02-15 15:44
I have looking into your package on my list! Good work. If you don't find, I have some feedback, I'll open an issue some time soon.
super-linux-nerd · 2022-02-15 15:46
What does this do beyond consult's own project.el integration?
Qkesslerr · 2022-02-15 15:56
Consult's project.el integration is in light of configuring the project root when running specific commands, i.e. using consult-grep, it defaults to searching the project root directory (master now uses project.el by default, there is no longer the need to configure the project function if using project.el). After a discussion with minad, he added the project source to consult, in order to implement narrowing to known projects with consult-buffer. On the other side, consult by default does not implement a view to access project buffers, project files and other known projects, which is what this package attempts to do. Thanks for checking it out!
super-linux-nerd · 2022-02-15 16:02
Awesome, thanks for the information! As someone who loves both consult and project, thank you for writing this!
Qkesslerr · 2022-02-15 16:17
No worries!
[deleted] · 2022-02-15 19:02
> I would appreciate any feedback, I'll try to submit the package to MELPA next. Both packages (project, consult) are available on GNU ELPA, if you are interested we could add it to GNU ELPA or NonGNU ELPA.
JDRiverRun · 2022-02-15 19:15
I just found thanks to this that the latest consult-buffer implements `p` to narrow to buffers and recent files *limited to the current buffer's project*. This is really great! So consult-proj goes further by allowing you to browse projects and their files which have not yet been opened? I.e. you don't have to start in a project buffer?
Qkesslerr · 2022-02-15 19:26
Yes! We have been discussing the scope of the project and in the last iteration Daniel Mendler added consult-project-buffer, which also has the project files source, reduced to the recentf files, so they have to be opened first! Really great work by minad here!
peteymcboatface · 2022-02-15 20:31
I have a package that I use myself to quickly switch between groups of interrelated source projects (a.k.a. workspaces). It's based on project.el, treemacs (project explorer), and desktop-save-mode (preserve windows between workspace switches). Not sure if it suits your needs. Dropping the link if you're curious. https://github.com/petergardfjall/emacs-wsp
lastnamebird · 2022-02-16 01:41
this is nice! However, there are some built-in functions that can work just as effectively. For example, using `project-find-file` instead of `consult-proj--file`or even leveraging `project-switch-project`.
Qkesslerr · 2022-02-16 10:20
That’s interesting! I’ll definitely check it out, thanks!
Qkesslerr · 2022-02-16 21:35
I’ll be happy to explore that in the future! Thanks!