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

Add crux-with-region-or-sexp-or-line #94

Merged

Conversation

deejayem
Copy link
Contributor

@deejayem deejayem commented Oct 5, 2022

Similar to the existing macros such as crux-with-region-or-line, add a new macro called crux-with-region-or-sexp-or-line, which advises a command so that if it is called with no active region, it is instead called on the current sexp (or string), falling back to the current line.

Note: I found that some of the functions that might been more obvious to use for this didn't work correctly, e.g. list-at-point doesn't work with Clojure vectors and sets (but (thing-at-point 'list) handles them fine), and beginning-of-sexp/thing-at-point--beginning-of-sexp move along a single symbol, but not to the beginning of the list.


Before submitting a PR make sure the following things have been done (and denote this
by checking the relevant checkboxes):

  • The commits are consistent with our contribution guidelines
  • The new code is not generating bytecode or M-x checkdoc warnings
  • You've updated the changelog (if adding/changing user-visible functionality)
  • You've updated the readme (if adding/changing user-visible functionality)

Thanks!

@bbatsov bbatsov merged commit bc859e4 into bbatsov:master Nov 21, 2022
@bbatsov
Copy link
Owner

bbatsov commented Nov 21, 2022

Looks useful. Thanks!

@deejayem deejayem deleted the add-crux-with-region-or-sexp-or-line branch December 1, 2022 06:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants