Giter Site home page Giter Site logo

Comments (20)

oantolin avatar oantolin commented on August 19, 2024 1

It happens because with those matching styles (with any list of matching styles that includes orderless-regexp), the incomplete [0-9 gets compiled to a malformed regexp. Mmh.

from orderless.

oantolin avatar oantolin commented on August 19, 2024 1

I'm looking into the best way to do it. Maybe there is something better, but matching against anything (an empty string, for example) should work: if it returns it's valid, if it errors it's not.

from orderless.

oantolin avatar oantolin commented on August 19, 2024 1

I thought the (defalias 'orderless-regexp #'identity) implementation was cute, I'm kind of sad to see it go. 😛

from orderless.

minad avatar minad commented on August 19, 2024 1

You could introduce (defalias 'orderless-regexp-I-know-what-I-am-doing #'identity).

from orderless.

oantolin avatar oantolin commented on August 19, 2024

Sure, why not? The only thing that gives me pause is that you said elsewhere it didn't work for you. Let's figure out why not before doing anything.

from orderless.

minad avatar minad commented on August 19, 2024

Yes, sure. I wonder why it didn't work like this. Otherwise I don't see big downsides of doing this. And one could use style dispatchers to mark certain parts of the input as explicitly literal/regexp. However style dispatchers will also introduce problems regarding to the matching of exact inputs.

from orderless.

minad avatar minad commented on August 19, 2024

I set (setq orderless-matching-styles '(orderless-regexp orderless-literal orderless-initialism)).

If I invoke consult-line and enter [0-9, then it does not match anything. As soon as I close [0-9] it matches both 1329817321 and [0-9], assuming that [0-9] occurs literally in the buffer. This is the bug.

from orderless.

oantolin avatar oantolin commented on August 19, 2024

Mmh. Does changing the order of orderless-regexp and orderless-literal make any difference (it shouldn't, but if it does that might be a clue)?

from orderless.

minad avatar minad commented on August 19, 2024

No difference.

from orderless.

oantolin avatar oantolin commented on August 19, 2024

I'll look into it. I thought my tests covered this case...

from orderless.

minad avatar minad commented on August 19, 2024

Hmm, I see. Is it hard to detect if a regexp is valid and only include it in that case?

from orderless.

oantolin avatar oantolin commented on August 19, 2024

It looks like re-builder uses that strategy, so I will too.

from orderless.

minad avatar minad commented on August 19, 2024

I wonder why the current approach didn't lead to errors. Is this because the matching happens deep inside all-completions in the c code?

from orderless.

oantolin avatar oantolin commented on August 19, 2024

The reason is that I already have a condition-case to catch errors in matching and just report no matches.

from orderless.

oantolin avatar oantolin commented on August 19, 2024

I think I'll have the orderless-regexp style match invalid regexps literally. This seems to be the least surprising behavior.

from orderless.

oantolin avatar oantolin commented on August 19, 2024

OK, done. a609004

Now I'll add orderless-literal to the default matching styles.

from orderless.

minad avatar minad commented on August 19, 2024

Great, thanks! Nice that we also uncovered a bug through this discussion. cc @jaor

from orderless.

jaor avatar jaor commented on August 19, 2024

from orderless.

jaor avatar jaor commented on August 19, 2024

from orderless.

oantolin avatar oantolin commented on August 19, 2024

This why I always bind M-RET to exit-minibuffer, I get sick of any completion UI telling me what I can and cannot submit as input. All of them do it in different circumstances, I think.

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.