Giter Site home page Giter Site logo

!!! about orderless HOT 24 CLOSED

oantolin avatar oantolin commented on August 19, 2024
!!!

from orderless.

Comments (24)

clemera avatar clemera commented on August 19, 2024 1

Yeah, it does not add much but as it doesn't harm and some will probably like it, I think that would be nice..

from orderless.

oantolin avatar oantolin commented on August 19, 2024 1

Sure, I'd make it configurable.

from orderless.

oantolin avatar oantolin commented on August 19, 2024 1

I think maybe a single ! is a better default, since the negation of the empty string can't match anything so you're not likely to want a lone ! somewhere.

from orderless.

oantolin avatar oantolin commented on August 19, 2024 1

I think the only sensible way to make the change is what I outlined above, because orderless-filter is the function that would need to implement the complement-taking and it knows nothing about the default configuration, it just calls the pattern compiler to get a list of regexps. So the pattern compiler needs to be able to signal to orderless-filter that the complement is required.

from orderless.

oantolin avatar oantolin commented on August 19, 2024 1

I guess for a negated query nothing should be highlighted...

from orderless.

minad avatar minad commented on August 19, 2024 1

You mean negating entire queries here, right? Because afterwards you say:

Yes, sorry.

I know how I'd implement it and it's not too much work, I just don't think it really justifies the effort.

That's perfectly fine. I like that more than adding unnecessary features!

from orderless.

clemera avatar clemera commented on August 19, 2024

I recently thought about opening an related issue so I will mention it here: It would be nice to include some component dispatcher styles by default.

from orderless.

minad avatar minad commented on August 19, 2024

@clemera What do you mean? I am using this very simple dispatcher right now.

  (defun my-orderless-dispatch (pattern _index _total)
    (cond
     ((string-prefix-p "!" pattern) `(orderless-without-literal . ,(substring pattern 1)))
     ((string-suffix-p "=" pattern) `(orderless-literal . ,(substring pattern 0 -1)))
     ((string-suffix-p "~" pattern) `(orderless-flex . ,(substring pattern 0 -1)))))

from orderless.

clemera avatar clemera commented on August 19, 2024

Yeah, I mean something like that would be good to include. I think most users would appreciate it and those which don't like it or use their own dispatchers anyway aren't affected.

from orderless.

minad avatar minad commented on August 19, 2024

Yeah, I mean something like that would be good to include. I think most users would appreciate it and those which don't like it or use their own dispatchers anyway aren't affected.

I am not sure. For now I would keep it as is and rather defer this to some hypothetical demo configuration/gluing package which sets up all the things. I prefer if orderless only provides essential building blocks.

from orderless.

oantolin avatar oantolin commented on August 19, 2024

I prefer if orderless only provides essential building blocks.

I was going to say exactly that.

As for this !!! idea, I think I like it.

from orderless.

clemera avatar clemera commented on August 19, 2024

I prefer if orderless only provides essential building blocks.

In my opinion it would still do that, how does a better default harm?

from orderless.

oantolin avatar oantolin commented on August 19, 2024

Well, none of your proposed dispatchers would be on by default, right? Probably a style dispatcher for negative literals would be a good idea and I doubt many people would object to the !literal syntax.

Are there any other syntaxes that are not controversial besides !literal? Maybe literal= (though in my config I use both =literal and literal= for literal matching).

from orderless.

clemera avatar clemera commented on August 19, 2024

Maybe !literal could be included by default, that is what people coming from ivy would probably miss most. I have stolen literal= a long while ago from you and really like it but I agree having it included by default may be controversial. On the other hand I would see nothing wrong with it, when you install orderless you assume you get some orderless filter style (whatever that might be), then if you don't like it one can investigate.

from orderless.

clemera avatar clemera commented on August 19, 2024

BTW I was only talking about giving orderless-style-dispatchers a nice non-nil default value it just occurred to me that you may have assumed that I want to bake these sort of things in which I agree would be a really bad idea.

from orderless.

oantolin avatar oantolin commented on August 19, 2024

Don't worry, I understood what you meant. I guess I should keep the orderless-without-literal matching style, add an orderless-bang-dispatcher or something like that and add it to orderless-style-dispatcher by default, right?

from orderless.

minad avatar minad commented on August 19, 2024

If you add a dispatcher similar to the one I am using I would probably not install my own dispatcher 😁

from orderless.

oantolin avatar oantolin commented on August 19, 2024

I think I'd just add a dispatcher for !literal. The orderless-without-literal matching style really is special in that you'd probably never want to use without a dispatcher.

from orderless.

minad avatar minad commented on August 19, 2024

Ideally the !!! token should also be configurable such that one can dispatch to the complement-style if that is possible.

from orderless.

oantolin avatar oantolin commented on August 19, 2024

So I guess the type of pattern compilers should change. Now they have to return a list of regexps, I guess they could be allowed to return either a list of regexps or a list of the form (cons 'not list-of-regexps). And the default pattern compiler can check for these negation tokens to decide whether to include the not.

from orderless.

minad avatar minad commented on August 19, 2024

Instead of changing everything I would probably hard-code this single special case with a separate configuration variable for the token. Or just fix it to "!". You could still generalize things regarding your pattern compiler later if it turns out to be useful. But note that I have no real insight regarding the orderless codebase, I only skimmed it quickly a few times and it looked good 😆
So maybe what you are proposing is not a big change?

EDIT: Btw I changed the prefix token of consult-keep/hide-lines now to "! " such that we have compatibility.

from orderless.

oantolin avatar oantolin commented on August 19, 2024

I'm suddenly not so sure about this feature. Other than unifying keep and flush lines what do we really want it for? I think having negative literals is superuseful, but negating an entire query what is that useful for? If making keep lines act as flush lines is the only place this would be used, I'd rather just have this handled in consult, or even go back to separate keep and flush commands. What are some other use cases for negating an entire multi-component query?

from orderless.

minad avatar minad commented on August 19, 2024

@oantolin I am also fine with having the prefix "! SPC" only in consult. When I made this proposal I had not considered that possibility yet and thought that the negated literal could be useful for other things. But I do not have another need for it as of now. I agree with negative literals and their usefulness.

Regarding separate keep/flush commands - I prefer to keep the "! SPC" in band notation because of its explicitness.

I close this! Thank you for rethinking it again!

from orderless.

oantolin avatar oantolin commented on August 19, 2024

[...] thought that the negated literal could be useful for other things. But I do not have another need for it as of now.

You mean negating entire queries here, right? Because afterwards you say:

I agree with negative literals and their usefulness.

Which I think we all agree on.

Regarding separate keep/flush commands - I prefer to keep the "! SPC" in band notation because of its explicitness.

Fine by me!

I close this! Thank you for rethinking it again!

I know how I'd implement it and it's not too much work, I just don't think it really justifies the effort.

from orderless.

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.