Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a Pcase pattern that works like -let. #413

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

okamsn
Copy link

@okamsn okamsn commented Mar 3, 2024

This PR is the beginning of a pcase pattern that works like -let. For me, this would resolve #376 (which I opened).

Before I copy the tests for -let and work through the edge cases of the pattern, would you be willing to merge a pcase pattern that works like -let?

@basil-conto basil-conto added the enhancement Suggestion to improve or extend existing behavior label Apr 7, 2024
@okamsn okamsn force-pushed the pcase branch 3 times, most recently from 672d344 to abc48e2 Compare July 21, 2024 02:02
- Create file `dash-pcase.el`.
- Copy tests of `-let` (except for parallel binding tests)
  to test pattern in `pcase` and `pcase-let`.
- Update `README.md` and Info documentation using `make`.
@okamsn okamsn marked this pull request as ready for review July 21, 2024 02:08
@okamsn
Copy link
Author

okamsn commented Jul 21, 2024

This is now ready for review.

I've copied the tests of -let for testing the pattern in pcase-let and pcase, except for a test of parallel bindings for pcase, which does not apply in that context.

Should the &hash? for only match hash table, or should it match if the value is nil?

Do you want any changes in how the code works or its style?

Thank you.

- Create a substitute for `gensym` if `gensym` is not available.
- Warn that `dash-pcase` not supported in Emacs versions less than
  25.1.
- Only run tests if `pcase-defmacro` is bound.
@okamsn
Copy link
Author

okamsn commented Jul 28, 2024

I have updated the code to use dash--match-make-source-symbol when gensym is not available.

How would you like to handle Emacs versions when pcase-defmacro is not defined? It was added in Emacs 25.1. I put the code in an if expression with a warning if pcase-defmacro isn't bound. Would you like it done some other way?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Suggestion to improve or extend existing behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make dash--match public?
2 participants