Giter Site home page Giter Site logo

Counsel dep about neuron-mode HOT 8 CLOSED

felko avatar felko commented on June 6, 2024
Counsel dep

from neuron-mode.

Comments (8)

felko avatar felko commented on June 6, 2024

I have no idea how to implement this but I'll look into it, thanks for the suggestion

from neuron-mode.

bbuccianti avatar bbuccianti commented on June 6, 2024

Maybe we can start replacing ivy-read with completing-read? It's built-in and I think (I'm not sure) we can achieve the same that ivy-read does easily.

Also, changing it would enable users to set completing-read-function as wanted, in order to use the ivy, helm, selectrum or whatever.

from neuron-mode.

felko avatar felko commented on June 6, 2024

I didn't know emacs had native support for this kind of completion, I just tried with completing-read and everything works exactly like ivy. In fact, I'm pretty sure ivy somehow overrides completing-read, since I get all the highlighting and fuzzy matching which is obviously not builtin behavior. That may also come from my emacs distribution (doom).

As for customizing the completion function directly, how would that look like? I'm afraid that, by providing a variable that would point either to ivy-read or to whatever helm and selectrum use, I need to write a lot of glue code to adapt the agrument to each particular interface. Also, I'm not sure how to handle dependencies in that case, can I just drop the counsel dependency and dynamically require the corresponding modules?

from neuron-mode.

bbuccianti avatar bbuccianti commented on June 6, 2024

Emacs has the ability to change the completion function!

In docs:
completing-read-function is a variable defined in ‘minibuffer.el’.
Documentation:
The function called by ‘completing-read’ to do its work.
It should accept the same arguments as ‘completing-read’.

So the user can choose which completing read function to use! Maybe your completing-read-function is ivy-read so nothing changes for you. Making sure that we use completing-read arguments it's up to ivy, helm or selectrum adapt to that function and use those arguments for completion. This makes sense?

I don't know how to handle dependencies. If completing-read has worked, that means that we have only this functions from counsel?

#'counsel--find-file-matcher
counsel-find-file-map

(I've just grepped for counsel, maybe they are more)

from neuron-mode.

felko avatar felko commented on June 6, 2024

Ok that makes sense, thanks a lot for the explanation, this should be easy to implement then

from neuron-mode.

felko avatar felko commented on June 6, 2024

Alright, this should be working now in 27e288c
Let me know if it works with your completion backend

from neuron-mode.

bbuccianti avatar bbuccianti commented on June 6, 2024

That was fast!

It's working!

Thanks

from neuron-mode.

felko avatar felko commented on June 6, 2024

Cool, thanks for helping me implement this

from neuron-mode.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.